Search in sources :

Example 1 with TokenRangeIterator

use of org.apache.cassandra.stress.generate.TokenRangeIterator in project cassandra by apache.

the class SettingsCommandUser method getFactory.

public OpDistributionFactory getFactory(final StressSettings settings) {
    final SeedManager seeds = new SeedManager(settings);
    final TokenRangeIterator tokenRangeIterator = profile.tokenRangeQueries.isEmpty() ? null : new TokenRangeIterator(settings, profile.maybeLoadTokenRanges(settings));
    return new SampledOpDistributionFactory<String>(ratios, clustering) {

        protected List<? extends Operation> get(Timer timer, PartitionGenerator generator, String key, boolean isWarmup) {
            if (key.equalsIgnoreCase("insert"))
                return Collections.singletonList(profile.getInsert(timer, generator, seeds, settings));
            if (key.equalsIgnoreCase("validate"))
                return profile.getValidate(timer, generator, seeds, settings);
            if (profile.tokenRangeQueries.containsKey(key))
                return Collections.singletonList(profile.getBulkReadQueries(key, timer, settings, tokenRangeIterator, isWarmup));
            return Collections.singletonList(profile.getQuery(key, timer, generator, seeds, settings, isWarmup));
        }

        protected PartitionGenerator newGenerator() {
            return profile.newGenerator(settings);
        }
    };
}
Also used : Timer(org.apache.cassandra.stress.report.Timer) PartitionGenerator(org.apache.cassandra.stress.generate.PartitionGenerator) TokenRangeIterator(org.apache.cassandra.stress.generate.TokenRangeIterator) SeedManager(org.apache.cassandra.stress.generate.SeedManager) SampledOpDistributionFactory(org.apache.cassandra.stress.operations.SampledOpDistributionFactory)

Aggregations

PartitionGenerator (org.apache.cassandra.stress.generate.PartitionGenerator)1 SeedManager (org.apache.cassandra.stress.generate.SeedManager)1 TokenRangeIterator (org.apache.cassandra.stress.generate.TokenRangeIterator)1 SampledOpDistributionFactory (org.apache.cassandra.stress.operations.SampledOpDistributionFactory)1 Timer (org.apache.cassandra.stress.report.Timer)1