Diffusion Apple API  6.10.2
Unified Client Library for iOS, tvOS and OS X / macOS
 All Classes Files Functions Variables Enumerations Enumerator Properties Pages
Class Methods | Instance Methods | List of all members
PTDiffusionUpdateConstraint Class Reference

Introduction

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.

See Also
PTDiffusionTopicUpdateFeature
Since
6.3
Inheritance diagram for PTDiffusionUpdateConstraint:
PTDiffusionPartialJSONUpdateConstraint

Class Methods

(instancetype) + lockedWithLock:
 
(instancetype) + noValue
 
(instancetype) + noTopic
 
(PTDiffusionPartialJSONUpdateConstraint *) + jsonValue
 

Instance Methods

(nullable instancetype) - andConstraint:error:
 
(nullable instancetype) - orConstraint:error:
 

Method Documentation

- (nullable instancetype) andConstraint: (PTDiffusionUpdateConstraint *)  constraint
error: (NSError **)  error 

Returns a composed constraint that represents a logical AND of this constraint and another.

Parameters
constraintThe other constraint that will be logically-ANDed with this constraint
errorLocation to store a reason in case of failure. May be nil.
Returns
A new constraint or nil if there was an error.
Exceptions
NSInvalidArgumentExceptionIf the constraint argument is nil.
Since
6.3

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.

Returns
Constraint that partially matches the current topic value.
Since
6.3
+ (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.

Parameters
lockthe lock held by the session.
Returns
Constraint requiring a lock to be held by the session.
Exceptions
NSInvalidArgumentExceptionIf the lock argument is nil.
Since
6.3
+ (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.

Returns
Constraint requiring the path to have no topic.
Since
6.3
+ (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.

Returns
Constraint requiring the topic to have no value.
Since
6.3
- (nullable instancetype) orConstraint: (PTDiffusionUpdateConstraint *)  constraint
error: (NSError **)  error 

Returns a composed constraint that represents a logical OR of this constraint and another.

Parameters
constraintThe other constraint that will be logically-ORed with this constraint
errorLocation to store a reason in case of failure. May be nil.
Returns
A new constraint or nil if there was an error.
Since
6.10