Search in sources :

Example 1 with Bytes

use of org.apache.cassandra.stress.generate.values.Bytes in project cassandra by apache.

the class SettingsCommandPreDefined method newGenerator.

PartitionGenerator newGenerator(StressSettings settings) {
    List<String> names = settings.columns.namestrs;
    List<Generator> partitionKey = Collections.<Generator>singletonList(new HexBytes("key", new GeneratorConfig("randomstrkey", null, OptionDistribution.get("fixed(" + keySize + ")"), null)));
    List<Generator> columns = new ArrayList<>();
    for (int i = 0; i < settings.columns.maxColumnsPerKey; i++) columns.add(new Bytes(names.get(i), new GeneratorConfig("randomstr" + names.get(i), null, settings.columns.sizeDistribution, null)));
    return new PartitionGenerator(partitionKey, Collections.<Generator>emptyList(), columns, PartitionGenerator.Order.ARBITRARY);
}
Also used : HexBytes(org.apache.cassandra.stress.generate.values.HexBytes) Bytes(org.apache.cassandra.stress.generate.values.Bytes) PartitionGenerator(org.apache.cassandra.stress.generate.PartitionGenerator) ArrayList(java.util.ArrayList) HexBytes(org.apache.cassandra.stress.generate.values.HexBytes) GeneratorConfig(org.apache.cassandra.stress.generate.values.GeneratorConfig) PartitionGenerator(org.apache.cassandra.stress.generate.PartitionGenerator) Generator(org.apache.cassandra.stress.generate.values.Generator)

Aggregations

ArrayList (java.util.ArrayList)1 PartitionGenerator (org.apache.cassandra.stress.generate.PartitionGenerator)1 Bytes (org.apache.cassandra.stress.generate.values.Bytes)1 Generator (org.apache.cassandra.stress.generate.values.Generator)1 GeneratorConfig (org.apache.cassandra.stress.generate.values.GeneratorConfig)1 HexBytes (org.apache.cassandra.stress.generate.values.HexBytes)1