本文整理汇总了Java中org.apache.cassandra.db.Directories.DataDirectory方法的典型用法代码示例。如果您正苦于以下问题:Java Directories.DataDirectory方法的具体用法?Java Directories.DataDirectory怎么用?Java Directories.DataDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.db.Directories
的用法示例。
在下文中一共展示了Directories.DataDirectory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getContextMapping
import org.apache.cassandra.db.Directories; //导入方法依赖的package包/类
/** Translates remote files to local files by creating a local sstable per remote sstable. */
public static PendingFile getContextMapping(PendingFile remote) throws IOException
{
/* Create a local sstable for each remote sstable */
Descriptor remotedesc = remote.desc;
if (!remotedesc.isStreamCompatible())
throw new UnsupportedOperationException(String.format("SSTable %s is not compatible with current version %s",
remote.getFilename(), Descriptor.Version.CURRENT));
// new local sstable
Table table = Table.open(remotedesc.ksname);
ColumnFamilyStore cfStore = table.getColumnFamilyStore(remotedesc.cfname);
Directories.DataDirectory localDir = cfStore.directories.getLocationCapableOfSize(remote.size);
if (localDir == null)
throw new RuntimeException("Insufficient disk space to store " + remote.size + " bytes");
Descriptor localdesc = Descriptor.fromFilename(cfStore.getTempSSTablePath(cfStore.directories.getLocationForDisk(localDir)));
return new PendingFile(localdesc, remote);
}
示例2: getContextMapping
import org.apache.cassandra.db.Directories; //导入方法依赖的package包/类
/** Translates remote files to local files by creating a local sstable per remote sstable. */
public static PendingFile getContextMapping(PendingFile remote) throws IOException
{
/* Create a local sstable for each remote sstable */
Descriptor remotedesc = remote.desc;
if (!remotedesc.isStreamCompatible())
throw new UnsupportedOperationException(String.format("SSTable %s is not compatible with current version %s",
remote.getFilename(), Descriptor.Version.CURRENT));
// new local sstable
Table table = Table.open(remotedesc.ksname);
ColumnFamilyStore cfStore = table.getColumnFamilyStore(remotedesc.cfname);
Directories.DataDirectory localDir = cfStore.directories.getWriteableLocation();
if (localDir == null)
throw new RuntimeException("Insufficient disk space to store " + remote.size + " bytes");
Descriptor localdesc = Descriptor.fromFilename(cfStore.getTempSSTablePath(cfStore.directories.getLocationForDisk(localDir)));
return new PendingFile(localdesc, remote);
}
示例3: createWriter
import org.apache.cassandra.db.Directories; //导入方法依赖的package包/类
protected SSTableWriter createWriter(ColumnFamilyStore cfs, long totalSize, long repairedAt) throws IOException
{
Directories.DataDirectory localDir = cfs.directories.getWriteableLocation(totalSize);
if (localDir == null)
throw new IOException("Insufficient disk space to store " + totalSize + " bytes");
desc = Descriptor.fromFilename(cfs.getTempSSTablePath(cfs.directories.getLocationForDisk(localDir)));
return new SSTableWriter(desc.filenameFor(Component.DATA), estimatedKeys, repairedAt);
}
示例4: getWriteDirectory
import org.apache.cassandra.db.Directories; //导入方法依赖的package包/类
protected Directories.DataDirectory getWriteDirectory(long writeSize)
{
Directories.DataDirectory directory = getDirectories().getWriteableLocation(writeSize);
if (directory == null)
throw new RuntimeException("Insufficient disk space to write " + writeSize + " bytes");
return directory;
}
示例5: createWriter
import org.apache.cassandra.db.Directories; //导入方法依赖的package包/类
protected SSTableWriter createWriter(ColumnFamilyStore cfs, long totalSize) throws IOException
{
Directories.DataDirectory localDir = cfs.directories.getWriteableLocation();
if (localDir == null)
throw new IOException("Insufficient disk space to store " + totalSize + " bytes");
desc = Descriptor.fromFilename(cfs.getTempSSTablePath(cfs.directories.getLocationForDisk(localDir)));
return new SSTableWriter(desc.filenameFor(Component.DATA), estimatedKeys);
}
示例6: runMayThrow
import org.apache.cassandra.db.Directories; //导入方法依赖的package包/类
/**
* Run this task after selecting the optimal disk for it
*/
protected void runMayThrow() throws Exception
{
long writeSize;
Directories.DataDirectory directory;
while (true)
{
writeSize = getExpectedWriteSize();
directory = getDirectories().getWriteableLocation();
if (directory != null || !reduceScopeForLimitedSpace())
break;
}
if (directory == null)
throw new RuntimeException("Insufficient disk space to write " + writeSize + " bytes");
directory.currentTasks.incrementAndGet();
directory.estimatedWorkingSize.addAndGet(writeSize);
try
{
runWith(getDirectories().getLocationForDisk(directory));
}
finally
{
directory.estimatedWorkingSize.addAndGet(-1 * writeSize);
directory.currentTasks.decrementAndGet();
}
}
示例7: switchCompactionLocation
import org.apache.cassandra.db.Directories; //导入方法依赖的package包/类
public void switchCompactionLocation(Directories.DataDirectory location)
{
long currentPartitionsToWrite = Math.round(ratios[currentRatioIndex] * estimatedTotalKeys);
@SuppressWarnings("resource")
SSTableWriter writer = SSTableWriter.create(Descriptor.fromFilename(cfs.getSSTablePath(getDirectories().getLocationForDisk(location))),
currentPartitionsToWrite,
minRepairedAt,
cfs.metadata,
new MetadataCollector(allSSTables, cfs.metadata.comparator, 0),
SerializationHeader.make(cfs.metadata, nonExpiredSSTables),
txn);
logger.trace("Switching writer, currentPartitionsToWrite = {}", currentPartitionsToWrite);
sstableWriter.switchWriter(writer);
}
示例8: switchCompactionLocation
import org.apache.cassandra.db.Directories; //导入方法依赖的package包/类
public void switchCompactionLocation(Directories.DataDirectory location)
{
@SuppressWarnings("resource")
SSTableWriter writer = SSTableWriter.create(Descriptor.fromFilename(cfs.getSSTablePath(getDirectories().getLocationForDisk(location))),
estimatedTotalKeys / estimatedSSTables,
minRepairedAt,
cfs.metadata,
new MetadataCollector(allSSTables, cfs.metadata.comparator, level),
SerializationHeader.make(cfs.metadata, nonExpiredSSTables),
txn);
sstableWriter.switchWriter(writer);
}
示例9: switchCompactionLocation
import org.apache.cassandra.db.Directories; //导入方法依赖的package包/类
public void switchCompactionLocation(Directories.DataDirectory directory)
{
File sstableDirectory = getDirectories().getLocationForDisk(directory);
@SuppressWarnings("resource")
SSTableWriter writer = SSTableWriter.create(Descriptor.fromFilename(cfs.getSSTablePath(sstableDirectory)),
averageEstimatedKeysPerSSTable,
minRepairedAt,
cfs.metadata,
new MetadataCollector(allSSTables, cfs.metadata.comparator, currentLevel),
SerializationHeader.make(cfs.metadata, nonExpiredSSTables),
txn);
sstableWriter.switchWriter(writer);
}
示例10: getWriteDirectory
import org.apache.cassandra.db.Directories; //导入方法依赖的package包/类
/**
* Return a directory where we can expect expectedWriteSize to fit.
*/
public Directories.DataDirectory getWriteDirectory(long expectedWriteSize)
{
Directories.DataDirectory directory = getDirectories().getWriteableLocation(expectedWriteSize);
if (directory == null)
throw new RuntimeException("Insufficient disk space to write " + expectedWriteSize + " bytes");
return directory;
}
示例11: switchCompactionLocation
import org.apache.cassandra.db.Directories; //导入方法依赖的package包/类
@Override
protected void switchCompactionLocation(Directories.DataDirectory directory)
{
@SuppressWarnings("resource")
SSTableWriter writer = SSTableWriter.create(Descriptor.fromFilename(cfs.getSSTablePath(getDirectories().getLocationForDisk(directory))),
estimatedTotalKeys,
minRepairedAt,
cfs.metadata,
new MetadataCollector(txn.originals(), cfs.metadata.comparator, 0),
SerializationHeader.make(cfs.metadata, nonExpiredSSTables),
txn);
sstableWriter.switchWriter(writer);
}
示例12: getWriteDirectory
import org.apache.cassandra.db.Directories; //导入方法依赖的package包/类
protected Directories.DataDirectory getWriteDirectory(long writeSize)
{
Directories.DataDirectory directory = getDirectories().getWriteableLocation(writeSize);
if (directory == null)
throw new FSWriteError(new IOException("Insufficient disk space to write " + writeSize + " bytes"), "");
return directory;
}
示例13: createWriter
import org.apache.cassandra.db.Directories; //导入方法依赖的package包/类
protected SSTableWriter createWriter(ColumnFamilyStore cfs, long totalSize, long repairedAt) throws IOException
{
Directories.DataDirectory localDir = cfs.directories.getWriteableLocation();
if (localDir == null)
throw new IOException("Insufficient disk space to store " + totalSize + " bytes");
desc = Descriptor.fromFilename(cfs.getTempSSTablePath(cfs.directories.getLocationForDisk(localDir)));
return new SSTableWriter(desc.filenameFor(Component.DATA), estimatedKeys, repairedAt);
}
示例14: runMayThrow
import org.apache.cassandra.db.Directories; //导入方法依赖的package包/类
/**
* Run this task after selecting the optimal disk for it
*/
protected void runMayThrow() throws Exception
{
long writeSize;
Directories.DataDirectory directory;
while (true)
{
writeSize = getExpectedWriteSize();
directory = getDirectories().getLocationCapableOfSize(writeSize);
if (directory != null || !reduceScopeForLimitedSpace())
break;
}
if (directory == null)
throw new RuntimeException("Insufficient disk space to write " + writeSize + " bytes");
directory.currentTasks.incrementAndGet();
directory.estimatedWorkingSize.addAndGet(writeSize);
try
{
runWith(getDirectories().getLocationForDisk(directory));
}
finally
{
directory.estimatedWorkingSize.addAndGet(-1 * writeSize);
directory.currentTasks.decrementAndGet();
}
}
示例15: createWriter
import org.apache.cassandra.db.Directories; //导入方法依赖的package包/类
protected SSTableWriter createWriter(ColumnFamilyStore cfs, long totalSize, long repairedAt) throws IOException
{
Directories.DataDirectory localDir = cfs.directories.getCompactionLocation();
if (localDir == null)
throw new IOException("Insufficient disk space to store " + totalSize + " bytes");
desc = Descriptor.fromFilename(cfs.getTempSSTablePath(cfs.directories.getLocationForDisk(localDir)));
return new SSTableWriter(desc.filenameFor(Component.DATA), estimatedKeys, repairedAt);
}