protected final List < DataBucket > getSnapshotBuckets ( final long pSeqDataBucketKey ) throws TTIOException { // Return Value, since the revision iterates a flexible number of version, this has to be a list // first. final List < DataBucket > dataBuckets = new ArrayList < DataBucket > ( ) ; // Getting the keys for the revRoots final long [ ] pathToRoot = BucketReadTrx . dereferenceLeafOfTree ( mBucketReader , mUberBucket . getReferenceKeys ( ) [ IReferenceBucket . GUARANTEED_INDIRECT_OFFSET ] , mRootBucket . getRevision ( ) ) ; final RevisionRootBucket rootBucket = ( RevisionRootBucket ) mBucketReader . read ( pathToRoot [ IConstants . INDIRECT_BUCKET_COUNT . length ] ) ; final int numbersToRestore = Integer . parseInt ( mSession . getConfig ( ) . mProperties . getProperty ( ConstructorProps . NUMBERTORESTORE ) ) ; // starting from the current databucket final long [ ] pathToRecentBucket = dereferenceLeafOfTree ( mBucketReader , rootBucket . getReferenceKeys ( ) [ IReferenceBucket . GUARANTEED_INDIRECT_OFFSET ] , pSeqDataBucketKey ) ; DataBucket bucket ; long bucketKey = pathToRecentBucket [ IConstants . INDIRECT_BUCKET_COUNT . length ] ; // jumping through the databuckets based on the pointers while ( dataBuckets . size ( ) < numbersToRestore && bucketKey > - 1 ) { bucket = ( DataBucket ) mBucketReader . read ( bucketKey ) ; dataBuckets . add ( bucket ) ; bucketKey = bucket . getLastBucketPointer ( ) ; } // check if bucket was ever written before to perform check if ( bucketKey > - 1 ) { checkStructure ( mBucketReader , pathToRecentBucket , rootBucket , pSeqDataBucketKey ) ; checkStructure ( mBucketReader , pathToRoot , mUberBucket , mRootBucket . getRevision ( ) ) ; } return dataBuckets ; }
Dereference data bucket reference .