mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-23 18:10:39 +00:00
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
83 lines
2.4 KiB
C++
83 lines
2.4 KiB
C++
/*
|
|
* Copyright (C) 2015-present ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
// Not part of atomic_cell.hh to avoid cyclic dependency between types.hh and atomic_cell.hh
|
|
|
|
#include "types.hh"
|
|
#include "types/collection.hh"
|
|
#include "atomic_cell.hh"
|
|
#include "atomic_cell_or_collection.hh"
|
|
#include "hashing.hh"
|
|
#include "counters.hh"
|
|
|
|
template<>
|
|
struct appending_hash<collection_mutation_view> {
|
|
template<typename Hasher>
|
|
void operator()(Hasher& h, collection_mutation_view cell, const column_definition& cdef) const {
|
|
cell.with_deserialized(*cdef.type, [&] (collection_mutation_view_description m_view) {
|
|
::feed_hash(h, m_view.tomb);
|
|
for (auto&& key_and_value : m_view.cells) {
|
|
::feed_hash(h, key_and_value.first);
|
|
::feed_hash(h, key_and_value.second, cdef);
|
|
}
|
|
});
|
|
}
|
|
};
|
|
|
|
template<>
|
|
struct appending_hash<atomic_cell_view> {
|
|
template<typename Hasher>
|
|
void operator()(Hasher& h, atomic_cell_view cell, const column_definition& cdef) const {
|
|
feed_hash(h, cell.is_live());
|
|
feed_hash(h, cell.timestamp());
|
|
if (cell.is_live()) {
|
|
if (cdef.is_counter()) {
|
|
::feed_hash(h, counter_cell_view(cell));
|
|
return;
|
|
}
|
|
if (cell.is_live_and_has_ttl()) {
|
|
feed_hash(h, cell.expiry());
|
|
feed_hash(h, cell.ttl());
|
|
}
|
|
feed_hash(h, cell.value());
|
|
} else {
|
|
feed_hash(h, cell.deletion_time());
|
|
}
|
|
}
|
|
};
|
|
|
|
template<>
|
|
struct appending_hash<atomic_cell> {
|
|
template<typename Hasher>
|
|
void operator()(Hasher& h, const atomic_cell& cell, const column_definition& cdef) const {
|
|
feed_hash(h, static_cast<atomic_cell_view>(cell), cdef);
|
|
}
|
|
};
|
|
|
|
template<>
|
|
struct appending_hash<collection_mutation> {
|
|
template<typename Hasher>
|
|
void operator()(Hasher& h, const collection_mutation& cm, const column_definition& cdef) const {
|
|
feed_hash(h, static_cast<collection_mutation_view>(cm), cdef);
|
|
}
|
|
};
|
|
|
|
template<>
|
|
struct appending_hash<atomic_cell_or_collection> {
|
|
template<typename Hasher>
|
|
void operator()(Hasher& h, const atomic_cell_or_collection& c, const column_definition& cdef) const {
|
|
if (cdef.is_atomic()) {
|
|
feed_hash(h, c.as_atomic_cell(cdef), cdef);
|
|
} else {
|
|
feed_hash(h, c.as_collection_mutation(), cdef);
|
|
}
|
|
}
|
|
};
|