![]() |
Diffusion Apple API 6.11.5
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 using logical ANDs or ORs. It is possible to compose a constraint that can never be satisfied although certain combinations, such as ANDing two incompatible constraints are prevented. Multiple session locks can be held but a topic can only have a single value.
Class Methods | |
(instancetype) | + lockedWithLock: |
(instancetype) | + noValue |
(instancetype) | + noTopic |
(PTDiffusionPartialJSONUpdateConstraint *) | + jsonValue |
Instance Methods | |
(nullable instancetype) | - andConstraint:error: |
(nullable instancetype) | - orConstraint: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.
+ (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 a topic is present at the path.
- (nullable instancetype) orConstraint: | (PTDiffusionUpdateConstraint *) | constraint | |
error: | (NSError **) | error | |
Returns a composed constraint that represents a logical OR of this constraint and another.
constraint | The other constraint that will be logically-ORed with this constraint |
error | Location to store a reason in case of failure. May be nil . |
nil
if there was an error.