DataStore
A DataStore implementation is responsible for storing and serving data for a
Differential Synchronization implementation.
<T> the type of the Document that this data store can store.
<D> the type of Edits that this data store can store.
-
Saves a client document.
Declaration
Swift
func saveClientDocument(clientDocument: ClientDocument<T>)Parameters
clientDocumentthe ClientDocument to save.
-
Retrieves the ClientDocument matching the passed-in document documentId.
Declaration
Swift
func getClientDocument(documentId: String, clientId: String) -> ClientDocument<T>?Parameters
documentIdthe document id of the shadow document.
clientIdthe client for which to retrieve the shadow document.
Return Value
ClientDocument the client document matching the documentId.
-
Saves a shadow document.
Declaration
Swift
func saveShadowDocument(shadowDocument: ShadowDocument<T>)Parameters
shadowDocumentthe ShadowDocument to save.
-
Retrieves the ShadowDocument matching the passed-in document documentId.
Declaration
Swift
func getShadowDocument(documentId: String, clientId: String) -> ShadowDocument<T>?Parameters
documentIdthe document id of the shadow document.
clientIdthe client for which to retrieve the shadow document.
Return Value
ShadowDocument the shadow document matching the documentId.
-
Saves a backup shadow document.
Declaration
Swift
func saveBackupShadowDocument(backupShadowDocument: BackupShadowDocument<T>)Parameters
backupShadowthe BackupShadowDocument to save.
-
Retrieves the BackupShadowDocument matching the passed-in document documentId.
Declaration
Swift
func getBackupShadowDocument(documentId: String, clientId: String) -> BackupShadowDocument<T>?Parameters
documentIdthe document identifier of the backup shadow document.
clientIdthe client identifier for which to fetch the document.
Return Value
BackupShadowDocument the backup shadow document matching the documentId.
-
Saves an Edit to the data store.
Declaration
Swift
func saveEdits(edit: D)Parameters
editthe edit to be saved.
documentIdthe document identifier for the edit.
clientIdthe client identifier for the edit.
-
Retreives the array of Edits for the specified document documentId.
Declaration
Swift
func getEdits(documentId: String, clientId: String) -> [D]?Parameters
documentIdthe document identifier of the edit.
clientIdthe client identifier for which to fetch the document.
Return Value
[D] the edits for the document.
-
Removes the edit from the store.
Declaration
Swift
func removeEdit(edit: D)Parameters
editthe edit to be removed.
documentIdthe document identifier for the edit.
clientIdthe client identifier for the edit.
-
Removes all edits for the specific client and document pair.
Declaration
Swift
func removeEdits(documentId: String, clientId: String)Parameters
documentIdthe document identifier of the edit.
clientIdthe client identifier.
View on GitHub
DataStore Protocol Reference