use of org.apache.cassandra.stress.generate.values.Generator in project cassandra by apache.
the class PartitionIterator method setSeed.
void setSeed(Seed seed) {
long idseed = 0;
for (int i = 0; i < partitionKey.length; i++) {
Generator generator = this.generator.partitionKey.get(i);
// set the partition key seed based on the current work item we're processing
generator.setSeed(seed.seed);
Object key = generator.generate();
partitionKey[i] = key;
// then contribute this value to the data seed
idseed = seed(key, generator.type, idseed);
}
this.seed = seed;
this.idseed = idseed;
}
use of org.apache.cassandra.stress.generate.values.Generator 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);
}
Aggregations