public class RecordManager extends Object
Modifier and Type | Field and Description |
---|---|
protected static org.slf4j.Logger |
LOG
The LoggerFactory used by this class
|
protected static org.slf4j.Logger |
LOG_CHECK
A dedicated logger for the check
|
AtomicLong |
nbCreatedPages |
AtomicLong |
nbFreedPages
A counter to track the number of free pages
|
AtomicLong |
nbReusedPages |
Constructor and Description |
---|
RecordManager(String fileName)
Create a Record manager which will either create the underlying file
or load an existing one.
|
RecordManager(String fileName,
int pageSize)
Create a Record manager which will either create the underlying file
or load an existing one.
|
Modifier and Type | Method and Description |
---|---|
BTree |
addBTree(String name,
ElementSerializer<?> keySerializer,
ElementSerializer<?> valueSerializer,
boolean allowDuplicates)
Creates a BTree and automatically adds it to the list of managed btrees
|
void |
close()
Close the RecordManager and flush everything on disk
|
org.apache.directory.mavibot.btree.Page |
deserialize(BTree btree,
long offset) |
void |
dump()
Dump the RecordManager file
|
BTree |
getManagedTree(String name)
Get one managed trees, knowing its name.
|
Set<String> |
getManagedTrees()
Get the managed trees.
|
int |
getNbManagedTrees()
Get the number of managed trees.
|
int |
getPageSize() |
boolean |
isKeepRevisions() |
void |
manage(BTree<?,?> btree)
Manage a BTree.
|
void |
manage(BTree<?,?> btree,
boolean internalTree)
works the same as @see #manage(BTree) except the given tree will not be linked to top level trees that will be
loaded initially if the internalTree flag is set to true
|
void |
setKeepRevisions(boolean keepRevisions) |
void |
setPageSize(int pageSize) |
String |
toString() |
protected static final org.slf4j.Logger LOG
protected static final org.slf4j.Logger LOG_CHECK
public AtomicLong nbFreedPages
public AtomicLong nbCreatedPages
public AtomicLong nbReusedPages
public RecordManager(String fileName)
name
- The file name, or a folder namepublic RecordManager(String fileName, int pageSize)
name
- The file name, or a folder namepageSize
- the size of a page on diskpublic org.apache.directory.mavibot.btree.Page deserialize(BTree btree, long offset) throws EndOfFileExceededException, IOException
public void manage(BTree<?,?> btree) throws BTreeAlreadyManagedException, IOException
btree
- The new BTree to manage.BTreeAlreadyManagedException
IOException
public void manage(BTree<?,?> btree, boolean internalTree) throws BTreeAlreadyManagedException, IOException
btree
- The new BTree to manage.internalTree
- flag indicating if this is an internal treeBTreeAlreadyManagedException
IOException
public int getPageSize()
public void setPageSize(int pageSize)
public void close() throws IOException
IOException
public void dump() throws IOException
IOException
public int getNbManagedTrees()
public Set<String> getManagedTrees()
public BTree getManagedTree(String name)
public boolean isKeepRevisions()
public void setKeepRevisions(boolean keepRevisions)
keepRevisions
- the keepRevisions to setpublic BTree addBTree(String name, ElementSerializer<?> keySerializer, ElementSerializer<?> valueSerializer, boolean allowDuplicates) throws IOException, BTreeAlreadyManagedException
name
- the name of the BTreekeySerializer
- key serializervalueSerializer
- value serializerallowDuplicates
- flag for allowing duplicate keysIOException
BTreeAlreadyManagedException
public String toString()
toString
in class Object
Object.toString()
Copyright © 2012-2013 Apache Mavibot Project Parent. All Rights Reserved.