org.apache.jackrabbit.mk.persistence
Interface GCPersistence

All Superinterfaces:
Closeable, Persistence
All Known Implementing Classes:
H2Persistence, InMemPersistence

public interface GCPersistence
extends Persistence

Advanced persistence implementation offering GC support.

The persistence implementation must ensure that objects written between start() and sweep() are not swept, in other words, they must be marked implicitely.


Method Summary
 boolean markCNEMap(Id id)
          Mark a child node entry map.
 boolean markCommit(Id id)
          Mark a commit.
 boolean markNode(Id id)
          Mark a node.
 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.
 
Methods inherited from interface org.apache.jackrabbit.mk.persistence.Persistence
initialize, readCNEMap, readCommit, readIds, readNode, writeCNEMap, writeCommit, writeHead, writeNode
 
Methods inherited from interface java.io.Closeable
close
 

Method Detail

start

void start()
Start a GC cycle. All objects written to the persistence in subsequent calls are marked implicitely, i.e. they must be retained on sweep().


markCommit

boolean markCommit(Id id)
                   throws Exception
Mark a commit.

Parameters:
id - commit id
Returns:
true if the commit was not marked before; false otherwise
Throws:
Exception - if an error occurs

replaceCommit

void replaceCommit(Id id,
                   Commit commit)
                   throws Exception
Replace a commit. Introduced to replace dangling parent commits where a parent commit might be collected.

Parameters:
id - commit id
-
Throws:
Exception - if an error occurs

markNode

boolean markNode(Id id)
                 throws Exception
Mark a node.

Parameters:
id - node id
Returns:
true if the node was not marked before; false otherwise
Throws:
Exception - if an error occurs

markCNEMap

boolean markCNEMap(Id id)
                   throws Exception
Mark a child node entry map.

Parameters:
id - child node entry map id
Returns:
true if the child node entry map was not marked before; false otherwise
Throws:
Exception - if an error occurs

sweep

int sweep()
          throws Exception
Sweep all objects that are not marked and were written before the GC started.

Returns:
number of swept items or -1 if number is unknown
Throws:
Exception - if an error occurs


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.