public class InMemPersistence extends Object implements GCPersistence
| Constructor and Description |
|---|
InMemPersistence() |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
initialize(File homeDir) |
boolean |
markCNEMap(Id id)
Mark a child node entry map.
|
boolean |
markCommit(Id id)
Mark a commit.
|
boolean |
markNode(Id id)
Mark a node.
|
ChildNodeEntriesMap |
readCNEMap(Id id) |
StoredCommit |
readCommit(Id id) |
Id[] |
readIds()
Return an array of ids, where the first is the head id (as stored
with
Persistence.writeHead(Id)) and the second is the highest commit
id found or null. |
void |
readNode(StoredNode node)
Read a node from storage.
|
void |
replaceCommit(Id id,
Commit commit)
Replace a commit.
|
void |
start()
Start a GC cycle.
|
int |
sweep()
Sweep all objects that are not marked and were written before the GC started.
|
Id |
writeCNEMap(ChildNodeEntries map) |
void |
writeCommit(Id id,
Commit commit)
Persist a commit with an id provided by the caller.
|
void |
writeHead(Id id) |
Id |
writeNode(Node node) |
public void initialize(File homeDir)
initialize in interface Persistencepublic Id[] readIds() throws Exception
PersistencePersistence.writeHead(Id)) and the second is the highest commit
id found or null.
This method is not guaranteed to deliver "live" results, after something is written to the storage, so it should better be used once after initialization.
readIds in interface PersistenceException - if an error occurspublic void writeHead(Id id)
writeHead in interface Persistencepublic void readNode(StoredNode node) throws NotFoundException, Exception
PersistencereadNode in interface Persistencenode - node to read, with id given in StoredNode.getId()NotFoundException - if no such node is foundException - if some other error occurspublic Id writeNode(Node node) throws Exception
writeNode in interface PersistenceExceptionpublic StoredCommit readCommit(Id id) throws NotFoundException, Exception
readCommit in interface PersistenceNotFoundExceptionExceptionpublic void writeCommit(Id id, Commit commit) throws Exception
PersistencewriteCommit in interface Persistenceid - commit idcommit - commitException - if an error occurspublic ChildNodeEntriesMap readCNEMap(Id id) throws NotFoundException, Exception
readCNEMap in interface PersistenceNotFoundExceptionExceptionpublic Id writeCNEMap(ChildNodeEntries map) throws Exception
writeCNEMap in interface PersistenceExceptionpublic void close()
close in interface Closeableclose in interface AutoCloseablepublic void start()
GCPersistenceGCPersistence.sweep().start in interface GCPersistencepublic boolean markCommit(Id id) throws NotFoundException
GCPersistencemarkCommit in interface GCPersistenceid - commit idtrue if the commit was not marked before;
false otherwiseNotFoundExceptionpublic boolean markNode(Id id) throws NotFoundException
GCPersistencemarkNode in interface GCPersistenceid - node idtrue if the node was not marked before;
false otherwiseNotFoundExceptionpublic boolean markCNEMap(Id id) throws NotFoundException
GCPersistencemarkCNEMap in interface GCPersistenceid - child node entry map idtrue if the child node entry map was not marked before;
false otherwiseNotFoundExceptionpublic void replaceCommit(Id id, Commit commit) throws Exception
GCPersistencereplaceCommit in interface GCPersistenceid - commit idcommit - the commitException - if an error occurspublic int sweep()
GCPersistencesweep in interface GCPersistence-1 if number is unknownCopyright © 2012-2014 The Apache Software Foundation. All Rights Reserved.