As requested in #22102, #22103 and #22105 moved the files and fixed other includes and build system. Moved files: - clustering_bounds_comparator.hh - keys.cc - keys.hh - clustering_interval_set.hh - clustering_key_filter.hh - clustering_ranges_walker.hh - compound_compat.hh - compound.hh - full_position.hh Fixes: #22102 Fixes: #22103 Fixes: #22105 Closes scylladb/scylladb#25082
55 lines
1.3 KiB
C++
55 lines
1.3 KiB
C++
/*
|
|
* Copyright (C) 2020-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: LicenseRef-ScyllaDB-Source-Available-1.0
|
|
*/
|
|
|
|
#include "cdc_partitioner.hh"
|
|
#include "dht/token.hh"
|
|
#include "schema/schema.hh"
|
|
#include "sstables/key.hh"
|
|
#include "utils/class_registrator.hh"
|
|
#include "cdc/generation.hh"
|
|
#include "keys/keys.hh"
|
|
|
|
namespace cdc {
|
|
|
|
const sstring cdc_partitioner::classname = "com.scylladb.dht.CDCPartitioner";
|
|
|
|
const sstring cdc_partitioner::name() const {
|
|
return classname;
|
|
}
|
|
|
|
static dht::token to_token(int64_t value) {
|
|
return dht::token(value);
|
|
}
|
|
|
|
static dht::token to_token(bytes_view key) {
|
|
// Key should be 16 B long, of which first 8 B are used for token calculation
|
|
if (key.size() != 2*sizeof(int64_t)) {
|
|
return dht::minimum_token();
|
|
}
|
|
return to_token(stream_id::token_from_bytes(key));
|
|
}
|
|
|
|
dht::token
|
|
cdc_partitioner::get_token(const sstables::key_view& key) const {
|
|
return key.with_linearized([&] (bytes_view v) {
|
|
return to_token(v);
|
|
});
|
|
}
|
|
|
|
dht::token
|
|
cdc_partitioner::get_token(const schema& s, partition_key_view key) const {
|
|
auto exploded_key = key.explode(s);
|
|
return to_token(exploded_key[0]);
|
|
}
|
|
|
|
using registry = class_registrator<dht::i_partitioner, cdc_partitioner>;
|
|
static registry registrator(cdc::cdc_partitioner::classname);
|
|
static registry registrator_short_name("CDCPartitioner");
|
|
|
|
}
|