public void add(PartitionAccessorRuntimeStatistics runtimeStatistics) { throughputTotal += runtimeStatistics.throughput; responseDataThroughputTotal += runtimeStatistics.responseDataThroughput; numRequestsTotal += runtimeStatistics.numRequests; numHitsTotal += runtimeStatistics.numHits; numL1CacheHitsTotal += runtimeStatistics.numL1CacheHits; numL2CacheHitsTotal += runtimeStatistics.numL2CacheHits; cacheStatisticsTotal.add(runtimeStatistics.cacheStatistics); }
@Override public PartitionRemoteFileOps getPartitionRemoteFileOps(String remoteDomainRoot, int partitionNumber) throws IOException { return new HdfsPartitionRemoteFileOps(remoteDomainRoot, partitionNumber, null); } }
@Override protected Writer getWriter(StorageEngine storageEngine, DomainVersion domainVersion, PartitionRemoteFileOps partitionRemoteFileOps, int partitionNumber) throws IOException { return storageEngine.getCompactorWriter(domainVersion, partitionRemoteFileOps, partitionNumber); } }
@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); } }
@Override public CacheStatistics getCacheStatistics() { CacheStatistics keyReaderCacheStatistics = keyFileReader.getCacheStatistics(); return new CacheStatistics( keyReaderCacheStatistics.getNumItems() + cache.size(), keyReaderCacheStatistics.getMaxNumItems() + cache.getMaxNumItems(), keyReaderCacheStatistics.getNumManagedBytes() + cache.getNumManagedBytes(), keyReaderCacheStatistics.getMaxNumManagedBytes() + cache.getMaxNumManagedBytes()); }
@Override public void deleteVersion(int versionNumber) throws IOException { for (int partition = 0; partition < domain.getNumParts(); ++partition) { PartitionRemoteFileOps fileOps = fileOpsFactory.getPartitionRemoteFileOps(remoteDomainRoot, partition); fileOps.attemptDelete(Cueball.getName(versionNumber, true)); fileOps.attemptDelete(Cueball.getName(versionNumber, false)); } } }
@Override protected ReaderResult initialValue() { return new ReaderResult(); } }
public static String getRemoteAbsolutePath(String remoteDomainRoot, int partitionNumber, String relativePath) throws IOException { return new HdfsPartitionRemoteFileOps(remoteDomainRoot, partitionNumber).getRemoteAbsolutePath(relativePath); }
@Override public PartitionRemoteFileOps getPartitionRemoteFileOps(String remoteRoot, int partitionNumber) throws IOException { return new LocalPartitionRemoteFileOps(remoteRoot, partitionNumber); } }
@Override public long getNumBytesWritten() { return keyfileWriter.getNumBytesWritten() + currentRecordOffset; }
@Override public long getNumRecordsWritten() { return keyfileWriter.getNumRecordsWritten(); }
public ReaderResult(int initialBufferSize) { requiresBufferSize(initialBufferSize); }
@Override protected Writer getWriter(StorageEngine storageEngine, DomainVersion domainVersion, PartitionRemoteFileOps partitionRemoteFileOps, int partitionNumber) throws IOException { return storageEngine.getWriter(domainVersion, partitionRemoteFileOps, partitionNumber); } }
@Override public String getRemoteAbsolutePath(String relativePath) { if (compressionCodec == null) { return partitionRoot + "/" + relativePath; } else { return partitionRoot + "/" + relativePath + "." + getCompressionCodecExtension(compressionCodec); } }
@Override public PartitionRemoteFileOpsFactory getPartitionRemoteFileOpsFactory(RemoteLocation location) { return new NoOpPartitionRemoteFileOps.Factory(); } }
@Override public PartitionRemoteFileOps getPartitionRemoteFileOps(String remoteRoot, int partitionNumber) throws IOException { return new NoOpPartitionRemoteFileOps(); } }
@Override public PartitionRemoteFileOpsFactory getPartitionRemoteFileOpsFactory(RemoteLocation location) { return new HdfsPartitionRemoteFileOps.Factory(); }
public static String getRemoteAbsolutePath(String remoteDomainRoot, int partitionNumber, String relativePath, CompressionCodec compressionCodec) throws IOException { return new HdfsPartitionRemoteFileOps(remoteDomainRoot, partitionNumber, compressionCodec).getRemoteAbsolutePath(relativePath); }
@Override public PartitionRemoteFileOps getPartitionRemoteFileOps(String remoteDomainRoot, int partitionNumber) throws IOException { return new HdfsPartitionRemoteFileOps(remoteDomainRoot, partitionNumber, CompressionCodec.GZIP); } }
@Override public PartitionRemoteFileOps getPartitionRemoteFileOps(String remoteDomainRoot, int partitionNumber) throws IOException { return new HdfsPartitionRemoteFileOps(remoteDomainRoot, partitionNumber, false); } }