Class CompositeNodeStore
- All Implemented Interfaces:
Observable,NodeStore,PrefetchNodeStore
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:
- Thread safety of the write operation can be quite costly, and will come on top of the thread safety measures already put in place by the composite node stores.
- Many JCR subsystems require global state, e.g. the versioning store. This global state can become corrupt if multiple mounts operate on it or if mounts are added and removed.
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.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface org.apache.jackrabbit.oak.spi.state.PrefetchNodeStore
NOOP -
Method Summary
Modifier and TypeMethodDescriptionaddObserver(Observer observer) Register a newObserver.checkpoint(long lifetime) Creates a new checkpoint of the latest root of the tree.checkpoint(long lifetime, Map<String, String> properties) Creates a new checkpoint of the latest root of the tree.checkpointInfo(String checkpoint) Retrieve the properties associated with a checkpoint.Returns all valid checkpoints.createBlob(InputStream inputStream) Create aBlobfrom the given input stream.Get a blob by its reference.getRoot()Returns the latest state of the tree.merge(NodeBuilder builder, CommitHook commitHook, CommitInfo info) voidprefetch(Collection<String> paths, NodeState rootState) Make an attempt to prefetch node states for the given paths and hold them in a cache.rebase(NodeBuilder builder) booleanReleases the provided checkpoint.reset(NodeBuilder builder) Reset the passedbuilderby throwing away all its changes and setting its base state to the current root state.Retrieves the root node from a previously created repository checkpoint.
-
Method Details
-
getRoot
Description copied from interface:NodeStoreReturns the latest state of the tree. -
merge
public NodeState merge(NodeBuilder builder, CommitHook commitHook, CommitInfo info) throws CommitFailedException Description copied from interface:NodeStore- Specified by:
mergein interfaceNodeStore- Parameters:
builder- the builder whose changes to applycommitHook- the commit hook to apply while merging changesinfo- commit info associated with this merge operation- Returns:
- the node state resulting from the merge.
- Throws:
CommitFailedException- if the merge failed
-
rebase
Description copied from interface:NodeStore -
reset
Description copied from interface:NodeStoreReset the passedbuilderby throwing away all its changes and setting its base state to the current root state. -
createBlob
Description copied from interface:NodeStoreCreate aBlobfrom the given input stream. The input stream is closed after this method returns.- Specified by:
createBlobin interfaceNodeStore- Parameters:
inputStream- The input stream for theBlob- Returns:
- The
BlobrepresentinginputStream - Throws:
IOException- If an error occurs while reading from the stream
-
getBlob
Description copied from interface:NodeStoreGet a blob by its reference. -
checkpoints
Description copied from interface:NodeStoreReturns all valid checkpoints. The returnedIterableprovides a snapshot of valid checkpoints at the time this method is called. That is, theIterablewill not reflect checkpoints created after this method was called.See
NodeStore.checkpoint(long, Map)for a definition of a valid checkpoint.- Specified by:
checkpointsin interfaceNodeStore- Returns:
- valid checkpoints.
-
checkpoint
Description copied from interface:NodeStoreCreates 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
propertiespassed to this methods are associated with the checkpoint and can be retrieved through theNodeStore.checkpointInfo(String)method. Its semantics is entirely application specific.- Specified by:
checkpointin interfaceNodeStore- Parameters:
lifetime- time (in milliseconds, > 0) that the checkpoint should remain availableproperties- properties to associate with the checkpoint- Returns:
- string reference of this checkpoint
-
checkpoint
Description copied from interface:NodeStoreCreates 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.This method is a shortcut for
NodeStore.checkpoint(long, Map)passing an empty map for its 2nd argument.- Specified by:
checkpointin interfaceNodeStore- Parameters:
lifetime- time (in milliseconds, > 0) that the checkpoint should remain available- Returns:
- string reference of this checkpoint
-
checkpointInfo
Description copied from interface:NodeStoreRetrieve the properties associated with a checkpoint.- Specified by:
checkpointInfoin interfaceNodeStore- Parameters:
checkpoint- string reference of a checkpoint- Returns:
- the properties associated with the checkpoint referenced by
checkpointor an empty map when there is no such checkpoint.
-
retrieve
Description copied from interface:NodeStoreRetrieves the root node from a previously created repository checkpoint. -
release
Description copied from interface:NodeStoreReleases the provided checkpoint. If the provided checkpoint doesn't exist this method should returntrue. -
addObserver
Description copied from interface:ObservableRegister a newObserver. Clients need to callCloseable.close()to stop getting notifications on the registered observer and to free up any resources associated with the registration.- Specified by:
addObserverin interfaceObservable- Returns:
- a
Closeableinstance.
-
prefetch
Description copied from interface:PrefetchNodeStoreMake an attempt to prefetch node states for the given paths and hold them in a cache.- Specified by:
prefetchin interfacePrefetchNodeStore- Parameters:
paths- the paths of the node states to prefetch.rootState- the current root node state.
-