Interface UpdateConstraint

All Known Subinterfaces:
UpdateConstraint.PartialJSON

public interface UpdateConstraint
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.

The constraints are evaluated using the:

  • active session locks
  • existence of the topic
  • current value of the topic

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.

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(EQ, expectedValue));
 
 
Since:
6.2
Author:
DiffusionData Limited
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static interface 
    Factory for the constraint types.
    static enum 
    An operator used in a constraint comparison.
    static interface 
    A constraint requiring the current value of a JSON topic to match the partially described value.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a composed constraint that represents a logical AND of this constraint and another.
    Returns a composed constraint that represents a logical OR of this constraint and another.
  • Method Details

    • and

      Returns a composed constraint that represents a logical AND of this constraint and another.
      Parameters:
      other - a constraint that will be logically-ANDed with this constraint
      Returns:
      a composed constraint that represents a logical AND of this constraint and the other constraint
      Throws:
      IllegalArgumentException - if the composed constraint would be unsatisfiable
    • or

      Returns a composed constraint that represents a logical OR of this constraint and another.
      Parameters:
      other - a constraint that will be logically-ORed with this constraint
      Returns:
      a composed constraint that represents a logical OR of this constraint and the other constraint
      Since:
      6.10