public interface UpdateConstraint
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.
The 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.
Constraints can be created using a UpdateConstraint.Factory
, an
instance of which can be obtained using
update constraints
.
For example:
UpdateConstraint.Factory factory = Diffusion.updateConstraints();
UpdateConstraint constraint = factory.locked(lock).and(factory.value(expectedValue));
Modifier and Type | Interface and Description |
---|---|
static interface |
UpdateConstraint.Factory
Factory for the constraint types.
|
static interface |
UpdateConstraint.PartialJSON
A constraint requiring the current value of a
JSON topic to match the partially described
value. |
Modifier and Type | Method and Description |
---|---|
UpdateConstraint |
and(UpdateConstraint other)
Returns a composed constraint that represents a logical AND of this
constraint and another.
|
UpdateConstraint and(UpdateConstraint other)
other
- a constraint that will be logically-ANDed with this
constraintother
constraintIllegalArgumentException
- if the composed constraint would be
unsatisfiableCopyright © 2022 Push Technology Ltd. All Rights Reserved.