lib/imap/backup/serializer/appender.rb in imap-backup-14.4.4 vs lib/imap/backup/serializer/appender.rb in imap-backup-14.4.5
- old
+ new
@@ -5,17 +5,26 @@
module Imap::Backup
class Serializer; end
# Appends messages to the local store
class Serializer::Appender
+ # @param folder [String] the name of the folder
+ # @param imap [Serializer::Imap] the metadata serializer for the folder
+ # @param mbox [Serializer::Mbox] the folder's mailbox
def initialize(folder:, imap:, mbox:)
@folder = folder
@imap = imap
@mbox = mbox
end
# Adds a message to the metadata file and the mailbox.
# Wraps any errors with information about the message that caused them.
+ # @raise [RuntimeError] if the UID validity is not set
+ # or when an error occurs during serialization
+ # @param uid [Integer] the message's UID
+ # @param message [String] the on-disk version of the message
+ # @param flags [Array[Symbol]] the message's flags
+ # @return [void]
def append(uid:, message:, flags:)
raise "Can't add messages without uid_validity" if !imap.uid_validity
uid = uid.to_i
existing = imap.get(uid)