public class MemoryNodeStore extends java.lang.Object implements NodeStore, Observable
Constructor and Description |
---|
MemoryNodeStore() |
MemoryNodeStore(NodeState state) |
Modifier and Type | Method and Description |
---|---|
java.io.Closeable |
addObserver(Observer observer)
Register a new
Observer . |
@NotNull java.lang.String |
checkpoint(long lifetime)
Creates a new checkpoint of the latest root of the tree.
|
@NotNull java.lang.String |
checkpoint(long lifetime,
@NotNull java.util.Map<java.lang.String,java.lang.String> properties)
Creates a new checkpoint of the latest root of the tree.
|
@NotNull java.util.Map<java.lang.String,java.lang.String> |
checkpointInfo(@NotNull java.lang.String checkpoint)
Retrieve the properties associated with a checkpoint.
|
@NotNull java.lang.Iterable<java.lang.String> |
checkpoints()
Returns all valid checkpoints.
|
ArrayBasedBlob |
createBlob(java.io.InputStream inputStream)
Create a
Blob from the given input stream. |
Blob |
getBlob(@NotNull java.lang.String reference)
Get a blob by its reference.
|
NodeState |
getRoot()
Returns the latest state of the tree.
|
java.util.Set<java.lang.String> |
listCheckpoints()
test purpose only!
|
NodeState |
merge(@NotNull NodeBuilder builder,
@NotNull CommitHook commitHook,
@NotNull CommitInfo info)
This implementation is equal to first rebasing the builder and then applying it to a
new branch and immediately merging it back.
|
NodeState |
rebase(@NotNull NodeBuilder builder)
This implementation is equal to applying the differences between the builders base state
and its head state to a fresh builder on the stores root state using
ConflictAnnotatingRebaseDiff for resolving
conflicts. |
boolean |
release(java.lang.String checkpoint)
Releases the provided checkpoint.
|
NodeState |
reset(@NotNull NodeBuilder builder)
This implementation is equal resetting the builder to the root of the store and returning
the resulting node state from the builder.
|
@Nullable NodeState |
retrieve(@NotNull java.lang.String checkpoint)
Retrieves the root node from a previously created repository checkpoint.
|
java.lang.String |
toString()
Returns a string representation the head state of this node store.
|
public MemoryNodeStore(NodeState state)
public MemoryNodeStore()
public java.lang.String toString()
toString
in class java.lang.Object
public java.io.Closeable addObserver(Observer observer)
Observable
Observer
. Clients need to call Closeable.close()
to stop getting notifications on the registered observer and to free up any resources
associated with the registration.addObserver
in interface Observable
Closeable
instance.public NodeState getRoot()
NodeStore
public NodeState merge(@NotNull @NotNull NodeBuilder builder, @NotNull @NotNull CommitHook commitHook, @NotNull @NotNull CommitInfo info) throws CommitFailedException
merge
in interface NodeStore
builder
- the builder whose changes to applycommitHook
- the commit hook to apply while merging changesinfo
- commit info associated with this merge operationCommitFailedException
java.lang.IllegalArgumentException
- if the builder is not acquired from a root state of
this storepublic NodeState rebase(@NotNull @NotNull NodeBuilder builder)
ConflictAnnotatingRebaseDiff
for resolving
conflicts.public NodeState reset(@NotNull @NotNull NodeBuilder builder)
public ArrayBasedBlob createBlob(java.io.InputStream inputStream) throws java.io.IOException
NodeStore
Blob
from the given input stream. The input stream
is closed after this method returns.createBlob
in interface NodeStore
inputStream
- The input stream for the Blob
ArrayBasedBlob
.java.io.IOException
- If an error occurs while reading from the streampublic Blob getBlob(@NotNull @NotNull java.lang.String reference)
NodeStore
getBlob
in interface NodeStore
reference
- reference to the blobnull
if the reference does not resolve to a blob.Blob.getReference()
@NotNull public @NotNull java.lang.String checkpoint(long lifetime, @NotNull @NotNull java.util.Map<java.lang.String,java.lang.String> properties)
NodeStore
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.
checkpoint
in interface NodeStore
lifetime
- time (in milliseconds, > 0) that the checkpoint
should remain availableproperties
- properties to associate with the checkpoint@NotNull public @NotNull java.lang.String checkpoint(long lifetime)
NodeStore
This method is a shortcut for NodeStore.checkpoint(long, Map)
passing
an empty map for its 2nd argument.
checkpoint
in interface NodeStore
lifetime
- time (in milliseconds, > 0) that the checkpoint
should remain available@NotNull public @NotNull java.util.Map<java.lang.String,java.lang.String> checkpointInfo(@NotNull @NotNull java.lang.String checkpoint)
NodeStore
checkpointInfo
in interface NodeStore
checkpoint
- string reference of a checkpointcheckpoint
or an empty map when there is no such
checkpoint.@NotNull public @NotNull java.lang.Iterable<java.lang.String> checkpoints()
NodeStore
Iterable
provides a
snapshot of valid checkpoints at the time this method is called. That
is, the Iterable
will not reflect checkpoints created after this
method was called.
See NodeStore.checkpoint(long, Map)
for a definition of a valid
checkpoint.
checkpoints
in interface NodeStore
@Nullable public @Nullable NodeState retrieve(@NotNull @NotNull java.lang.String checkpoint)
NodeStore
public boolean release(java.lang.String checkpoint)
NodeStore
true
.public java.util.Set<java.lang.String> listCheckpoints()
Copyright © 2010 - 2020 Adobe. All Rights Reserved