public class DefaultRevisionStore extends Object implements Closeable
Persistence
and a BlobStore, respectively and providing caching.RevisionStore.PutToken| Modifier and Type | Field and Description |
|---|---|
static String |
CACHE_SIZE |
static int |
DEFAULT_CACHE_SIZE |
protected GCPersistence |
gcpm |
| Constructor and Description |
|---|
DefaultRevisionStore(Persistence pm) |
DefaultRevisionStore(Persistence pm,
GCPersistence gcpm)
Alternative constructor that allows disabling of garbage collection
for an in-memory test repository.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
compare(NodeState before,
NodeState after,
NodeStateDiff diff)
Compares the given two node states.
|
protected void |
compareChildNodes(NodeState before,
NodeState after,
NodeStateDiff diff)
Compares the child nodes of the given two node states.
|
protected void |
compareProperties(NodeState before,
NodeState after,
NodeStateDiff diff)
Compares the properties of the given two node states.
|
RevisionStore.PutToken |
createPutToken()
Create a put token.
|
protected static int |
determineInitialCacheSize() |
void |
gc()
Perform a garbage collection.
|
ChildNodeEntriesMap |
getCNEMap(Id id) |
StoredCommit |
getCommit(Id id) |
StoredCommit |
getHeadCommit() |
Id |
getHeadCommitId() |
Id |
getId(NodeState node)
Adapts the given
NodeState to the corresponding identifier. |
StoredNode |
getNode(Id id) |
NodeState |
getNodeState(StoredNode node)
Adapts the given
StoredNode to a corresponding
NodeState instance. |
NodeState |
getRoot()
Returns the latest state of the content tree.
|
StoredNode |
getRootNode(Id commitId) |
void |
initialize() |
void |
lockHead()
Lock the head.
|
protected void |
markCommit(StoredCommit commit)
Mark a commit.
|
protected Id |
markCommits()
Mark all commits and nodes in a garbage collection cycle.
|
Id |
putCNEMap(RevisionStore.PutToken token,
ChildNodeEntries map) |
Id |
putCommit(RevisionStore.PutToken token,
MutableCommit commit)
Store a new commit.
|
Id |
putHeadCommit(RevisionStore.PutToken token,
MutableCommit commit,
Id branchRootId,
Id branchRevId)
Put a new head commit.
|
Id |
putNode(RevisionStore.PutToken token,
MutableNode node) |
void |
unlockHead()
Unlock the head.
|
protected void |
verifyInitialized() |
public static final String CACHE_SIZE
public static final int DEFAULT_CACHE_SIZE
protected final GCPersistence gcpm
public DefaultRevisionStore(Persistence pm)
public DefaultRevisionStore(Persistence pm, GCPersistence gcpm)
pm - persistence managergcpm - the same persistence manager, or null for no GCpublic void close()
close in interface Closeableclose in interface AutoCloseableprotected void verifyInitialized()
protected static int determineInitialCacheSize()
public RevisionStore.PutToken createPutToken()
RevisionStorecreatePutToken in interface RevisionStorepublic Id putNode(RevisionStore.PutToken token, MutableNode node) throws Exception
putNode in interface RevisionStoreExceptionpublic Id putCNEMap(RevisionStore.PutToken token, ChildNodeEntries map) throws Exception
putCNEMap in interface RevisionStoreExceptionpublic void lockHead()
RevisionStorelockHead in interface RevisionStoreRevisionStore.putHeadCommit(PutToken, MutableCommit, Id, Id),
RevisionStore.unlockHead()public Id putHeadCommit(RevisionStore.PutToken token, MutableCommit commit, Id branchRootId, Id branchRevId) throws Exception
RevisionStoreputHeadCommit in interface RevisionStoretoken - put tokencommit - commitbranchRootId - former branch root id, if this is a merge; otherwise
nullbranchRevId - current branch head, i.e. last commit on this branch,
if this is a merge; otherwise nullException - if an error occursRevisionStore.lockHead()public Id putCommit(RevisionStore.PutToken token, MutableCommit commit) throws Exception
RevisionStoreputHeadCommit(MutableCommit), this method
does not affect the current head commit and therefore doesn't
require a lock on the head.putCommit in interface RevisionStoretoken - put tokencommit - commitException - if an error occurspublic void unlockHead()
RevisionStoreunlockHead in interface RevisionStoreRevisionStore.lockHead()public StoredNode getNode(Id id) throws NotFoundException, Exception
getNode in interface RevisionProviderNotFoundExceptionExceptionpublic ChildNodeEntriesMap getCNEMap(Id id) throws NotFoundException, Exception
getCNEMap in interface RevisionProviderNotFoundExceptionExceptionpublic StoredCommit getCommit(Id id) throws NotFoundException, Exception
getCommit in interface RevisionProviderNotFoundExceptionExceptionpublic StoredNode getRootNode(Id commitId) throws NotFoundException, Exception
getRootNode in interface RevisionProviderNotFoundExceptionExceptionpublic StoredCommit getHeadCommit() throws Exception
getHeadCommit in interface RevisionProviderExceptionpublic Id getHeadCommitId() throws Exception
getHeadCommitId in interface RevisionProviderExceptionpublic void compare(NodeState before, NodeState after, NodeStateDiff diff)
NodeStorepublic void gc()
protected Id markCommits() throws Exception
Exception - if an error occursprotected void markCommit(StoredCommit commit) throws Exception
commit - commitException - if an error occurspublic NodeState getNodeState(StoredNode node)
RevisionProviderStoredNode to a corresponding
NodeState instance.getNodeState in interface RevisionProvidernode - stored node instancepublic Id getId(NodeState node)
RevisionProviderNodeState to the corresponding identifier.getId in interface RevisionProvidernode - node statepublic NodeState getRoot()
NodeStoreprotected void compareProperties(NodeState before, NodeState after, NodeStateDiff diff)
before - node state before changesafter - node state after changesdiff - handler of node state differencesprotected void compareChildNodes(NodeState before, NodeState after, NodeStateDiff diff)
before - node state before changesafter - node state after changesdiff - handler of node state differencesCopyright © 2012-2013 The Apache Software Foundation. All Rights Reserved.