org.apache.jackrabbit.mk.store
Class CopyingGC

java.lang.Object
  extended by org.apache.jackrabbit.mk.store.CopyingGC
All Implemented Interfaces:
RevisionProvider, RevisionStore

public class CopyingGC
extends Object
implements RevisionStore

Revision garbage collector that copies reachable revisions from a "from" revision store to a "to" revision store. It assumes that both stores share the same blob store. In the current design, the head revision and all the nodes it references are reachable.


Constructor Summary
CopyingGC(RevisionStore rsFrom, RevisionStore rsTo)
          Create a new instance of this class.
 
Method Summary
 void gc()
           
 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.
 StoredNode getRootNode(Id commitId)
           
 void lockHead()
          Lock the head.
 Id putCNEMap(ChildNodeEntriesMap map)
           
 Id putHeadCommit(MutableCommit commit)
          Put a new head commit.
 Id putNode(MutableNode node)
           
 void unlockHead()
          Unlock the head.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CopyingGC

public CopyingGC(RevisionStore rsFrom,
                 RevisionStore rsTo)
Create a new instance of this class.

Parameters:
rsFrom - from store
rsTo - to store
Method Detail

gc

public void gc()

getNodeState

public NodeState getNodeState(StoredNode node)
Description copied from interface: RevisionProvider
Adapts the given StoredNode to a corresponding NodeState instance.

Specified by:
getNodeState in interface RevisionProvider
Parameters:
node - stored node instance
Returns:
node state adapter

getId

public Id getId(NodeState node)
Description copied from interface: RevisionProvider
Adapts the given NodeState to the corresponding identifier.

Specified by:
getId in interface RevisionProvider
Parameters:
node - node state
Returns:
node identifier

getNode

public StoredNode getNode(Id id)
                   throws NotFoundException,
                          Exception
Specified by:
getNode in interface RevisionProvider
Throws:
NotFoundException
Exception

getCommit

public StoredCommit getCommit(Id id)
                       throws NotFoundException,
                              Exception
Specified by:
getCommit in interface RevisionProvider
Throws:
NotFoundException
Exception

getCNEMap

public ChildNodeEntriesMap getCNEMap(Id id)
                              throws NotFoundException,
                                     Exception
Specified by:
getCNEMap in interface RevisionProvider
Throws:
NotFoundException
Exception

getRootNode

public StoredNode getRootNode(Id commitId)
                       throws NotFoundException,
                              Exception
Specified by:
getRootNode in interface RevisionProvider
Throws:
NotFoundException
Exception

getHeadCommit

public StoredCommit getHeadCommit()
                           throws Exception
Specified by:
getHeadCommit in interface RevisionProvider
Throws:
Exception

getHeadCommitId

public Id getHeadCommitId()
                   throws Exception
Specified by:
getHeadCommitId in interface RevisionProvider
Throws:
Exception

putNode

public Id putNode(MutableNode node)
           throws Exception
Specified by:
putNode in interface RevisionStore
Throws:
Exception

putCNEMap

public Id putCNEMap(ChildNodeEntriesMap map)
             throws Exception
Specified by:
putCNEMap in interface RevisionStore
Throws:
Exception

lockHead

public void lockHead()
Description copied from interface: RevisionStore
Lock the head. Must be called prior to putting a new head commit.

Specified by:
lockHead in interface RevisionStore
See Also:
RevisionStore.putHeadCommit(MutableCommit)

putHeadCommit

public Id putHeadCommit(MutableCommit commit)
                 throws Exception
Description copied from interface: RevisionStore
Put a new head commit. Must be called while holding a lock on the head.

Specified by:
putHeadCommit in interface RevisionStore
Parameters:
commit - commit
Returns:
head commit id
Throws:
Exception - if an error occurs
See Also:
RevisionStore.lockHead()

unlockHead

public void unlockHead()
Description copied from interface: RevisionStore
Unlock the head.

Specified by:
unlockHead in interface RevisionStore


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