com.bigdata.resources
Class JournalIndex

java.lang.Object
  extended by com.bigdata.btree.AbstractBTree
      extended by com.bigdata.btree.BTree
          extended by com.bigdata.resources.JournalIndex
All Implemented Interfaces:
IAutoboxBTree, IBTreeStatistics, ICheckpointProtocol, IIndex, IIndexLocalCounter, ILinearList, ILocalBTreeView, IRangeQuery, ISimpleBTree, ICounterSetAccess, ICommitter

public class JournalIndex
extends BTree

BTree mapping IJournal createTimes (long integers) to JournalMetadata records describing the IJournal.

Note: Access to this object MUST be synchronized.

Note: This is used as a transient data structure that is populated from the file system by the ResourceManager.


Nested Class Summary
protected static class JournalIndex.TupleSerializer
          Encapsulates key and value formation.
 
Nested classes/interfaces inherited from class com.bigdata.btree.BTree
BTree.Counter, BTree.LeafCursor, BTree.NodeFactory, BTree.PartitionedCounter, BTree.Stack
 
Nested classes/interfaces inherited from class com.bigdata.btree.AbstractBTree
AbstractBTree.IBTreeCounters
 
Field Summary
 
Fields inherited from class com.bigdata.btree.BTree
counter, height, nentries, nleaves, nnodes, recordVersion
 
Fields inherited from class com.bigdata.btree.AbstractBTree
branchingFactor, debug, DEBUG, dumpLog, ERROR_CLOSED, ERROR_LESS_THAN_ZERO, ERROR_READ_ONLY, ERROR_TOO_LARGE, ERROR_TRANSIENT, INFO, log, metadata, ndistinctOnWriteRetentionQueue, nodeSer, readOnly, root, store, storeCache, writeRetentionQueue
 
Fields inherited from interface com.bigdata.btree.IRangeQuery
ALL, CURSOR, DEFAULT, DELETED, FIXED_LENGTH_SUCCESSOR, KEYS, NONE, PARALLEL, READONLY, REMOVEALL, REVERSE, VALS
 
Constructor Summary
JournalIndex(IRawStore store, Checkpoint checkpoint, IndexMetadata metadata, boolean readOnly)
          Load from the store.
 
Method Summary
 void add(JournalMetadata resourceMetadata)
          Add an entry under the commitTime associated with the JournalMetadata record.
static JournalIndex createTransient()
          Create a transient instance.
 JournalMetadata find(long timestamp)
          Return the JournalMetadata identifying the journal having the largest createTime that is less than or equal to the given timestamp.
 long findIndexOf(long timestamp)
          Find the index of the ICommitRecord having the largest timestamp that is less than or equal to the given timestamp.
 JournalMetadata findNext(long timestamp)
          Find the first journal whose createTime is strictly greater than the timestamp.
 
Methods inherited from class com.bigdata.btree.BTree
_reopen, asReadOnly, create, createTransient, createViewCheckpoint, fireDirtyEvent, getBloomFilter, getCheckpoint, getCounter, getDirtyListener, getEntryCount, getHeight, getLastCommitTime, getLeafCount, getMetadataAddr, getMutableBTree, getNodeCount, getRecordVersion, getRevisionTimestamp, getRootAddr, getSourceCount, getSources, getStore, handleCommit, load, load, needsCheckpoint, newLeafCursor, newLeafCursor, readBloomFilter, removeAll, setDirtyListener, setIndexMetadata, setLastCommitTime, writeCheckpoint, writeCheckpoint2
 
Methods inherited from class com.bigdata.btree.AbstractBTree
assertNotReadOnly, assertNotTransient, close, contains, contains, decodeRecordAddr, dump, dump, encodeRecordAddr, getBranchingFactor, getBtreeCounters, getContainsTuple, getCounters, getIndexMetadata, getLookupTuple, getNodeSerializer, getResourceMetadata, getRightMostNode, getRoot, getRootOrFinger, getStatistics, getUtilization, getWriteTuple, indexOf, insert, insert, insert, isOpen, isReadOnly, isTransient, keyAt, lookup, lookup, lookup, rangeCheck, rangeCopy, rangeCount, rangeCount, rangeCount, rangeCountExact, rangeCountExactWithDeleted, rangeIterator, rangeIterator, rangeIterator, rangeIterator, rangeIterator, readNodeOrLeaf, recycle, remove, remove, remove, reopen, setBTreeCounters, submit, submit, submit, toString, touch, valueAt, valueAt, writeNodeOrLeaf, writeNodeRecursive
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JournalIndex

public JournalIndex(IRawStore store,
                    Checkpoint checkpoint,
                    IndexMetadata metadata,
                    boolean readOnly)
Load from the store.

Parameters:
store - The backing store.
checkpoint - The Checkpoint record.
metadata - The metadata record for the index.
Method Detail

createTransient

public static JournalIndex createTransient()
Create a transient instance.

Returns:
The new instance.

find

public JournalMetadata find(long timestamp)
Return the JournalMetadata identifying the journal having the largest createTime that is less than or equal to the given timestamp. This is used primarily to locate the commit record that will serve as the ground state for a transaction having timestamp as its start time. In this context the LTE search identifies the most recent commit state that not later than the start time of the transaction.

Parameters:
timestamp - The given timestamp.
Returns:
The description of the relevant journal resource -or- null iff there are no journals in the index that satisify the probe.
Throws:
IllegalArgumentException - if timestamp is less than or equals to ZERO (0L).

findNext

public JournalMetadata findNext(long timestamp)
Find the first journal whose createTime is strictly greater than the timestamp.

Parameters:
timestamp - The timestamp. A value of ZERO (0) may be used to find the first journal.
Returns:
The commit record -or- null if there is no commit record whose timestamp is strictly greater than timestamp.

findIndexOf

public long findIndexOf(long timestamp)
Find the index of the ICommitRecord having the largest timestamp that is less than or equal to the given timestamp.

Returns:
The index of the ICommitRecord having the largest timestamp that is less than or equal to the given timestamp -or- -1 iff there are no ICommitRecords defined.

add

public void add(JournalMetadata resourceMetadata)
Add an entry under the commitTime associated with the JournalMetadata record.

Parameters:
resourceMetadata - The JournalMetadata record.
Throws:
IllegalArgumentException - if commitTime is 0L.
IllegalArgumentException - if resourceMetadata is null.
IllegalArgumentException - if there is already an entry registered under for the given timestamp.


Copyright © 2006-2011 SYSTAP, LLC. All Rights Reserved.