synchronized (metaBlockIndexReader.getRootBlockKey(block)) {
synchronized (metaBlockIndexReader.getRootBlockKey(block)) {
synchronized (dataBlockIndexReader.getRootBlockKey(block)) {
fromKey = bir.getRootBlockKey(i); break; toKey = bir.getRootBlockKey(i); break;
fromKey = bir.getRootBlockKey(i); break; toKey = bir.getRootBlockKey(i); break;
synchronized (metaBlockIndexReader.getRootBlockKey(block)) {
@Override public boolean seekBefore(byte[] key, int offset, int length) throws IOException { int b = reader.blockContainingKey(key, offset, length); if (b < 0) return false; // key is before the start of the file. // Question: does this block begin with 'key'? byte[] firstkKey = reader.getDataBlockIndexReader().getRootBlockKey(b); if (reader.getComparator().compare(firstkKey, 0, firstkKey.length, key, offset, length) == 0) { // Ok the key we're interested in is the first of the block, so go back // by one. if (b == 0) { // we have a 'problem', the key we want is the first of the file. return false; } b--; // TODO shortcut: seek forward in this block to the last key of the // block. } loadBlock(b, true); blockSeek(key, offset, length, true); return true; } }
/** * @return the first key in the file. May be null if file has no entries. Note * that this is not the first row key, but rather the byte form of the * first KeyValue. */ @Override public byte [] getFirstKey() { if (dataBlockIndexReader == null) { throw new BlockIndexNotLoadedException(); } return dataBlockIndexReader.isEmpty() ? null : dataBlockIndexReader.getRootBlockKey(0); }
/** * @return the first key in the file. May be null if file has no entries. Note * that this is not the first row key, but rather the byte form of the * first KeyValue. */ @Override public byte [] getFirstKey() { if (dataBlockIndexReader == null) { throw new BlockIndexNotLoadedException(); } return dataBlockIndexReader.isEmpty() ? null : dataBlockIndexReader.getRootBlockKey(0); }