当前位置: 首页>>代码示例>>Java>>正文


Java FileUtils.renameWithConfirm方法代码示例

本文整理汇总了Java中org.apache.cassandra.io.util.FileUtils.renameWithConfirm方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtils.renameWithConfirm方法的具体用法?Java FileUtils.renameWithConfirm怎么用?Java FileUtils.renameWithConfirm使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.cassandra.io.util.FileUtils的用法示例。


在下文中一共展示了FileUtils.renameWithConfirm方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: rewriteSSTableMetadata

import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
private void rewriteSSTableMetadata(Descriptor descriptor, Map<MetadataType, MetadataComponent> currentComponents) throws IOException
{
    String filePath = descriptor.tmpFilenameFor(Component.STATS);
    try (DataOutputStreamPlus out = new BufferedDataOutputStreamPlus(new FileOutputStream(filePath)))
    {
        serialize(currentComponents, out, descriptor.version);
        out.flush();
    }
    // we cant move a file on top of another file in windows:
    if (FBUtilities.isWindows)
        FileUtils.delete(descriptor.filenameFor(Component.STATS));
    FileUtils.renameWithConfirm(filePath, descriptor.filenameFor(Component.STATS));

}
 
开发者ID:Netflix,项目名称:sstable-adaptor,代码行数:15,代码来源:MetadataSerializer.java

示例2: handleHistoryFiles

import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
private static File handleHistoryFiles()
{
    File outputDir = FBUtilities.getToolsOutputDirectory();
    File historyFile = new File(outputDir, HISTORYFILE);
    File oldHistoryFile = new File(System.getProperty("user.home"), OLD_HISTORYFILE);
    if(oldHistoryFile.exists())
        FileUtils.renameWithConfirm(oldHistoryFile, historyFile);

    return historyFile;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:11,代码来源:CliMain.java

示例3: CfAssumptions

import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
public CfAssumptions()
{
    assumptions = new HashMap<String, Map<String, Map<String, String>>>();
    assumptionsChanged = false;
    assumptionDirectory = FBUtilities.getToolsOutputDirectory();

    File oldAssumptionDir = new File(System.getProperty("user.home") + File.separator + ".cassandra-cli");
    if (oldAssumptionDir.exists())
    {
        File oldAssumptionFile = new File(oldAssumptionDir, ASSUMPTIONS_FILENAME);
        if (oldAssumptionFile.exists())
            FileUtils.renameWithConfirm(oldAssumptionFile, new File(assumptionDirectory, ASSUMPTIONS_FILENAME));
        FileUtils.deleteRecursive(oldAssumptionDir);
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:16,代码来源:CliClient.java

示例4: rewriteSSTableMetadata

import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
private void rewriteSSTableMetadata(Descriptor descriptor, Map<MetadataType, MetadataComponent> currentComponents) throws IOException
{
    Descriptor tmpDescriptor = descriptor.asType(Descriptor.Type.TEMP);

    try (DataOutputStreamAndChannel out = new DataOutputStreamAndChannel(new FileOutputStream(tmpDescriptor.filenameFor(Component.STATS))))
    {
        serialize(currentComponents, out);
        out.flush();
    }
    // we cant move a file on top of another file in windows:
    if (FBUtilities.isWindows())
        FileUtils.delete(descriptor.filenameFor(Component.STATS));
    FileUtils.renameWithConfirm(tmpDescriptor.filenameFor(Component.STATS), descriptor.filenameFor(Component.STATS));

}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:16,代码来源:MetadataSerializer.java

示例5: completeSSTable

import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
private void completeSSTable(PerSSTableIndexWriter indexWriter, SSTableReader sstable, Collection<ColumnIndex> indexes)
{
    indexWriter.complete();

    for (ColumnIndex index : indexes)
    {
        File tmpIndex = new File(index.getPath(indexWriter.getDescriptor()));
        if (!tmpIndex.exists()) // no data was inserted into the index for given sstable
            continue;

        FileUtils.renameWithConfirm(tmpIndex, new File(index.getPath(sstable.descriptor)));
        index.update(Collections.<SSTableReader>emptyList(), Collections.singletonList(sstable));
    }
}
 
开发者ID:xedin,项目名称:sasi,代码行数:15,代码来源:SSTableAttachedSecondaryIndex.java

示例6: rewriteSSTableMetadata

import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
private void rewriteSSTableMetadata(Descriptor descriptor, Map<MetadataType, MetadataComponent> currentComponents) throws IOException
{
    String filePath = descriptor.tmpFilenameFor(Component.STATS);
    try (DataOutputStreamPlus out = new BufferedDataOutputStreamPlus(new FileOutputStream(filePath)))
    {
        serialize(currentComponents, out, descriptor.version);
        out.flush();
    }
    // we cant move a file on top of another file in windows:
    if (FBUtilities.isWindows())
        FileUtils.delete(descriptor.filenameFor(Component.STATS));
    FileUtils.renameWithConfirm(filePath, descriptor.filenameFor(Component.STATS));

}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:15,代码来源:MetadataSerializer.java

示例7: rename

import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
public static void rename(Descriptor tmpdesc, Descriptor newdesc, Set<Component> components)
{
    for (Component component : Sets.difference(components, Sets.newHashSet(Component.DATA, Component.SUMMARY)))
    {
        FileUtils.renameWithConfirm(tmpdesc.filenameFor(component), newdesc.filenameFor(component));
    }

    // do -Data last because -Data present should mean the sstable was completely renamed before crash
    FileUtils.renameWithConfirm(tmpdesc.filenameFor(Component.DATA), newdesc.filenameFor(Component.DATA));

    // rename it without confirmation because summary can be available for loadNewSSTables but not for closeAndOpenReader
    FileUtils.renameWithOutConfirm(tmpdesc.filenameFor(Component.SUMMARY), newdesc.filenameFor(Component.SUMMARY));
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:14,代码来源:SSTableWriter.java

示例8: mutateLevel

import org.apache.cassandra.io.util.FileUtils; //导入方法依赖的package包/类
/**
 * Scary method mutating existing sstable component
 *
 * Tries to do it safely by moving the new file on top of the old one
 *
 * Caller needs to reload the sstable metadata (sstableReader.reloadSSTableMetadata())
 *
 * @see org.apache.cassandra.io.sstable.SSTableReader#reloadSSTableMetadata()
 *
 * @param oldMetadata
 * @param descriptor
 * @param filename
 * @param level
 * @throws IOException
 */
public static synchronized void mutateLevel(Pair<SSTableMetadata, Set<Integer>> oldMetadata, Descriptor descriptor, String filename, int level) throws IOException
{
    logger.debug("Mutating {} to level {}", descriptor.filenameFor(Component.STATS), level);
    SSTableMetadata metadata = SSTableMetadata.copyWithNewSSTableLevel(oldMetadata.left, level);
    DataOutputStream out = new DataOutputStream(new FileOutputStream(filename + "-tmp"));
    SSTableMetadata.serializer.legacySerialize(metadata, oldMetadata.right, descriptor, out);
    out.flush();
    out.close();
    FileUtils.renameWithConfirm(filename + "-tmp", filename);
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:26,代码来源:LeveledManifest.java


注:本文中的org.apache.cassandra.io.util.FileUtils.renameWithConfirm方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。