Package com.tailf.cdb

Interface CdbDiffIterate

All Superinterfaces:
ConfIterate

public interface CdbDiffIterate extends ConfIterate
The CdbDiffIterate interface should be implemented by any class whose instances are intended to process or iterate through a set of changes.

A particular instance of the implemented class should be provided to call to CdbSubscription.diffIterate(int,CdbDiffIterate,EnumSet,Object).

The iterate method will be called for each element that has been modified and matches the subscription.

The iterate callback receives the ConfObject array kp which uniquely identifies which node in the data tree that is affected, the operation, and optionally the values it has before and after the transaction. The op parameter gives the modification as:

  • DiffIterateOperFlag.MOP_CREATED The list entry, presence container, or leaf of type empty given by kp has been created.

  • DiffIterateOperFlag.MOP_DELETED The list entry, presence container, or optional leaf given by kp has been deleted.

    If the subscription was triggered because an ancestor was deleted, the iterate method will not called at all if the delete was above the subscription point. However if the flag DiffIterateFlags.ITER_WANT_ANCESTOR_DELETE is passed to diffIteratethen deletes that trigger a descendant subscription will also generate a call to iterate, and in this case kp will be the path that was actually deleted.

  • DiffIterateOperFlag.MOP_MODIFIED A descendant of the list entry given by kp has been modified.

  • DiffIterateOperFlag.MOP_VALUE_SET The value of the leaf given by kp has been set to new_value.

  • DiffIterateOperFlag.MOP_MOVED_AFTER The list entry given by kp, in an ordered-by user list, has been moved. If new_value is null, the entry has been moved first in the list, otherwise it has been moved after the entry given by new. In this case new_value identifying an entry in the list.

If iterate returns DiffIterateResultFlag.ITER_STOP, no more iteration is done. If iterate returns DiffIterateResultFlag.ITER_RECURSE iteration continues with all children to the node. If iterate returns DiffIterateResultFlag.ITER_CONTINUE iteration ignores the children to the node (if any), and continues with the node's sibling.
  • Method Details

    • iterate

      DiffIterateResultFlag iterate(ConfObject[] kp, DiffIterateOperFlag op, ConfObject oldValue, ConfObject newValue, Object initstate)
      Iterate through a set of changes
      Parameters:
      kp - A keypath identifies which node in the data tree that was affected
      op - Operation code (MOP_CREATED, MOP_DELETED, MOP_VALUE_SET, MOP_MOVED_AFTER)
      oldValue - The old value is set to a subtype of ConfValue when leaf value has been changed ( MOP_VALUE_SET)
      newValue - The new value is set to a subtype of ConfValue when a leaf have been set,MOP_VALUE_SET. When the op is MOP_MOVED_AFTER the newValue type is ConfKey.
      initstate - An arbitrary object passed to diffIterate method.