Diffusion Apple API
6.9.0
Unified Client Library for iOS, tvOS and OS X / macOS
|
A constraint to be applied to an update operation or the creation of an update stream.
Constraints describe a condition that must be satisfied for an operation to succeed. Constraints can be applied to the setting of a value or creation of an update stream. Constraints are only evaluated on the server.
Constraints are evaluated using the:
The value of a topic can be described in several ways. The value can be described as an exact value, a partial value or an unset value.
Constraints can be composed with one another. It is only possible to construct logical ANDs of constraints. Constraints can only be composed if the resulting constraint is satisfiable. Multiple session locks can be held but a topic can only have a single value. Constraints specifying multiple topic values cannot be constructed.
Class Methods | |
(instancetype) | + lockedWithLock: |
(instancetype) | + noValue |
(instancetype) | + noTopic |
(PTDiffusionPartialJSONUpdateConstraint *) | + jsonValue |
Instance Methods | |
(nullable instancetype) | - andConstraint:error: |
- (nullable instancetype) andConstraint: | (PTDiffusionUpdateConstraint *) | constraint | |
error: | (NSError **) | error | |
Returns a composed constraint that represents a logical AND of this constraint and another.
constraint | The other constraint that will be logically-ANDed with this constraint |
error | Location to store a reason in case of failure. May be nil . |
nil
if there was an error.NSInvalidArgumentException | If the constraint argument is nil . |
+ (PTDiffusionPartialJSONUpdateConstraint *) jsonValue |
Returns a constraint that partially matches the current topic value.
The topic must be PTDiffusionTopicType_JSON. The returned constraint partially describes the structure of a PTDiffusionJSON value.
+ (instancetype) lockedWithLock: | (PTDiffusionSessionLock *) | lock |
Returns a constraint requiring a lock to be held by the session.
This can be used to coordinate operations between multiple sessions.
lock | the lock held by the session. |
NSInvalidArgumentException | If the lock argument is nil . |
+ (instancetype) noTopic |
Returns a constraint requiring the path to have no topic.
This is useful when setting the first value of a topic being added using one of the 'add and set' methods without changing the value if the topic already exists. This constraint is unsatisfied if a topic is present at the path, making it unsuitable for operations that try to set topics without adding them.
+ (instancetype) noValue |
Create a constraint requiring the topic to have no value.
This is useful when setting the first value of a topic. This constraint is unsatisfied if no topic is present at the path, making it unsuitable for operations that try to add topics.