Datasync

Types related to the Datasync service.

  • A value to filter the children affected by a node subscription.

    This type is used by the DatasyncNode.subscribe(to:childrenConstraint:stores:file:line:queue:onEvent:onCompletion:) method.

    The children constraint defines a kind of visibility window. For the subscription to which it is applied, children that enter in the window are seen as if they were added, and children that leave the window are seen as if they were removed.

    See more

    Declaration

    Swift

    public enum DatasyncChildrenConstraint : Equatable, CustomStringConvertible
  • A value representing the policy to apply to a completed subscription.

    Whatever the policy, when a subscription is completed, its callback stops to be called. If the subscription is held by a view that is closed, the subscription must be completed as soon as its event callback uses the view.

    The SDK can keep the data available in the cache. This makes it possible to obtain the last got value in case of a subsequent read when there is no network connection at that time.

    It can also continue to silently maintain up-to-date the cache for that subscription. This can be useful when the subscription is intended to be redone later, perhaps while being offline. In this case, it may be preferable to present the user with the most recent value of the data, including a post-subscription value. However, this continues to consume network bandwidth as data continues to be transferred.

    See more

    Declaration

    Swift

    public enum DatasyncCompletedSubscriptionPolicy
  • A value representing an event of the DatasyncService.

    When the the DatasyncEventType.child(addition:change:removal:acknowledgement:) type was specified for the subscription, each DatasyncEvent instance corresponds to exactly one addition or one change or one removal or one acknowledgement. When there are several additions and/or changes and/or removals and/or acknowledgements for the same node, several DatasyncEvent instances are sent.

    See more

    Declaration

    Swift

    public struct DatasyncEvent : CustomStringConvertible, CustomDebugStringConvertible
  • A value representing the type of an event for a node.

    This type is used to indicate:

    See more

    Declaration

    Swift

    public enum DatasyncEventType : Equatable, CustomStringConvertible
  • An object that creates references to database nodes and stores event subscriptions.

    The DatasyncManager.node(for:) method or the equivalent (_:_:) operator create a DatasyncNode instance, which is a reference to a database node.

    When such a node reference, created from a given manager instance, subscribes to an event with the DatasyncNode.subscribe(to:childrenConstraint:stores:file:line:queue:onEvent:onCompletion:) method, setting the stores parameter to true (which is its default value), the returned subscription is stored by that manager. When the manager instance is deinitialized, it implicitly cancels all those stored event subscriptions automatically, including subscriptions that have other references. It is also possible to explicitly cancel an event subscription by calling the DatasyncSubscription.cancel() method manually.

    An implicit cancellation and an explicit cancellation do not have the same effect when DatasyncManager.defaultCompletedSubscriptionPolicy is DatasyncCompletedSubscriptionPolicy.keepUpdatingDataWhenImplicit.

    Managers are designed to be used as properties in view controllers, in order to bind their respective lifecycles. The view controller uses this manager to create node references and subscribe to events. Thanks to ARC (automatic reference counting), the subscriptions are automatically cancelled when the view controller is unloaded.

    See more

    Declaration

    Swift

    public final class DatasyncManager : CustomDebugStringConvertible
    extension DatasyncManager: WebcomCombinable
  • An object that represents a reference to a database node.

    By abuse of language, the node reference is sometimes assimilate with the referred node itself. This does not usually preclude understanding. Just keep in mind that there may be several references for the same database node.

    From a theoretical point of view, all nodes always exist: the concept on existence is a nonsense. From a practical point of view, we often consider that a node exists when its value is not null (the JSON null value, not to be confused with the Swift nil keyword).

    Instances are typically created using:

    A node reference always belongs to the DatasyncManager from which it was created. A node reference created from another node reference belongs to the same manager as the latter. A node reference obtained from an event belongs to the same manager as the node that subscribes to that event. Furthermore, this DatasyncManager instance derives from a WebcomApplication instance.

    See more

    Declaration

    Swift

    public final class DatasyncNode : Hashable, CustomStringConvertible
    extension DatasyncNode: WebcomCombinable
  • Declaration

    Swift

    extension DatasyncNode?
  • An object representing the Datasync service of a WebcomApplication instance. This service consists of a real-time database with a tree-like data model (equivalent to a JSON object).

    To get an object of this type, use the WebcomApplication.datasyncService property of a WebcomApplication instance. There is only one instance of this class for each WebcomApplication instance.

    A web socket with the back-end is opened for each instance.

    See more

    Declaration

    Swift

    public final class DatasyncService : WebcomService
    extension DatasyncService: WebcomCombinable
  • A value used to represent the state of the web socket opened by a DatasyncService instance.

    See more

    Declaration

    Swift

    public struct DatasyncState : Codable, Equatable, CustomStringConvertible, CustomDebugStringConvertible
  • An object representing a subscription to Datasync events.

    Instances are created by the DatasyncNode.subscribe(to:childrenConstraint:stores:file:line:queue:onEvent:onCompletion:) method.

    A subscription is cancelled:

    See more

    Declaration

    Swift

    public final class DatasyncSubscription : Hashable, CustomStringConvertible, CustomDebugStringConvertible
  • A value that represents how a subscription completed.

    See more

    Declaration

    Swift

    @frozen
    public enum DatasyncSubscriptionCompletion : Equatable, CustomStringConvertible
  • A value indicating the time at which to perform an operation

    See more

    Declaration

    Swift

    public enum DatasyncTime : Equatable
  • A namespace for stuff related to transactions.

    This enumeration does not contain any case, since it is only used as a namespace.

    See more

    Declaration

    Swift

    public enum DatasyncTransaction
  • The value of a node.

    See more

    Declaration

    Swift

    public struct DatasyncValue : WebcomValuable, CustomStringConvertible