Move mutation-related files to a new mutation/ directory. The names are kept in the global namespace to reduce churn; the names are unambiguous in any case. mutation_reader remains in the readers/ module. mutation_partition_v2.cc was missing from CMakeLists.txt; it's added in this patch. This is a step forward towards librarization or modularization of the source base. Closes #12788
50 lines
1.6 KiB
C++
50 lines
1.6 KiB
C++
/*
|
|
* Copyright (C) 2022-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "keys.hh"
|
|
#include "mutation/position_in_partition.hh"
|
|
|
|
struct full_position;
|
|
|
|
struct full_position_view {
|
|
const partition_key_view partition;
|
|
const position_in_partition_view position;
|
|
|
|
full_position_view(const full_position&);
|
|
full_position_view(const partition_key&, const position_in_partition_view);
|
|
};
|
|
|
|
struct full_position {
|
|
partition_key partition;
|
|
position_in_partition position;
|
|
|
|
full_position(full_position_view);
|
|
full_position(partition_key, position_in_partition);
|
|
|
|
operator full_position_view() {
|
|
return full_position_view(partition, position);
|
|
}
|
|
|
|
static std::strong_ordering cmp(const schema& s, const full_position& a, const full_position& b) {
|
|
partition_key::tri_compare pk_cmp(s);
|
|
if (auto res = pk_cmp(a.partition, b.partition); res != 0) {
|
|
return res;
|
|
}
|
|
position_in_partition::tri_compare pos_cmp(s);
|
|
return pos_cmp(a.position, b.position);
|
|
}
|
|
};
|
|
|
|
inline full_position_view::full_position_view(const full_position& fp) : partition(fp.partition), position(fp.position) { }
|
|
inline full_position_view::full_position_view(const partition_key& pk, const position_in_partition_view pos) : partition(pk), position(pos) { }
|
|
|
|
inline full_position::full_position(full_position_view fpv) : partition(fpv.partition), position(fpv.position) { }
|
|
inline full_position::full_position(partition_key pk, position_in_partition pos) : partition(std::move(pk)), position(pos) { }
|