public class H2Persistence extends Object implements GCPersistence
| Constructor and Description |
|---|
H2Persistence() |
| 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) throws Exception
initialize in interface PersistenceExceptionpublic void close()
close in interface Closeableclose in interface AutoCloseablepublic 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) throws Exception
writeHead in interface PersistenceExceptionpublic 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 start()
GCPersistenceGCPersistence.sweep().start in interface GCPersistencepublic boolean markCommit(Id id) throws Exception
GCPersistencemarkCommit in interface GCPersistenceid - commit idtrue if the commit was not marked before;
false otherwiseException - if an error occurspublic void replaceCommit(Id id, Commit commit) throws Exception
GCPersistencereplaceCommit in interface GCPersistenceid - commit idException - if an error occurspublic boolean markNode(Id id) throws Exception
GCPersistencemarkNode in interface GCPersistenceid - node idtrue if the node was not marked before;
false otherwiseException - if an error occurspublic boolean markCNEMap(Id id) throws Exception
GCPersistencemarkCNEMap in interface GCPersistenceid - child node entry map idtrue if the child node entry map was not marked before;
false otherwiseException - if an error occurspublic int sweep()
throws Exception
GCPersistencesweep in interface GCPersistence-1 if number is unknownException - if an error occursCopyright © 2012-2014 The Apache Software Foundation. All Rights Reserved.