public class DefaultRevisionStore extends Object implements RevisionStore, 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() |
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() |
StoredNode |
getNode(Id id) |
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 gc()
protected Id markCommits() throws Exception
Exception - if an error occursprotected void markCommit(StoredCommit commit) throws Exception
commit - commitException - if an error occursCopyright © 2012-2014 The Apache Software Foundation. All Rights Reserved.