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


Java CompressionParameters类代码示例

本文整理汇总了Java中org.apache.cassandra.io.compress.CompressionParameters的典型用法代码示例。如果您正苦于以下问题:Java CompressionParameters类的具体用法?Java CompressionParameters怎么用?Java CompressionParameters使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CompressionParameters类属于org.apache.cassandra.io.compress包,在下文中一共展示了CompressionParameters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: CreateTableStatement

import org.apache.cassandra.io.compress.CompressionParameters; //导入依赖的package包/类
public CreateTableStatement(CFName name, CFPropDefs properties, boolean ifNotExists, Set<ColumnIdentifier> staticColumns)
{
    super(name);
    this.properties = properties;
    this.ifNotExists = ifNotExists;
    this.staticColumns = staticColumns;

    try
    {
        if (!this.properties.hasProperty(CFPropDefs.KW_COMPRESSION) && CFMetaData.DEFAULT_COMPRESSOR != null)
            this.properties.addProperty(CFPropDefs.KW_COMPRESSION,
                                        new HashMap<String, String>()
                                        {{
                                            put(CompressionParameters.SSTABLE_COMPRESSION, CFMetaData.DEFAULT_COMPRESSOR);
                                        }});
    }
    catch (SyntaxException e)
    {
        throw new AssertionError(e);
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:22,代码来源:CreateTableStatement.java

示例2: CreateTableStatement

import org.apache.cassandra.io.compress.CompressionParameters; //导入依赖的package包/类
public CreateTableStatement(CFName name, CFPropDefs properties, boolean ifNotExists)
{
    super(name);
    this.properties = properties;
    this.ifNotExists = ifNotExists;

    try
    {
        if (!this.properties.hasProperty(CFPropDefs.KW_COMPRESSION) && CFMetaData.DEFAULT_COMPRESSOR != null)
            this.properties.addProperty(CFPropDefs.KW_COMPRESSION,
                                        new HashMap<String, String>()
                                        {{
                                            put(CompressionParameters.SSTABLE_COMPRESSION, CFMetaData.DEFAULT_COMPRESSOR);
                                        }});
    }
    catch (SyntaxException e)
    {
        throw new AssertionError(e);
    }
}
 
开发者ID:pgaref,项目名称:ACaZoo,代码行数:21,代码来源:CreateTableStatement.java

示例3: applyToCFMetadata

import org.apache.cassandra.io.compress.CompressionParameters; //导入依赖的package包/类
public void applyToCFMetadata(CFMetaData cfm) throws ConfigurationException, SyntaxException
{
    if (hasProperty(KW_COMMENT))
        cfm.comment(getString(KW_COMMENT, ""));

    cfm.readRepairChance(getDouble(KW_READREPAIRCHANCE, cfm.getReadRepairChance()));
    cfm.dcLocalReadRepairChance(getDouble(KW_DCLOCALREADREPAIRCHANCE, cfm.getDcLocalReadRepair()));
    cfm.gcGraceSeconds(getInt(KW_GCGRACESECONDS, cfm.getGcGraceSeconds()));
    cfm.replicateOnWrite(getBoolean(KW_REPLICATEONWRITE, cfm.getReplicateOnWrite()));
    cfm.minCompactionThreshold(toInt(KW_MINCOMPACTIONTHRESHOLD, getCompactionOptions().get(KW_MINCOMPACTIONTHRESHOLD), cfm.getMinCompactionThreshold()));
    cfm.maxCompactionThreshold(toInt(KW_MAXCOMPACTIONTHRESHOLD, getCompactionOptions().get(KW_MAXCOMPACTIONTHRESHOLD), cfm.getMaxCompactionThreshold()));
    cfm.caching(CFMetaData.Caching.fromString(getString(KW_CACHING, cfm.getCaching().toString())));
    cfm.populateIoCacheOnFlush(getBoolean(KW_POPULATE_IO_CACHE_ON_FLUSH, cfm.populateIoCacheOnFlush()));

    if (compactionStrategyClass != null)
    {
        cfm.compactionStrategyClass(compactionStrategyClass);
        cfm.compactionStrategyOptions(new HashMap<String, String>(getCompactionOptions()));
    }

    cfm.bloomFilterFpChance(getDouble(KW_BF_FP_CHANCE, cfm.getBloomFilterFpChance()));

    if (!getCompressionOptions().isEmpty())
        cfm.compressionParameters(CompressionParameters.create(getCompressionOptions()));
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:26,代码来源:CFPropDefs.java

示例4: CreateColumnFamilyStatement

import org.apache.cassandra.io.compress.CompressionParameters; //导入依赖的package包/类
public CreateColumnFamilyStatement(CFName name, CFPropDefs properties)
{
    super(name);
    this.properties = properties;

    try
    {
        if (!this.properties.hasProperty(CFPropDefs.KW_COMPRESSION) && CFMetaData.DEFAULT_COMPRESSOR != null)
            this.properties.addProperty(CFPropDefs.KW_COMPRESSION,
                                        new HashMap<String, String>()
                                        {{
                                            put(CompressionParameters.SSTABLE_COMPRESSION, CFMetaData.DEFAULT_COMPRESSOR);
                                        }});
    }
    catch (SyntaxException e)
    {
        throw new AssertionError(e);
    }
}
 
开发者ID:dprguiuc,项目名称:Cassandra-Wasef,代码行数:20,代码来源:CreateColumnFamilyStatement.java

示例5: writeHeader

import org.apache.cassandra.io.compress.CompressionParameters; //导入依赖的package包/类
public void writeHeader(CompressionParameters parameters) {
    try {
        writeUTF(parameters.sstableCompressor.getClass().getSimpleName());
        writeInt(parameters.otherOptions.size());
        for (Map.Entry<String, String> entry : parameters.otherOptions.entrySet()) {
            writeUTF(entry.getKey());
            writeUTF(entry.getValue());
        }

        // store the length of the chunk
        writeInt(parameters.chunkLength());
        // store position and reserve a place for uncompressed data length and chunks count
        dataLengthOffset = getFilePointer();
        writeLong(-1);
        writeInt(-1);
    } catch (IOException e) {
        throw new FSWriteError(e, filePath);
    }
}
 
开发者ID:fullcontact,项目名称:hadoop-sstable,代码行数:20,代码来源:CompressionMetadata.java

示例6: applyToCFMetadata

import org.apache.cassandra.io.compress.CompressionParameters; //导入依赖的package包/类
public void applyToCFMetadata(CFMetaData cfm) throws ConfigurationException, SyntaxException
{
    if (hasProperty(KW_COMMENT))
        cfm.comment(getString(KW_COMMENT, ""));

    cfm.readRepairChance(getDouble(KW_READREPAIRCHANCE, cfm.getReadRepairChance()));
    cfm.dcLocalReadRepairChance(getDouble(KW_DCLOCALREADREPAIRCHANCE, cfm.getDcLocalReadRepair()));
    cfm.gcGraceSeconds(getInt(KW_GCGRACESECONDS, cfm.getGcGraceSeconds()));
    int minCompactionThreshold = toInt(KW_MINCOMPACTIONTHRESHOLD, getCompactionOptions().get(KW_MINCOMPACTIONTHRESHOLD), cfm.getMinCompactionThreshold());
    int maxCompactionThreshold = toInt(KW_MAXCOMPACTIONTHRESHOLD, getCompactionOptions().get(KW_MAXCOMPACTIONTHRESHOLD), cfm.getMaxCompactionThreshold());
    if (minCompactionThreshold <= 0 || maxCompactionThreshold <= 0)
        throw new ConfigurationException("Disabling compaction by setting compaction thresholds to 0 has been deprecated, set the compaction option 'enabled' to false instead.");
    cfm.minCompactionThreshold(minCompactionThreshold);
    cfm.maxCompactionThreshold(maxCompactionThreshold);
    cfm.defaultTimeToLive(getInt(KW_DEFAULT_TIME_TO_LIVE, cfm.getDefaultTimeToLive()));
    cfm.speculativeRetry(CFMetaData.SpeculativeRetry.fromString(getString(KW_SPECULATIVE_RETRY, cfm.getSpeculativeRetry().toString())));
    cfm.memtableFlushPeriod(getInt(KW_MEMTABLE_FLUSH_PERIOD, cfm.getMemtableFlushPeriod()));
    cfm.minIndexInterval(getInt(KW_MIN_INDEX_INTERVAL, cfm.getMinIndexInterval()));
    cfm.maxIndexInterval(getInt(KW_MAX_INDEX_INTERVAL, cfm.getMaxIndexInterval()));

    if (compactionStrategyClass != null)
    {
        cfm.compactionStrategyClass(compactionStrategyClass);
        cfm.compactionStrategyOptions(new HashMap<>(getCompactionOptions()));
    }

    cfm.bloomFilterFpChance(getDouble(KW_BF_FP_CHANCE, cfm.getBloomFilterFpChance()));

    if (!getCompressionOptions().isEmpty())
        cfm.compressionParameters(CompressionParameters.create(getCompressionOptions()));
    CachingOptions cachingOptions = getCachingOptions();
    if (cachingOptions != null)
        cfm.caching(cachingOptions);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:35,代码来源:CFPropDefs.java

示例7: getOutputCompressionParamaters

import org.apache.cassandra.io.compress.CompressionParameters; //导入依赖的package包/类
public static CompressionParameters getOutputCompressionParamaters(Configuration conf)
{
    if (getOutputCompressionClass(conf) == null)
        return new CompressionParameters(null);

    Map<String, String> options = new HashMap<String, String>();
    options.put(CompressionParameters.SSTABLE_COMPRESSION, getOutputCompressionClass(conf));
    options.put(CompressionParameters.CHUNK_LENGTH_KB, getOutputCompressionChunkLength(conf));

    try {
        return CompressionParameters.create(options);
    } catch (ConfigurationException e) {
        throw new RuntimeException(e);
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:16,代码来源:ConfigHelper.java

示例8: setCompressionParameters

import org.apache.cassandra.io.compress.CompressionParameters; //导入依赖的package包/类
public void setCompressionParameters(Map<String,String> opts)
{
    try
    {
        metadata.compressionParameters = CompressionParameters.create(opts);
    }
    catch (ConfigurationException e)
    {
        throw new IllegalArgumentException(e.getMessage());
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:12,代码来源:ColumnFamilyStore.java

示例9: applyImplicitDefaults

import org.apache.cassandra.io.compress.CompressionParameters; //导入依赖的package包/类
/** applies implicit defaults to cf definition. useful in updates */
private static void applyImplicitDefaults(org.apache.cassandra.thrift.CfDef cf_def)
{
    if (!cf_def.isSetComment())
        cf_def.setComment("");
    if (!cf_def.isSetMin_compaction_threshold())
        cf_def.setMin_compaction_threshold(CFMetaData.DEFAULT_MIN_COMPACTION_THRESHOLD);
    if (!cf_def.isSetMax_compaction_threshold())
        cf_def.setMax_compaction_threshold(CFMetaData.DEFAULT_MAX_COMPACTION_THRESHOLD);
    if (cf_def.compaction_strategy == null)
        cf_def.compaction_strategy = DEFAULT_COMPACTION_STRATEGY_CLASS.getSimpleName();
    if (cf_def.compaction_strategy_options == null)
        cf_def.compaction_strategy_options = Collections.emptyMap();
    if (!cf_def.isSetCompression_options())
    {
        cf_def.setCompression_options(new HashMap<String, String>()
        {{
            if (DEFAULT_COMPRESSOR != null)
                put(CompressionParameters.SSTABLE_COMPRESSION, DEFAULT_COMPRESSOR);
        }});
    }
    if (!cf_def.isSetDefault_time_to_live())
        cf_def.setDefault_time_to_live(CFMetaData.DEFAULT_DEFAULT_TIME_TO_LIVE);
    if (!cf_def.isSetDclocal_read_repair_chance())
        cf_def.setDclocal_read_repair_chance(CFMetaData.DEFAULT_DCLOCAL_READ_REPAIR_CHANCE);

    // if index_interval was set, use that for the min_index_interval default
    if (!cf_def.isSetMin_index_interval())
    {
        if (cf_def.isSetIndex_interval())
            cf_def.setMin_index_interval(cf_def.getIndex_interval());
        else
            cf_def.setMin_index_interval(CFMetaData.DEFAULT_MIN_INDEX_INTERVAL);
    }
    if (!cf_def.isSetMax_index_interval())
    {
        // ensure the max is at least as large as the min
        cf_def.setMax_index_interval(Math.max(cf_def.min_index_interval, CFMetaData.DEFAULT_MAX_INDEX_INTERVAL));
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:41,代码来源:CFMetaData.java

示例10: serialize

import org.apache.cassandra.io.compress.CompressionParameters; //导入依赖的package包/类
public void serialize(CompressionInfo info, DataOutputPlus out, int version) throws IOException
{
    if (info == null)
    {
        out.writeInt(-1);
        return;
    }

    int chunkCount = info.chunks.length;
    out.writeInt(chunkCount);
    for (int i = 0; i < chunkCount; i++)
        CompressionMetadata.Chunk.serializer.serialize(info.chunks[i], out, version);
    // compression params
    CompressionParameters.serializer.serialize(info.parameters, out, version);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:16,代码来源:CompressionInfo.java

示例11: deserialize

import org.apache.cassandra.io.compress.CompressionParameters; //导入依赖的package包/类
public CompressionInfo deserialize(DataInput in, int version) throws IOException
{
    // chunks
    int chunkCount = in.readInt();
    if (chunkCount < 0)
        return null;

    CompressionMetadata.Chunk[] chunks = new CompressionMetadata.Chunk[chunkCount];
    for (int i = 0; i < chunkCount; i++)
        chunks[i] = CompressionMetadata.Chunk.serializer.deserialize(in, version);

    // compression params
    CompressionParameters parameters = CompressionParameters.serializer.deserialize(in, version);
    return new CompressionInfo(chunks, parameters);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:16,代码来源:CompressionInfo.java

示例12: serializedSize

import org.apache.cassandra.io.compress.CompressionParameters; //导入依赖的package包/类
public long serializedSize(CompressionInfo info, int version)
{
    if (info == null)
        return TypeSizes.NATIVE.sizeof(-1);

    // chunks
    int chunkCount = info.chunks.length;
    long size = TypeSizes.NATIVE.sizeof(chunkCount);
    for (int i = 0; i < chunkCount; i++)
        size += CompressionMetadata.Chunk.serializer.serializedSize(info.chunks[i], version);
    // compression params
    size += CompressionParameters.serializer.serializedSize(info.parameters, version);
    return size;
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:15,代码来源:CompressionInfo.java

示例13: SSTableSimpleUnsortedWriter

import org.apache.cassandra.io.compress.CompressionParameters; //导入依赖的package包/类
public SSTableSimpleUnsortedWriter(File directory,
                                   IPartitioner partitioner,
                                   String keyspace,
                                   String columnFamily,
                                   AbstractType<?> comparator,
                                   AbstractType<?> subComparator,
                                   int bufferSizeInMB)
{
    this(directory, partitioner, keyspace, columnFamily, comparator, subComparator, bufferSizeInMB, new CompressionParameters(null));
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:11,代码来源:SSTableSimpleUnsortedWriter.java

示例14: open

import org.apache.cassandra.io.compress.CompressionParameters; //导入依赖的package包/类
public static CompressedSequentialWriter open(String dataFilePath,
                                              String offsetsPath,
                                              CompressionParameters parameters,
                                              MetadataCollector sstableMetadataCollector)
{
    return new CompressedSequentialWriter(new File(dataFilePath), offsetsPath, parameters, sstableMetadataCollector);
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:8,代码来源:SequentialWriter.java

示例15: useCompression

import org.apache.cassandra.io.compress.CompressionParameters; //导入依赖的package包/类
private static void useCompression(List<KSMetaData> schema)
{
    for (KSMetaData ksm : schema)
    {
        for (CFMetaData cfm : ksm.cfMetaData().values())
        {
            cfm.compressionParameters(new CompressionParameters(SnappyCompressor.instance));
        }
    }
}
 
开发者ID:vcostet,项目名称:cassandra-kmean,代码行数:11,代码来源:SchemaLoader.java


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