Files
scylladb/full_position.hh
Botond Dénes e0cf7cec27 introduce full_position
A simple struct containing a full position, including a partition key
and a position in partition. Two variants are introduced: an owning
version and a view. This is to replace all the ad-hoc structures
introduced for the same purpose: std::pair() and std::tuple() of
partition key and clustering key, and other similar small structs
scattered around the code.
This patch does not replace any of the above mentioned construcs with
the new full_position, it merely introduces it to enable incremental
standardization.
2022-06-23 13:36:24 +03:00

41 lines
1.2 KiB
C++

/*
* Copyright (C) 2022-present ScyllaDB
*/
/*
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
#pragma once
#include "keys.hh"
#include "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);
}
};
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) { }