@Override public PartitionUpdater getUpdater(DiskPartitionAssignment assignment, int partitionNumber) throws IOException { String localDir = getTargetDirectory(assignment, partitionNumber); return new CueballPartitionUpdater(domain, getPartitionRemoteFileOps(RemoteLocation.PARTITION_SERVER, partitionNumber), new CueballMerger(), keyHashSize, valueSize, hashIndexBits, getCompressionCodec(), localDir); }
@Override public Deleter getDeleter(DiskPartitionAssignment assignment, int partitionNumber) throws IOException { String localDir = getTargetDirectory(assignment, partitionNumber); return new CueballDeleter(localDir); }
@Override protected Set<DomainVersion> detectCachedDeltasCore() throws IOException { return detectCachedVersions(Cueball.getDeltas(localPartitionRootCache)); }
public static CueballFilePath getCueballFilePathForVersion(DomainVersion version, DomainVersion currentVersion, String localPartitionRoot, String localPartitionRootCache, boolean isBase) { if (currentVersion != null && currentVersion.equals(version)) { // If version is current version, data is in root return new CueballFilePath(localPartitionRoot + "/" + Cueball.getName(version.getVersionNumber(), isBase)); } else { // Otherwise, version must be in cache return new CueballFilePath(localPartitionRootCache + "/" + Cueball.getName(version.getVersionNumber(), isBase)); } }
@Override public Reader getReader(ReaderConfigurator configurator, int partitionNumber, DiskPartitionAssignment assignment) throws IOException { return new CueballReader( getTargetDirectory(assignment, partitionNumber), keyHashSize, hasher, valueSize, hashIndexBits, getCompressionCodec(), configurator.getCacheNumBytesCapacity(), (int)configurator.getCacheNumItemsCapacity()); }
@Override public RemoteDomainVersionDeleter getRemoteDomainVersionDeleter(RemoteLocation location) throws IOException { return new CueballRemoteDomainVersionDeleter(domain, getRoot(location), partitionRemoteFileOpsFactory); }
@Override protected Set<DomainVersion> detectCachedBasesCore() throws IOException { return detectCachedVersions(Cueball.getBases(localPartitionRootCache)); }
@Override public String toString() { return "CurlyWriter [" + "numRecordsWritten=" + getNumRecordsWritten() + ", numBytesWritten=" + getNumBytesWritten() + "]"; } }
public long getDataLength() { return getFileSize() - getFooterLength(); } }
@Override protected Integer detectCurrentVersionNumber() throws IOException { SortedSet<CueballFilePath> localBases = Cueball.getBases(localPartitionRoot); if (localBases.size() > 0) { return localBases.last().getVersion(); } else { return null; } }
@Override public IncrementalUpdatePlanner getUpdatePlanner(Domain domain) { return new CueballUpdatePlanner(domain); }
@Override public DiskPartitionAssignment getDataDirectoryPerPartition(DataDirectoriesConfigurator configurator, Collection<Integer> partitionNumbers) { return Cueball.getDataDirectoryAssignments(configurator, partitionNumbers); }
public static String getName(int versionNumber, boolean base) { String s = padVersionNumber(versionNumber) + "."; if (base) { s += "base"; } else { s += "delta"; } return s + ".cueball"; }
@Override public void close() throws IOException { // Close all buffers for (CueballStreamBuffer cueballStreamBuffer : cueballStreamBuffers) { cueballStreamBuffer.close(); } }
@Override public RemoteDomainCleaner getRemoteDomainCleaner() throws IOException { return new CueballRemoteDomainCleaner(domain, numRemoteLeafVersionsToKeep); }
@Override public IKeyFileStreamBufferMergeSort getInstance(CueballFilePath cueballBase, List<CueballFilePath> cueballDeltas) throws IOException { return new CueballStreamBufferMergeSort(cueballBase, cueballDeltas, keyHashSize, valueSize, hashIndexBits, compressionCodec, valueTransformer); }
@Override public ByteBuffer getComparableKey(ByteBuffer key) { return cueballStorageEngine.getComparableKey(key); }
public CueballPartitionUpdater(Domain domain, PartitionRemoteFileOps partitionRemoteFileOps, ICueballMerger cueballMerger, int keyHashSize, int valueSize, int hashIndexBits, CueballCompressionCodec compressionCodec, String localPartitionRoot) throws IOException { super(domain, localPartitionRoot, new CueballUpdatePlanner(domain)); this.partitionRemoteFileOps = partitionRemoteFileOps; this.cueballMerger = cueballMerger; this.keyHashSize = keyHashSize; this.valueSize = valueSize; this.hashIndexBits = hashIndexBits; this.compressionCodec = compressionCodec; }
@Override public DiskPartitionAssignment getDataDirectoryPerPartition(DataDirectoriesConfigurator configurator, Collection<Integer> partitionNumbers) { return getDataDirectoryAssignments(configurator, partitionNumbers); }