org.apache.jackrabbit.mk.persistence
Interface Persistence

All Superinterfaces:
Closeable
All Known Subinterfaces:
GCPersistence
All Known Implementing Classes:
H2Persistence, InMemPersistence

public interface Persistence
extends Closeable

Defines the methods exposed by a persistence manager, that stores head revision id, nodes, child node entries and blobs.


Method Summary
 void initialize(File homeDir)
           
 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 writeHead(Id)) and the second is the highest commit id found or null.
 void readNode(StoredNode node)
          Read a node from storage.
 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)
           
 
Methods inherited from interface java.io.Closeable
close
 

Method Detail

initialize

void initialize(File homeDir)
                throws Exception
Throws:
Exception

readIds

Id[] readIds()
             throws Exception
Return an array of ids, where the first is the head id (as stored with 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.

Returns:
array of ids
Throws:
Exception - if an error occurs

writeHead

void writeHead(Id id)
               throws Exception
Throws:
Exception

readNode

void readNode(StoredNode node)
              throws NotFoundException,
                     Exception
Read a node from storage.

Parameters:
node - node to read, with id given in StoredNode.getId()
Throws:
NotFoundException - if no such node is found
Exception - if some other error occurs

writeNode

Id writeNode(Node node)
             throws Exception
Throws:
Exception

readCNEMap

ChildNodeEntriesMap readCNEMap(Id id)
                               throws NotFoundException,
                                      Exception
Throws:
NotFoundException
Exception

writeCNEMap

Id writeCNEMap(ChildNodeEntries map)
               throws Exception
Throws:
Exception

readCommit

StoredCommit readCommit(Id id)
                        throws NotFoundException,
                               Exception
Throws:
NotFoundException
Exception

writeCommit

void writeCommit(Id id,
                 Commit commit)
                 throws Exception
Persist a commit with an id provided by the caller.

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


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