public class SortedLSNTreeWalker
extends java.lang.Object
A calllback function specified in the constructor is executed for each LSN found.
The walker works in two phases. The first phase is to gather and return all the INs from the INList that match the database being iterated over. For each IN, all of the LSNs of the children are passed to the callback method (processLSN). If the child was not in memory, it is added to a list of LSNs to read. When all of the in-memory INs have been processed, the list of LSNs that were harvested is sorted.
Then for each of the sorted LSNs, the target is fetched, the type determined, and the LSN and type passed to the callback method for processing. LSNs of the children of those nodes are retrieved and the process repeated until there are no more nodes to be fetched for this database's tree.
Modifier and Type | Class and Description |
---|---|
static interface |
SortedLSNTreeWalker.ExceptionPredicate |
static interface |
SortedLSNTreeWalker.TreeNodeProcessor |
Modifier and Type | Field and Description |
---|---|
protected boolean |
accumulateLNs |
protected DatabaseImpl |
dbImpl |
boolean |
didSomeMore |
Constructor and Description |
---|
SortedLSNTreeWalker(DatabaseImpl dbImpl,
boolean setDbState,
long rootLsn,
SortedLSNTreeWalker.TreeNodeProcessor callback,
java.util.List<DatabaseException> savedExceptions,
SortedLSNTreeWalker.ExceptionPredicate excPredicate) |
Modifier and Type | Method and Description |
---|---|
protected void |
addToLsnINMap(java.lang.Long lsn,
IN in,
int index) |
protected Node |
fetchLSN(long lsn,
DatabaseEntry lnKeyEntry) |
protected IN |
getResidentRootIN() |
protected IN |
getRootIN(long rootLsn)
The default behavior fetches the rootIN from the log, but classes
extending this may fetch the root from the tree.
|
java.util.List<DatabaseException> |
getSavedExceptions() |
protected void |
releaseRootIN(IN ignore) |
void |
walk()
Find all non-resident nodes, and execute the callback.
|
protected void |
walkInternal() |
protected DatabaseImpl dbImpl
protected boolean accumulateLNs
public boolean didSomeMore
public SortedLSNTreeWalker(DatabaseImpl dbImpl, boolean setDbState, long rootLsn, SortedLSNTreeWalker.TreeNodeProcessor callback, java.util.List<DatabaseException> savedExceptions, SortedLSNTreeWalker.ExceptionPredicate excPredicate) throws DatabaseException
DatabaseException
public void walk() throws DatabaseException
DatabaseException
protected void walkInternal() throws DatabaseException
DatabaseException
protected IN getRootIN(long rootLsn) throws DatabaseException
DatabaseException
protected IN getResidentRootIN() throws DatabaseException
DatabaseException
protected void releaseRootIN(IN ignore) throws DatabaseException
DatabaseException
protected void addToLsnINMap(java.lang.Long lsn, IN in, int index)
index
- a negative index signifies a DupCountLN.protected Node fetchLSN(long lsn, DatabaseEntry lnKeyEntry) throws DatabaseException
DatabaseException
public java.util.List<DatabaseException> getSavedExceptions()