@Override public ICurlyReader getInstance(CurlyFilePath curlyFilePath) throws IOException { // Note: key file reader is null as it will *not* be used return new CurlyReader(curlyFilePath, recordFileReadBufferBytes, null, 10L << 20, 1 << 10, blockCompressionCodec, offsetNumBytes, offsetInBlockNumBytes, true, 10 << 10); } }
if (loadValueFromCache(location, result)) { return; readRecordAtOffset(recordFileOffset, result); } else { } else { readRecordAtOffset(recordFileBlockOffset, result); decompressedBlockByteBuffer = decompressBlock(result.getBuffer()); result.getBuffer().flip(); dropDecompressionBuffer(); addValueToCache(locationDeepCopy, result.getBuffer());
@Override public Reader getReader(ReaderConfigurator configurator, int partitionNumber, DiskPartitionAssignment assignment) throws IOException { // This configurator is used because this reader is composed of 2 underlying readers ReaderConfigurator subConfigurator = new BaseReaderConfigurator( configurator, configurator.getCacheNumBytesCapacity(), configurator.getCacheNumItemsCapacity(), configurator.getBufferReuseMaxSize(), 2); return new CurlyReader(CurlyReader.getLatestBase(getTargetDirectory(assignment, partitionNumber)), recordFileReadBufferBytes, cueballStorageEngine.getReader(subConfigurator, partitionNumber, assignment), subConfigurator.getCacheNumBytesCapacity(), (int)subConfigurator.getCacheNumItemsCapacity(), blockCompressionCodec, offsetNumBytes, offsetInBlockNumBytes, false, subConfigurator.getBufferReuseMaxSize()); }
@Override public void get(ByteBuffer key, ReaderResult result) throws IOException { // we want at least readBufferSize bytes of available space. we might resize // again later. result.requiresBufferSize(readBufferSize); // ask the keyfile for this key keyFileReader.get(key, result); // if the key is found, then we are prepared to do the second lookup. if (result.isFound()) { // now we know where to look readRecord(result.getBuffer(), result); } }
private Compactor getCompactor(String localDir, int partitionNumber) throws IOException { return new CurlyCompactor(domain, getPartitionRemoteFileOps(RemoteLocation.DOMAIN_BUILDER, partitionNumber), localDir, new CurlyCompactingMerger(recordFileReadBufferBytes), new CueballStreamBufferMergeSort.Factory(keyHashSize, cueballValueNumBytes, hashIndexBits, getCompressionCodec(), null), new ICurlyReaderFactory() { @Override public ICurlyReader getInstance(CurlyFilePath curlyFilePath) throws IOException { // Note: key file reader is null as it will *not* be used return new CurlyReader(curlyFilePath, recordFileReadBufferBytes, null, 10L << 20, 1 << 10, blockCompressionCodec, offsetNumBytes, offsetInBlockNumBytes, true, 10 << 10); } } ); }