sstables/bti_index: improve signatures of special member functions in index writers
Just a bit of constructor boilerplate: noexcept, move constructors, `bool` operators for `optimized_optional`.
This commit is contained in:
@@ -55,7 +55,7 @@ class bti_partition_index_writer {
|
||||
std::unique_ptr<impl> _impl;
|
||||
private:
|
||||
friend class optimized_optional<bti_partition_index_writer>;
|
||||
bti_partition_index_writer();
|
||||
bti_partition_index_writer() noexcept;
|
||||
public:
|
||||
// The trie will be written to the given file writer.
|
||||
// Note: the file doesn't have to be empty,
|
||||
@@ -63,7 +63,10 @@ public:
|
||||
// because `finish()` writes a footer which is used by the reader
|
||||
// to find the root of the trie.
|
||||
explicit bti_partition_index_writer(sstables::file_writer&);
|
||||
~bti_partition_index_writer();
|
||||
bti_partition_index_writer(bti_partition_index_writer&&) noexcept;
|
||||
bti_partition_index_writer& operator=(bti_partition_index_writer&&) noexcept;
|
||||
~bti_partition_index_writer() noexcept;
|
||||
explicit operator bool() const noexcept { return bool(_impl); }
|
||||
// Add a new partition key to the index.
|
||||
void add(const schema&, dht::decorated_key, int64_t data_or_rowsdb_file_pos);
|
||||
// Flushes all remaining contents, and returns the position of the root node in the output stream.
|
||||
@@ -90,13 +93,16 @@ class bti_row_index_writer {
|
||||
std::unique_ptr<impl> _impl;
|
||||
private:
|
||||
friend class optimized_optional<bti_row_index_writer>;
|
||||
bti_row_index_writer();
|
||||
bti_row_index_writer() noexcept;
|
||||
public:
|
||||
~bti_row_index_writer();
|
||||
~bti_row_index_writer() noexcept;
|
||||
// The trie will be written to the given file writer.
|
||||
// Note: the file doesn't have to be empty,
|
||||
// and it can be extended later.
|
||||
explicit bti_row_index_writer(sstables::file_writer&);
|
||||
bti_row_index_writer(bti_row_index_writer&&) noexcept;
|
||||
bti_row_index_writer& operator=(bti_row_index_writer&&) noexcept;
|
||||
explicit operator bool() const noexcept { return bool(_impl); }
|
||||
// Add a new row index entry.
|
||||
// Must be called in ascending order.
|
||||
// (`first_ck` must be strictly greater than the previous `last_ck`).
|
||||
|
||||
@@ -210,9 +210,9 @@ struct bti_partition_index_writer::impl
|
||||
impl(impl&&) = delete;
|
||||
};
|
||||
|
||||
bti_partition_index_writer::bti_partition_index_writer() = default;
|
||||
bti_partition_index_writer::bti_partition_index_writer() noexcept = default;
|
||||
|
||||
bti_partition_index_writer::~bti_partition_index_writer() = default;
|
||||
bti_partition_index_writer::~bti_partition_index_writer() noexcept = default;
|
||||
|
||||
bti_partition_index_writer::bti_partition_index_writer(sstables::file_writer& fw)
|
||||
: _impl(std::make_unique<impl>(fw))
|
||||
@@ -223,6 +223,8 @@ void bti_partition_index_writer::add(const schema& s, dht::decorated_key dk, int
|
||||
void bti_partition_index_writer::finish(sstable_version_types ver, disk_string_view<uint16_t> first_key, disk_string_view<uint16_t> last_key) && {
|
||||
_impl->finish(ver, first_key, last_key);
|
||||
}
|
||||
bti_partition_index_writer::bti_partition_index_writer(bti_partition_index_writer&&) noexcept = default;
|
||||
bti_partition_index_writer& bti_partition_index_writer::operator=(bti_partition_index_writer&&) noexcept = default;
|
||||
|
||||
std::byte hash_byte_from_key(const schema &s, const partition_key& x) {
|
||||
auto hk = utils::make_hashed_key(static_cast<bytes_view>(key::from_partition_key(s, x)));
|
||||
|
||||
@@ -359,13 +359,15 @@ struct bti_row_index_writer::impl
|
||||
impl(impl&&) = delete;
|
||||
};
|
||||
|
||||
bti_row_index_writer::bti_row_index_writer() = default;
|
||||
bti_row_index_writer::bti_row_index_writer() noexcept = default;
|
||||
|
||||
bti_row_index_writer::~bti_row_index_writer() = default;
|
||||
bti_row_index_writer::~bti_row_index_writer() noexcept = default;
|
||||
|
||||
bti_row_index_writer::bti_row_index_writer(sstables::file_writer& fw)
|
||||
: _impl(std::make_unique<impl>(fw))
|
||||
{}
|
||||
bti_row_index_writer::bti_row_index_writer(bti_row_index_writer&&) noexcept = default;
|
||||
bti_row_index_writer& bti_row_index_writer::operator=(bti_row_index_writer&&) noexcept = default;
|
||||
|
||||
int64_t bti_row_index_writer::finish(
|
||||
sstable_version_types version,
|
||||
|
||||
Reference in New Issue
Block a user