InMemoryDataStore
An in-memory implementation of DataStore.
This implementation is mainly intended for testing and example applications.
<T> the data type data that this implementation can handle.
<E> the type of Edits that this implementation can handle.
-
Default init.
Declaration
Swift
public init() -
Saves a client document.
Declaration
Swift
public func saveClientDocument(document: ClientDocument<T>)Parameters
clientDocumentthe ClientDocument to save.
-
Retrieves the ClientDocument matching the passed-in document documentId.
Declaration
Swift
public 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
public func saveShadowDocument(shadow: ShadowDocument<T>)Parameters
shadowDocumentthe ShadowDocument to save.
-
Retrieves the ShadowDocument matching the passed-in document documentId.
Declaration
Swift
public 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
public func saveBackupShadowDocument(backup: BackupShadowDocument<T>)Parameters
backupShadowthe BackupShadowDocument to save.
-
Retrieves the BackupShadowDocument matching the passed-in document documentId.
Declaration
Swift
public 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
public func saveEdits(edit: E)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
public func getEdits(documentId: String, clientId: String) -> [E]?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
public func removeEdit(edit: E)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
public func removeEdits(documentId: String, clientId: String)Parameters
documentIdthe document identifier of the edit.
clientIdthe client identifier.
View on GitHub
InMemoryDataStore Class Reference