Interface Scheduler

  • All Known Implementing Classes:
    LockBasedScheduler

    public interface Scheduler
    A Scheduler instance transforms changes to the content tree into a queue of commits.

    An implementation is free to employ any scheduling strategy as long as it guarantees all changes are applied atomically without changing the semantics of the changes recorded in the NodeBuilder or the semantics of the CommitHook contained in the actual Commit passed to the schedule method.

    • Method Detail

      • schedule

        NodeState schedule​(@NotNull
                           @NotNull Commit commit,
                           Scheduler.SchedulerOption... schedulingOptions)
                    throws CommitFailedException
        Schedule a commit. This method blocks until the changes in this commit have been processed and persisted. That is, until a call to getHeadNodeState() would return a node state reflecting those changes.
        Parameters:
        commit - the commit
        schedulingOptions - implementation specific scheduling options
        Throws:
        CommitFailedException - if the commit failed and none of the changes have been applied.
      • checkpoint

        java.lang.String checkpoint​(long lifetime,
                                    @NotNull
                                    @NotNull java.util.Map<java.lang.String,​java.lang.String> properties)
        Creates a new checkpoint of the latest root of the tree. The checkpoint remains valid for at least as long as requested and allows that state of the repository to be retrieved using the returned opaque string reference.

        The properties passed to this methods are associated with the checkpoint and can be retrieved through the NodeStore.checkpointInfo(String) method. Its semantics is entirely application specific.

        Parameters:
        lifetime - time (in milliseconds, > 0) that the checkpoint should remain available
        properties - properties to associate with the checkpoint
        Returns:
        string reference of this checkpoint
      • removeCheckpoint

        boolean removeCheckpoint​(java.lang.String name)
        Releases the provided checkpoint. If the provided checkpoint doesn't exist this method should return true.
        Parameters:
        name - string reference of a checkpoint
        Returns:
        true if the checkpoint was successfully removed, or if it doesn't exist
      • getHeadNodeState

        NodeState getHeadNodeState()
        Returns the latest state of the tree.
        Returns:
        the latest state.