protected static final long [ ] dereferenceLeafOfTree ( final IBackendReader pReader , final long pStartKey , final long pSeqBucketKey ) throws TTIOException { final long [ ] orderNumber = getOrderNumbers ( pSeqBucketKey ) ; // Initial state pointing to the indirect bucket of level 0. final long [ ] keys = new long [ IConstants . INDIRECT_BUCKET_COUNT . length + 1 ] ; IndirectBucket bucket = null ; keys [ 0 ] = pStartKey ; // Iterate through all levels... for ( int level = 0 ; level < orderNumber . length ; level ++ ) { // ..read the buckets and.. bucket = ( IndirectBucket ) pReader . read ( keys [ level ] ) ; // ..compute the offsets out of the order-numbers pre-computed before and store it in the // key-array. keys [ level + 1 ] = bucket . getReferenceKeys ( ) [ dataBucketOffset ( orderNumber [ level ] ) ] ; // if the bucketKey is 0, return -1 to distinguish mark non-written buckets explicitly. if ( keys [ level + 1 ] == 0 ) { Arrays . fill ( keys , - 1 ) ; return keys ; } } // Return reference to leaf of indirect tree. return keys ; }
Find reference pointing to leaf bucket of an indirect tree .