org.apache.cassandra.io.util.FileUtils.truncate()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(2.1k)|赞(0)|评价(0)|浏览(123)

本文整理了Java中org.apache.cassandra.io.util.FileUtils.truncate()方法的一些代码示例,展示了FileUtils.truncate()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.truncate()方法的具体详情如下:
包路径:org.apache.cassandra.io.util.FileUtils
类名称:FileUtils
方法名:truncate

FileUtils.truncate介绍

暂无

代码示例

代码示例来源:origin: com.facebook.presto.cassandra/cassandra-server

/**
 * Closes the index and bloomfilter, making the public state of this writer valid for consumption.
 */
public void close()
{
  if (components.contains(Component.FILTER))
  {
    String path = descriptor.filenameFor(Component.FILTER);
    try
    {
      // bloom filter
      FileOutputStream fos = new FileOutputStream(path);
      DataOutputStreamPlus stream = new DataOutputStreamPlus(new BufferedOutputStream(fos));
      FilterFactory.serialize(bf, stream);
      stream.flush();
      fos.getFD().sync();
      stream.close();
    }
    catch (IOException e)
    {
      throw new FSWriteError(e, path);
    }
  }
  // index
  long position = indexFile.getFilePointer();
  indexFile.close(); // calls force
  FileUtils.truncate(indexFile.getPath(), position);
}

代码示例来源:origin: org.apache.cassandra/cassandra-all

protected void doPrepare()
{
  flushBf();
  // truncate index file
  long position = indexFile.position();
  indexFile.prepareToCommit();
  FileUtils.truncate(indexFile.getPath(), position);
  // save summary
  summary.prepareToCommit();
  try (IndexSummary indexSummary = summary.build(getPartitioner()))
  {
    SSTableReader.saveSummary(descriptor, first, last, indexSummary);
  }
}

代码示例来源:origin: jsevellec/cassandra-unit

protected void doPrepare()
{
  flushBf();
  // truncate index file
  long position = indexFile.position();
  indexFile.prepareToCommit();
  FileUtils.truncate(indexFile.getPath(), position);
  // save summary
  summary.prepareToCommit();
  try (IndexSummary indexSummary = summary.build(getPartitioner()))
  {
    SSTableReader.saveSummary(descriptor, first, last, indexSummary);
  }
}

代码示例来源:origin: com.strapdata.cassandra/cassandra-all

protected void doPrepare()
{
  flushBf();
  // truncate index file
  long position = indexFile.position();
  indexFile.prepareToCommit();
  FileUtils.truncate(indexFile.getPath(), position);
  // save summary
  summary.prepareToCommit();
  try (IndexSummary indexSummary = summary.build(getPartitioner()))
  {
    SSTableReader.saveSummary(descriptor, first, last, indexSummary);
  }
}

相关文章