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


Java ICompressor类代码示例

本文整理汇总了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();
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:12,代码来源:CompressedChecksummedDataInput.java

示例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;
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:13,代码来源:ThriftConversion.java

示例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();
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:10,代码来源:HintsCompressionTest.java

示例4: withCompressor

import org.apache.cassandra.io.compress.ICompressor; //导入依赖的package包/类
public Builder withCompressor(ICompressor compressor)
{
    this.compressor = compressor;
    bufferType = compressor.preferredBufferType();
    return this;
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:7,代码来源:CompressedChecksummedDataInput.java

示例5: createCompressor

import org.apache.cassandra.io.compress.ICompressor; //导入依赖的package包/类
public ICompressor createCompressor()
{
    return isCompressed() ? CompressionParams.createCompressor(compressionConfig) : null;
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:5,代码来源:HintsDescriptor.java

示例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;
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:9,代码来源:CommitLog.java

示例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++;
        }
    }
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:51,代码来源:HintsCompressionTest.java

示例8: compressor

import org.apache.cassandra.io.compress.ICompressor; //导入依赖的package包/类
public ICompressor compressor() {
    return parameters.sstableCompressor;
}
 
开发者ID:fullcontact,项目名称:hadoop-sstable,代码行数:4,代码来源:CompressionMetadata.java


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