Classes

The following classes are available globally.

  • The ClientSyncEngine is responsible for driving client side of the differential synchronization algorithm. During construction the engine gets injected with an instance of ClientSynchronizer which takes care of diff/patching operations, and an instance of ClientDataStore for storing data.

    A synchronizer in AeroGear is a module that serves two purposes which are closely related. One, is to provide storage for the data type, and the second is to provide the patching algorithm to be used on that data type. The name synchronizer is because they take care of the synchronization part of the Differential Synchronization algorithm. For example, one synchronizer, such as DiffMatchPatchSynchronizer, might support plain text while another, such as JsonPatchSynchronizer supports JSON Objects as the content of documents being stored. But a patching algorithm used for plain text might not be appropriate for JSON Objects.

    To construct a client that uses the JSON Patch you would use the following code:

    var engine: ClientSyncEngine<JsonPatchSynchronizer, InMemoryDataStore<JsonNode, JsonPatchEdit>> engine = ClientSyncEngine(synchronizer: JsonPatchSynchronizer(), dataStore: InMemoryDataStore())

    The ClientSynchronizer generic type is the type that this implementation can handle. The DataStore generic type is the type that this implementation can handle. The ClientSynchronizer and DataStore should have compatible document type.

    See more

    Declaration

    Swift

    public class ClientSyncEngine<CS:ClientSynchronizer, D:DataStore where CS.T == D.T, CS.D == D.D, CS.P.E == CS.D >
  • A shadow document for each client will exist on the client side and also on the server side.
    A shadow document is updated after a successful patch has been performed.

    <T> the type of the Document that this instance shadows.

    See more

    Declaration

    Swift

    public class ShadowDocument<T>: Printable
  • 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.

    See more

    Declaration

    Swift

    public class InMemoryDataStore<T, E: Edit>: DataStore
  • A backup of the ShadowDocument.

    <T> the type of the Document that this instance backups.

    See more

    Declaration

    Swift

    public class BackupShadowDocument<T>: Printable
  • Represents the server side version of a document.

    <T> the type of the document contents.

    See more

    Declaration

    Swift

    public class Document<T>: Printable
  • A client document is used on both the server and client side and associates a client identifier with a Document.

    <T> the type of this documents content.

    See more

    Declaration

    Swift

    public class ClientDocument<T>: Document<T>, Printable