本文整理汇总了Java中org.apache.cassandra.io.util.FileUtils.createDirectory方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtils.createDirectory方法的具体用法?Java FileUtils.createDirectory怎么用?Java FileUtils.createDirectory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.io.util.FileUtils
的用法示例。
在下文中一共展示了FileUtils.createDirectory方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Directories
import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
private Directories(String keyspacename, String cfname, String directoryName)
{
this.keyspacename = keyspacename;
this.cfname = cfname;
this.sstableDirectories = new File[dataFileLocations.length];
for (int i = 0; i < dataFileLocations.length; ++i)
sstableDirectories[i] = new File(dataFileLocations[i].location, join(keyspacename, directoryName));
if (!StorageService.instance.isClientMode())
{
for (File dir : sstableDirectories)
{
try
{
FileUtils.createDirectory(dir);
}
catch (FSError e)
{
// don't just let the default exception handler do this, we need the create loop to continue
logger.error("Failed to create {} directory", dir);
FileUtils.handleFSError(e);
}
}
}
}
示例2: createWriter
import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
public static SSTableWriter createWriter(ColumnFamilyStore cfs,
File compactionFileLocation,
long expectedBloomFilterSize,
long repairedAt,
SSTableReader sstable,
LifecycleTransaction txn)
{
FileUtils.createDirectory(compactionFileLocation);
SerializationHeader header = sstable.header;
if (header == null)
header = SerializationHeader.make(sstable.metadata, Collections.singleton(sstable));
return SSTableWriter.create(cfs.metadata,
Descriptor.fromFilename(cfs.getSSTablePath(compactionFileLocation)),
expectedBloomFilterSize,
repairedAt,
sstable.getSSTableLevel(),
header,
txn);
}
示例3: setUpClass
import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
/**
* Starts embedded Cassandra server.
*
* @throws Exception
* if an error occurs
*/
@Override
public void setUpClass() throws Exception {
super.setUpClass();
log.info("Starting embedded Cassandra Server...");
try {
cleanupDirectoriesFailover();
FileUtils.createDirectory(baseDirectory);
System.setProperty("log4j.configuration", "log4j-server.properties");
System.setProperty("cassandra.config", "cassandra.yaml");
cassandraDaemon = new CassandraDaemon();
cassandraDaemon.init(null);
cassandraThread = new Thread(new Runnable() {
public void run() {
try {
cassandraDaemon.start();
} catch (Exception e) {
log.error("Embedded casandra server run failed!", e);
}
}
});
cassandraThread.setDaemon(true);
cassandraThread.start();
} catch (Exception e) {
log.error("Embedded casandra server start failed!", e);
// cleanup
tearDownClass();
}
}
示例4: createWriter
import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
public static SSTableWriter createWriter(ColumnFamilyStore cfs,
File compactionFileLocation,
int expectedBloomFilterSize,
long repairedAt,
SSTableReader sstable)
{
FileUtils.createDirectory(compactionFileLocation);
return new SSTableWriter(cfs.getTempSSTablePath(compactionFileLocation),
expectedBloomFilterSize,
repairedAt,
cfs.metadata,
cfs.partitioner,
new MetadataCollector(Collections.singleton(sstable), cfs.metadata.comparator, sstable.getSSTableLevel()));
}
示例5: createWriter
import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
public static SSTableWriter createWriter(ColumnFamilyStore cfs,
File compactionFileLocation,
int expectedBloomFilterSize,
SSTableReader sstable)
{
FileUtils.createDirectory(compactionFileLocation);
return new SSTableWriter(cfs.getTempSSTablePath(compactionFileLocation),
expectedBloomFilterSize,
cfs.metadata,
cfs.partitioner,
SSTableMetadata.createCollector(Collections.singleton(sstable), cfs.metadata.comparator, sstable.getSSTableLevel()));
}
示例6: createWriterForAntiCompaction
import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
public static SSTableWriter createWriterForAntiCompaction(ColumnFamilyStore cfs,
File compactionFileLocation,
int expectedBloomFilterSize,
long repairedAt,
Collection<SSTableReader> sstables,
LifecycleTransaction txn)
{
FileUtils.createDirectory(compactionFileLocation);
int minLevel = Integer.MAX_VALUE;
// if all sstables have the same level, we can compact them together without creating overlap during anticompaction
// note that we only anticompact from unrepaired sstables, which is not leveled, but we still keep original level
// after first migration to be able to drop the sstables back in their original place in the repaired sstable manifest
for (SSTableReader sstable : sstables)
{
if (minLevel == Integer.MAX_VALUE)
minLevel = sstable.getSSTableLevel();
if (minLevel != sstable.getSSTableLevel())
{
minLevel = 0;
break;
}
}
return SSTableWriter.create(Descriptor.fromFilename(cfs.getSSTablePath(compactionFileLocation)),
(long) expectedBloomFilterSize,
repairedAt,
cfs.metadata,
new MetadataCollector(sstables, cfs.metadata.comparator, minLevel),
SerializationHeader.make(cfs.metadata, sstables),
txn);
}
示例7: getToolsOutputDirectory
import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
public static File getToolsOutputDirectory()
{
File historyDir = new File(System.getProperty("user.home"), ".cassandra");
FileUtils.createDirectory(historyDir);
return historyDir;
}
示例8: Directories
import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
/**
* Create Directories of given ColumnFamily.
* SSTable directories are created under data_directories defined in cassandra.yaml if not exist at this time.
*
* @param metadata metadata of ColumnFamily
*/
public Directories(CFMetaData metadata)
{
this.metadata = metadata;
if (StorageService.instance.isClientMode())
{
dataPaths = null;
return;
}
String cfId = ByteBufferUtil.bytesToHex(ByteBufferUtil.bytes(metadata.cfId));
int idx = metadata.cfName.indexOf(SECONDARY_INDEX_NAME_SEPARATOR);
// secondary indicies go in the same directory as the base cf
String directoryName = idx > 0 ? metadata.cfName.substring(0, idx) + "-" + cfId : metadata.cfName + "-" + cfId;
this.dataPaths = new File[dataDirectories.length];
// If upgraded from version less than 2.1, use existing directories
for (int i = 0; i < dataDirectories.length; ++i)
{
// check if old SSTable directory exists
dataPaths[i] = new File(dataDirectories[i].location,
join(metadata.ksName,
idx > 0 ? metadata.cfName.substring(0, idx) : metadata.cfName));
}
boolean olderDirectoryExists = Iterables.any(Arrays.asList(dataPaths), new Predicate<File>()
{
public boolean apply(File file)
{
return file.exists();
}
});
if (!olderDirectoryExists)
{
// use 2.1-style path names
for (int i = 0; i < dataDirectories.length; ++i)
dataPaths[i] = new File(dataDirectories[i].location, join(metadata.ksName, directoryName));
}
for (File dir : dataPaths)
{
try
{
FileUtils.createDirectory(dir);
}
catch (FSError e)
{
// don't just let the default exception handler do this, we need the create loop to continue
logger.error("Failed to create {} directory", dir);
FileUtils.handleFSError(e);
}
}
}