本文整理汇总了Java中org.apache.cassandra.io.util.FileDataInput.getPath方法的典型用法代码示例。如果您正苦于以下问题:Java FileDataInput.getPath方法的具体用法?Java FileDataInput.getPath怎么用?Java FileDataInput.getPath使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cassandra.io.util.FileDataInput
的用法示例。
在下文中一共展示了FileDataInput.getPath方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: create
import org.apache.cassandra.io.util.FileDataInput; //导入方法依赖的package包/类
public static SSTableIdentityIterator create(SSTableReader sstable, FileDataInput dfile, RowIndexEntry<?> indexEntry, DecoratedKey key, boolean tombstoneOnly)
{
try
{
dfile.seek(indexEntry.position);
ByteBufferUtil.skipShortLength(dfile); // Skip partition key
DeletionTime partitionLevelDeletion = DeletionTime.serializer.deserialize(dfile);
SerializationHelper helper = new SerializationHelper(sstable.metadata, sstable.descriptor.version.correspondingMessagingVersion(), SerializationHelper.Flag.LOCAL);
SSTableSimpleIterator iterator = tombstoneOnly
? SSTableSimpleIterator.createTombstoneOnly(sstable.metadata, dfile, sstable.header, helper, partitionLevelDeletion)
: SSTableSimpleIterator.create(sstable.metadata, dfile, sstable.header, helper, partitionLevelDeletion);
return new SSTableIdentityIterator(sstable, key, partitionLevelDeletion, dfile.getPath(), iterator);
}
catch (IOException e)
{
sstable.markSuspect();
throw new CorruptSSTableException(e, dfile.getPath());
}
}
示例2: firstKeyBeyond
import org.apache.cassandra.io.util.FileDataInput; //导入方法依赖的package包/类
/**
* Finds and returns the first key beyond a given token in this SSTable or null if no such key exists.
*/
public DecoratedKey firstKeyBeyond(RowPosition token)
{
if (token.compareTo(first) < 0)
return first;
long sampledPosition = getIndexScanPosition(token);
Iterator<FileDataInput> segments = ifile.iterator(sampledPosition);
while (segments.hasNext())
{
FileDataInput in = segments.next();
try
{
while (!in.isEOF())
{
ByteBuffer indexKey = ByteBufferUtil.readWithShortLength(in);
DecoratedKey indexDecoratedKey = partitioner.decorateKey(indexKey);
if (indexDecoratedKey.compareTo(token) > 0)
return indexDecoratedKey;
RowIndexEntry.Serializer.skip(in);
}
}
catch (IOException e)
{
markSuspect();
throw new CorruptSSTableException(e, in.getPath());
}
finally
{
FileUtils.closeQuietly(in);
}
}
return null;
}
示例3: firstKeyBeyond
import org.apache.cassandra.io.util.FileDataInput; //导入方法依赖的package包/类
/**
* Finds and returns the first key beyond a given token in this SSTable or null if no such key exists.
*/
public DecoratedKey firstKeyBeyond(RowPosition token)
{
long sampledPosition = getIndexScanPosition(token);
if (sampledPosition == -1)
sampledPosition = 0;
Iterator<FileDataInput> segments = ifile.iterator(sampledPosition);
while (segments.hasNext())
{
FileDataInput in = segments.next();
try
{
while (!in.isEOF())
{
ByteBuffer indexKey = ByteBufferUtil.readWithShortLength(in);
DecoratedKey indexDecoratedKey = partitioner.decorateKey(indexKey);
if (indexDecoratedKey.compareTo(token) > 0)
return indexDecoratedKey;
RowIndexEntry.Serializer.skip(in);
}
}
catch (IOException e)
{
markSuspect();
throw new CorruptSSTableException(e, in.getPath());
}
finally
{
FileUtils.closeQuietly(in);
}
}
return null;
}
示例4: validateSummarySamplingLevel
import org.apache.cassandra.io.util.FileDataInput; //导入方法依赖的package包/类
/**
* Validates that an index summary has full sampling, as expected when the serialization format does not support
* persisting the sampling level.
* @return true if the summary has full sampling, false otherwise
*/
private boolean validateSummarySamplingLevel()
{
// We need to check index summary entries against the index to verify that none of them were dropped due to
// downsampling. Downsampling can drop any of the first BASE_SAMPLING_LEVEL entries (repeating that drop pattern
// for the remainder of the summary). Unfortunately, the first entry to be dropped is the entry at
// index (BASE_SAMPLING_LEVEL - 1), so we need to check a full set of BASE_SAMPLING_LEVEL entries.
Iterator<FileDataInput> segments = ifile.iterator(0);
int i = 0;
int summaryEntriesChecked = 0;
int expectedIndexInterval = getMinIndexInterval();
while (segments.hasNext())
{
FileDataInput in = segments.next();
try
{
while (!in.isEOF())
{
ByteBuffer indexKey = ByteBufferUtil.readWithShortLength(in);
if (i % expectedIndexInterval == 0)
{
ByteBuffer summaryKey = ByteBuffer.wrap(indexSummary.getKey(i / expectedIndexInterval));
if (!summaryKey.equals(indexKey))
return false;
summaryEntriesChecked++;
if (summaryEntriesChecked == Downsampling.BASE_SAMPLING_LEVEL)
return true;
}
RowIndexEntry.Serializer.skip(in);
i++;
}
}
catch (IOException e)
{
markSuspect();
throw new CorruptSSTableException(e, in.getPath());
}
finally
{
FileUtils.closeQuietly(in);
}
}
return true;
}