Interface Scheduler
-
- All Known Implementing Classes:
LockBasedScheduler
public interface Scheduler
AScheduler
instance transforms changes to the content tree into a queue ofcommits
.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 theCommitHook
contained in the actualCommit
passed to theschedule
method.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
Scheduler.SchedulerOption
Scheduling options for parametrizing individual commits.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
checkpoint(long lifetime, @NotNull Map<String,String> properties)
Creates a new checkpoint of the latest root of the tree.NodeState
getHeadNodeState()
Returns the latest state of the tree.boolean
removeCheckpoint(String name)
Releases the provided checkpoint.NodeState
schedule(@NotNull Commit commit, Scheduler.SchedulerOption... schedulingOptions)
Schedule acommit
.
-
-
-
Method Detail
-
schedule
NodeState schedule(@NotNull @NotNull Commit commit, Scheduler.SchedulerOption... schedulingOptions) throws CommitFailedException
Schedule acommit
. This method blocks until the changes in thiscommit
have been processed and persisted. That is, until a call togetHeadNodeState()
would return a node state reflecting those changes.- Parameters:
commit
- the commitschedulingOptions
- implementation specific scheduling options- Throws:
CommitFailedException
- if the commit failed and none of the changes have been applied.
-
checkpoint
String checkpoint(long lifetime, @NotNull @NotNull Map<String,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 theNodeStore.checkpointInfo(String)
method. Its semantics is entirely application specific.- Parameters:
lifetime
- time (in milliseconds, > 0) that the checkpoint should remain availableproperties
- properties to associate with the checkpoint- Returns:
- string reference of this checkpoint
-
removeCheckpoint
boolean removeCheckpoint(String name)
Releases the provided checkpoint. If the provided checkpoint doesn't exist this method should returntrue
.- 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.
-
-