本文整理汇总了Java中org.apache.cassandra.io.compress.ICompressor类的典型用法代码示例。如果您正苦于以下问题:Java ICompressor类的具体用法?Java ICompressor怎么用?Java ICompressor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ICompressor类属于org.apache.cassandra.io.compress包,在下文中一共展示了ICompressor类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: upgradeInput
import org.apache.cassandra.io.compress.ICompressor; //导入依赖的package包/类
@SuppressWarnings("resource")
public static final CompressedChecksummedDataInput upgradeInput(ChecksummedDataInput input, ICompressor compressor)
{
long position = input.getPosition();
input.close();
Builder builder = new Builder(new ChannelProxy(input.getPath()));
builder.withPosition(position);
builder.withCompressor(compressor);
return builder.build();
}
示例2: compressionParametersToThrift
import org.apache.cassandra.io.compress.ICompressor; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public static Map<String, String> compressionParametersToThrift(CompressionParams parameters)
{
if (!parameters.isEnabled())
return Collections.emptyMap();
Map<String, String> options = new HashMap<>(parameters.getOtherOptions());
Class<? extends ICompressor> klass = parameters.getSstableCompressor().getClass();
options.put(CompressionParams.SSTABLE_COMPRESSION, klass.getName());
options.put(CompressionParams.CHUNK_LENGTH_KB, parameters.chunkLengthInKB());
return options;
}
示例3: params
import org.apache.cassandra.io.compress.ICompressor; //导入依赖的package包/类
private ImmutableMap<String, Object> params(Class<? extends ICompressor> compressorClass)
{
ImmutableMap<String, Object> compressionParams = ImmutableMap.<String, Object>builder()
.put(ParameterizedClass.CLASS_NAME, compressorClass.getSimpleName())
.build();
return ImmutableMap.<String, Object>builder()
.put(HintsDescriptor.COMPRESSION, compressionParams)
.build();
}
示例4: withCompressor
import org.apache.cassandra.io.compress.ICompressor; //导入依赖的package包/类
public Builder withCompressor(ICompressor compressor)
{
this.compressor = compressor;
bufferType = compressor.preferredBufferType();
return this;
}
示例5: createCompressor
import org.apache.cassandra.io.compress.ICompressor; //导入依赖的package包/类
public ICompressor createCompressor()
{
return isCompressed() ? CompressionParams.createCompressor(compressionConfig) : null;
}
示例6: getCompressor
import org.apache.cassandra.io.compress.ICompressor; //导入依赖的package包/类
/**
* Returns the compressor used to compress the segments.
* @return the compressor used to compress the segments
*/
public ICompressor getCompressor()
{
return compressor;
}
示例7: multiFlushAndDeserializeTest
import org.apache.cassandra.io.compress.ICompressor; //导入依赖的package包/类
public void multiFlushAndDeserializeTest(Class<? extends ICompressor> compressorClass) throws Exception
{
int hintNum = 0;
int bufferSize = HintsWriteExecutor.WRITE_BUFFER_SIZE;
List<Hint> hints = new LinkedList<>();
UUID hostId = UUIDGen.getTimeUUID();
long ts = System.currentTimeMillis();
HintsDescriptor descriptor = new HintsDescriptor(hostId, ts, params(compressorClass));
File dir = Files.createTempDir();
try (HintsWriter writer = HintsWriter.create(dir, descriptor))
{
assert writer instanceof CompressedHintsWriter;
ByteBuffer writeBuffer = ByteBuffer.allocateDirect(bufferSize);
try (HintsWriter.Session session = writer.newSession(writeBuffer))
{
while (session.getBytesWritten() < bufferSize * 3)
{
Hint hint = createHint(hintNum, ts+hintNum);
session.append(hint);
hints.add(hint);
hintNum++;
}
}
}
try (HintsReader reader = HintsReader.open(new File(dir, descriptor.fileName())))
{
List<Hint> deserialized = new ArrayList<>(hintNum);
for (HintsReader.Page page: reader)
{
Iterator<Hint> iterator = page.hintsIterator();
while (iterator.hasNext())
{
deserialized.add(iterator.next());
}
}
Assert.assertEquals(hints.size(), deserialized.size());
hintNum = 0;
for (Hint expected: hints)
{
HintsTestUtil.assertHintsEqual(expected, deserialized.get(hintNum));
hintNum++;
}
}
}
示例8: compressor
import org.apache.cassandra.io.compress.ICompressor; //导入依赖的package包/类
public ICompressor compressor() {
return parameters.sstableCompressor;
}