AttachmentQueue
Class used to implement the attachment queue. Requires a PowerSyncDatabase, an implementation of AbstractRemoteStorageAdapter, and an attachment directory name which will determine which folder attachments are stored into.
Constructors
Properties
Service which provides access to attachment records. Use this to:
PowerSync database client.
Provides access to local filesystem storage methods.
Adapter which interfaces with the remote storage backend.
Functions
Clears the attachment queue and deletes all attachment files.
A function which creates an attachment delete operation locally. This operation is queued for delete. The default implementation assumes the attachment record already exists locally. An exception is thrown if the record does not exist locally. This method can be overridden for custom behavior.
Removes all archived items.
Returns the user's storage directory with the attachment path used to load the file. Example: filePath: "attachment-1.jpg" returns "/data/user/0/com.yourdomain.app/files/attachments/attachment-1.jpg".
Processes attachment items returned from watchAttachments. The default implementation asserts the items returned from watchAttachments as the definitive state for local attachments.
Resolves the filename for new attachment items. A new attachment from watchAttachments might not include a filename. Concatenates the attachment ID and extension by default. This method can be overridden for custom behavior.
A function which creates a new attachment locally. This new attachment is queued for upload after creation.
Stops syncing. Syncing may be resumed with startSync.