DatasyncEventType
public enum DatasyncEventType : Equatable, CustomStringConvertible
A value representing the type of an event for a node.
This type is used to indicate:
- the type of events to subscribe to using the
DatasyncNode.subscribe(to:childrenConstraint:stores:file:line:queue:onEvent:onCompletion:)
method, - the type of a received event by the
DatasyncEvent.eventType
property.
-
The event relates to the value of the whole node.
The
change
associated value relates to change of the value of the node:- for a subscription, it indicates whether to receive events when the value of the node changes,
- for a received event, it indicates that the value of the node has changed.
The
acknowledgement
associated value relates to acknowledgement of the local value of the node by the back-end:- for a subscription, it indicates whether to receive events when the back-end acknowledges the local value of the node,
- for a received event, it indicates that the back-end has acknowledged the local value of the node.
For a subscription, both associated values may be set to
true
simultaneously. In a received event, one and only one of the associated values istrue
.Declaration
Swift
case value(change: Bool = false, acknowledgement: Bool = false)
-
The event relates to children of the node.
The
addition
associated value relates to children addition:- for a subscription, it indicates whether to receive events when new children are added to the node,
- for a received event, it indicates that one child has been added to the node.
The
change
associated value relates to children change:- for a subscription, it indicates whether to receive events when the value of existing children changes,
- for a received event, it indicates that the value of one child has changed.
The
removal
associated value relates to children removal:- for a subscription, it indicates whether to receive events when children are removed from the node,
- for a received event, it indicates that one child has been removed from the node.
The
acknowledgement
associated value relates to acknowledgement of the local value of children of the node by the back-end:- for a subscription, it indicates whether to receive events when the back-end acknowledges the local value of children of the node,
- for a received event, it indicates that the back-end has acknowledged the local value of a child of the node.
For a subscription, several associated values may be set to
true
simultaneously. In a received event, one and only one of the associated values istrue
.A
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, severalDatasyncEvent
are sent.Declaration
Swift
case child(addition: Bool = false, change: Bool = false, removal: Bool = false, acknowledgement: Bool = false)
-
The event relates to a change of the value of the node.
This is a shortcut for
.value(change: true, acknowledgement: false)
.Declaration
Swift
public static let valueChange: DatasyncEventType
-
The event relates to an acknowledgement of the local value of the node by the back-end.
This is a shortcut for
.value(change: false, acknowledgement: true)
.Declaration
Swift
public static let valueAcknowledgement: DatasyncEventType
-
The event relates to the value of the whole node.
This is a shortcut for
.value(change: true, acknowledgement: true)
.Declaration
Swift
public static let valueEvent: DatasyncEventType
-
The event relates to children addition.
This is a shortcut for
.child(addition: true, change: false, removal: false, acknowledgement: false)
.When a
DatasyncChildrenConstraint
was used for a subscription, a child entering the visibility window is seen as being added.Declaration
Swift
public static let childAddition: DatasyncEventType
-
The event relates to children change.
This is a shortcut for
.child(addition: false, change: true, removal: false, acknowledgement: false)
.Declaration
Swift
public static let childChange: DatasyncEventType
-
The event relates to children removal.
This is a shortcut for
.child(addition: false, change: false, removal: true, acknowledgement: false)
.When a
DatasyncChildrenConstraint
was used for a subscription, a child leaving in the visibility window is seen as being removed.Declaration
Swift
public static let childRemoval: DatasyncEventType
-
The event relates to children addition or children change or children removal.
This is a shortcut for
.child(addition: true, change: true, removal: true, acknowledgement: false)
.Declaration
Swift
public static let childUpdate: DatasyncEventType
-
The event relates to an acknowledgement of the local value of children of the node by the back-end.
This is a shortcut for
.child(addition: false, change: false, removal: false, acknowledgement: true)
.Declaration
Swift
public static let childAcknowledgement: DatasyncEventType
-
The event relates to children of the node.
This is a shortcut for
.child(addition: true, change: true, removal: true, acknowledgement: true)
.Declaration
Swift
public static let childEvent: DatasyncEventType
-
Indicates whether the event relates to acknowledgement of the local value of the node or a child of the node by the back-end.
This property is
true
if and only if theacknowledgement
associated value istrue
, either for the.value(change:acknowledgement)
case or the.child(addition:change:removal:acknowledgement:)
case.Declaration
Swift
public var isAcknowledgement: Bool { get }
-
Declaration
Swift
public var description: String { get }