public class CompositeNodeStore extends java.lang.Object implements NodeStore, Observable
NodeStore
implementation that combines other NodeStore
instances
mounted under paths defined by Mount
.
The main objective of this implementation is to proxy operations working on at most single read-write store with any number of read-only stores. While the composition would technically work at the NodeStore level there are several less-than-obvious issues which prevent it:
As such, the only supported configuration is at most a single write-enabled store.
Because of the limitation described above, right now the only correct way to use
CompositeNodeStore is to create a normal repository, split it into parts
using oak-upgrade --{include,exclude}-paths
and then configure this
node store implementation to composite split parts together.
Modifier and Type | Class and Description |
---|---|
static class |
CompositeNodeStore.Builder |
Modifier and Type | Method and Description |
---|---|
java.io.Closeable |
addObserver(Observer observer)
Register a new
Observer . |
java.lang.String |
checkpoint(long lifetime)
Creates a new checkpoint of the latest root of the tree.
|
java.lang.String |
checkpoint(long lifetime,
java.util.Map<java.lang.String,java.lang.String> properties)
Creates a new checkpoint of the latest root of the tree.
|
java.util.Map<java.lang.String,java.lang.String> |
checkpointInfo(java.lang.String checkpoint)
Retrieve the properties associated with a checkpoint.
|
java.lang.Iterable<java.lang.String> |
checkpoints()
Returns all valid checkpoints.
|
Blob |
createBlob(java.io.InputStream inputStream)
Create a
Blob from the given input stream. |
Blob |
getBlob(java.lang.String reference)
Get a blob by its reference.
|
NodeState |
getRoot()
Returns the latest state of the tree.
|
NodeState |
merge(NodeBuilder builder,
CommitHook commitHook,
CommitInfo info)
|
NodeState |
rebase(NodeBuilder builder)
|
boolean |
release(java.lang.String checkpoint)
Releases the provided checkpoint.
|
NodeState |
reset(NodeBuilder builder)
Reset the passed
builder by throwing away all its changes and
setting its base state to the current root state. |
NodeState |
retrieve(java.lang.String checkpoint)
Retrieves the root node from a previously created repository checkpoint.
|
public NodeState getRoot()
NodeStore
public NodeState merge(NodeBuilder builder, CommitHook commitHook, CommitInfo info) throws CommitFailedException
NodeStore
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
- if the merge failedpublic NodeState rebase(NodeBuilder builder)
NodeStore
public NodeState reset(NodeBuilder builder)
NodeStore
builder
by throwing away all its changes and
setting its base state to the current root state.public Blob 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
Blob
representing inputStream
java.io.IOException
- If an error occurs while reading from the streampublic Blob getBlob(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()
public 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
public java.lang.String checkpoint(long lifetime, 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 checkpointpublic 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 availablepublic java.util.Map<java.lang.String,java.lang.String> checkpointInfo(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.public NodeState retrieve(java.lang.String checkpoint)
NodeStore
public boolean release(java.lang.String checkpoint)
NodeStore
true
.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.Copyright © 2010 - 2020 Adobe. All Rights Reserved