public class BucketReadTrx extends Object implements IBucketReadTrx
State of a reading transaction. The only thing shared amongst transactions is the bucket cache. Everything else is exclusive to this transaction. It is required that only a single thread has access to this transaction.
A path-like cache boosts sequential operations.
Modifier and Type | Field and Description |
---|---|
protected com.google.common.cache.Cache<Long,DataBucket> |
mCache
Cache for reading data.
|
protected MetaBucket |
mMetaBucket
Cached name bucket of this revision.
|
protected RevisionRootBucket |
mRootBucket
Cached root bucket of this revision.
|
protected ISession |
mSession
Configuration of the session
|
Modifier | Constructor and Description |
---|---|
protected |
BucketReadTrx(ISession pSession,
UberBucket pUberBucket,
RevisionRootBucket pRevBucket,
MetaBucket pMetaBucket,
IBackendReader pReader)
Standard constructor.
|
Modifier and Type | Method and Description |
---|---|
protected IData |
checkItemIfDeleted(IData pToCheck)
Method to check if an
IData is a deleted one. |
boolean |
close()
Closing this Readtransaction.
|
protected static int |
dataBucketOffset(long pDataKey)
Calculate data bucket offset for a given data key.
|
protected static long[] |
dereferenceLeafOfTree(IBackendReader pReader,
long pStartKey,
long pSeqBucketKey)
Find reference pointing to leaf bucket of an indirect tree.
|
IData |
getData(long pDataKey)
Getting the data related to the given data key.
|
MetaBucket |
getMetaBucket()
Getting the map with the entire mapping for retrieving meta-information related to the bundle.
|
long |
getRevision()
Getting the revision number of this transaction
|
protected List<DataBucket> |
getSnapshotBuckets(long pSeqDataBucketKey)
Dereference data bucket reference.
|
boolean |
isClosed()
Check if transaction is closed.
|
String |
toString() |
protected final RevisionRootBucket mRootBucket
protected final MetaBucket mMetaBucket
protected final ISession mSession
protected final com.google.common.cache.Cache<Long,DataBucket> mCache
protected BucketReadTrx(ISession pSession, UberBucket pUberBucket, RevisionRootBucket pRevBucket, MetaBucket pMetaBucket, IBackendReader pReader) throws TTException
pSession
- State of state.pUberBucket
- Uber bucket to start reading with.pRevBucket
- RevisionBucket with reference from either log to commit or persistent memory.pMetaBucket
- MetaBucket with reference from either log to commit or persistent memory.pReader
- for this transactionTTIOException
- if the read of the persistent storage failsTTException
public IData getData(long pDataKey) throws TTIOException
getData
in interface IBucketReadTrx
pDataKey
- searched forTTIOException
- if the read to the persistent storage failspublic boolean close() throws TTIOException
close
in interface IBucketReadTrx
TTIOException
- if the closing to the persistent storage fails.public long getRevision() throws TTIOException
getRevision
in interface IBucketReadTrx
TTIOException
- if deserialization fails.public boolean isClosed()
isClosed
in interface IBucketReadTrx
public MetaBucket getMetaBucket()
getMetaBucket
in interface IBucketReadTrx
protected final IData checkItemIfDeleted(IData pToCheck)
IData
is a deleted one.pToCheck
- of the IItemprotected final List<DataBucket> getSnapshotBuckets(long pSeqDataBucketKey) throws TTIOException
pSeqDataBucketKey
- Key of data bucket.TTIOException
- if something odd happens within the creation process.protected static final int dataBucketOffset(long pDataKey)
pDataKey
- data key to find offset for.protected static final long[] dereferenceLeafOfTree(IBackendReader pReader, long pStartKey, long pSeqBucketKey) throws TTIOException
pStartKey
- Start reference pointing to the indirect tree.pSeqBucketKey
- Key to look up in the indirect tree.TTIOException
- if something odd happens within the creation process.Copyright © 2013. All Rights Reserved.