mirror of
https://github.com/scylladb/scylladb.git
synced 2026-05-29 11:10:40 +00:00
mutation/atomic_cell: drop unused type param from from_bytes()
The abstract_type parameter was needed by the old IMR-based atomic-cell serialization format. When we reverted to the simpler managed_bytes representation, the parameter became a no-op but was never removed. Drop it from all overloads of atomic_cell_view::from_bytes() and atomic_cell_mutable_view::from_bytes() and update all call sites. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -140,8 +140,8 @@ bool atomic_cell_or_collection::equals(const abstract_type& type, const atomic_c
|
||||
}
|
||||
|
||||
if (type.is_atomic()) {
|
||||
auto a = atomic_cell_view::from_bytes(type, _data);
|
||||
auto b = atomic_cell_view::from_bytes(type, other._data);
|
||||
auto a = atomic_cell_view::from_bytes(_data);
|
||||
auto b = atomic_cell_view::from_bytes(other._data);
|
||||
if (a.timestamp() != b.timestamp()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -297,10 +297,10 @@ class atomic_cell_view final : public basic_atomic_cell_view<mutable_view::no> {
|
||||
: basic_atomic_cell_view<mutable_view::no>(view) {}
|
||||
friend class atomic_cell;
|
||||
public:
|
||||
static atomic_cell_view from_bytes(const abstract_type& t, managed_bytes_view v) {
|
||||
static atomic_cell_view from_bytes(managed_bytes_view v) {
|
||||
return atomic_cell_view(v);
|
||||
}
|
||||
static atomic_cell_view from_bytes(const abstract_type& t, bytes_view v) {
|
||||
static atomic_cell_view from_bytes(bytes_view v) {
|
||||
return atomic_cell_view(managed_bytes_view(v));
|
||||
}
|
||||
|
||||
@@ -325,7 +325,7 @@ class atomic_cell_mutable_view final : public basic_atomic_cell_view<mutable_vie
|
||||
atomic_cell_mutable_view(managed_bytes_mutable_view data)
|
||||
: basic_atomic_cell_view(data) {}
|
||||
public:
|
||||
static atomic_cell_mutable_view from_bytes(const abstract_type& t, managed_bytes_mutable_view v) {
|
||||
static atomic_cell_mutable_view from_bytes(managed_bytes_mutable_view v) {
|
||||
return atomic_cell_mutable_view(v);
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ public:
|
||||
atomic_cell_or_collection(atomic_cell ac) : _data(std::move(ac._data)) {}
|
||||
atomic_cell_or_collection(const abstract_type& at, atomic_cell_view acv);
|
||||
static atomic_cell_or_collection from_atomic_cell(atomic_cell data) { return { std::move(data._data) }; }
|
||||
atomic_cell_view as_atomic_cell(const column_definition& cdef) const { return atomic_cell_view::from_bytes(*cdef.type, _data); }
|
||||
atomic_cell_mutable_view as_mutable_atomic_cell(const column_definition& cdef) { return atomic_cell_mutable_view::from_bytes(*cdef.type, _data); }
|
||||
atomic_cell_view as_atomic_cell(const column_definition& cdef) const { return atomic_cell_view::from_bytes(_data); }
|
||||
atomic_cell_mutable_view as_mutable_atomic_cell(const column_definition& cdef) { return atomic_cell_mutable_view::from_bytes(_data); }
|
||||
atomic_cell_or_collection(collection_mutation cm) : _data(std::move(cm._data)) { }
|
||||
atomic_cell_or_collection copy(const abstract_type&) const;
|
||||
explicit operator bool() const {
|
||||
|
||||
@@ -68,7 +68,7 @@ bool collection_mutation_view::is_any_live(const abstract_type& type, tombstone
|
||||
auto key_size = in.read_trivial<uint32_t>();
|
||||
in.read_fragmented(key_size); // Skip
|
||||
auto vsize = in.read_trivial<uint32_t>();
|
||||
auto value = atomic_cell_view::from_bytes(type, in.read_fragmented(vsize));
|
||||
auto value = atomic_cell_view::from_bytes(in.read_fragmented(vsize));
|
||||
if (value.is_live(tomb, now, false)) {
|
||||
return true;
|
||||
}
|
||||
@@ -91,7 +91,7 @@ api::timestamp_type collection_mutation_view::last_update(const abstract_type& t
|
||||
const auto key_size = in.read_trivial<uint32_t>();
|
||||
in.read_fragmented(key_size); // Skip
|
||||
auto vsize = in.read_trivial<uint32_t>();
|
||||
auto value = atomic_cell_view::from_bytes(type, in.read_fragmented(vsize));
|
||||
auto value = atomic_cell_view::from_bytes(in.read_fragmented(vsize));
|
||||
max = std::max(value.timestamp(), max);
|
||||
}
|
||||
|
||||
@@ -503,22 +503,22 @@ deserialize_collection_mutation(const abstract_type& type, collection_mutation_i
|
||||
return visit(type, make_visitor(
|
||||
[&] (const collection_type_impl& ctype) {
|
||||
// value_comparator(), ugh
|
||||
return deserialize_collection_mutation(in, [&ctype] (collection_mutation_input_stream& in) {
|
||||
return deserialize_collection_mutation(in, [] (collection_mutation_input_stream& in) {
|
||||
// FIXME: we could probably avoid the need for size
|
||||
auto ksize = in.read_trivial<uint32_t>();
|
||||
auto key = in.read_linearized(ksize);
|
||||
auto vsize = in.read_trivial<uint32_t>();
|
||||
auto value = atomic_cell_view::from_bytes(*ctype.value_comparator(), in.read_fragmented(vsize));
|
||||
auto value = atomic_cell_view::from_bytes(in.read_fragmented(vsize));
|
||||
return std::make_pair(key, value);
|
||||
});
|
||||
},
|
||||
[&] (const user_type_impl& utype) {
|
||||
return deserialize_collection_mutation(in, [&utype] (collection_mutation_input_stream& in) {
|
||||
return deserialize_collection_mutation(in, [] (collection_mutation_input_stream& in) {
|
||||
// FIXME: we could probably avoid the need for size
|
||||
auto ksize = in.read_trivial<uint32_t>();
|
||||
auto key = in.read_linearized(ksize);
|
||||
auto vsize = in.read_trivial<uint32_t>();
|
||||
auto value = atomic_cell_view::from_bytes(*utype.type(deserialize_field_index(key)), in.read_fragmented(vsize));
|
||||
auto value = atomic_cell_view::from_bytes(in.read_fragmented(vsize));
|
||||
return std::make_pair(key, value);
|
||||
});
|
||||
},
|
||||
|
||||
@@ -629,7 +629,7 @@ struct counter_shards_value {
|
||||
int counter_shards_value_tostring_l(lua_State* l) {
|
||||
auto& csv = pop_userdata_as_ref<counter_shards_value>(l, 1);
|
||||
lua_pop(l, 1);
|
||||
auto cv = counter_cell_view(atomic_cell_view::from_bytes(*csv.type, csv.data));
|
||||
auto cv = counter_cell_view(atomic_cell_view::from_bytes(csv.data));
|
||||
lua::push_sstring(l, format("{}", cv.total_value()));
|
||||
return 1;
|
||||
}
|
||||
@@ -638,7 +638,7 @@ int counter_shards_value_index_l(lua_State* l) {
|
||||
auto field = lua_tostring(l, 2);
|
||||
auto& csv = pop_userdata_as_ref<counter_shards_value>(l, 1);
|
||||
lua_pop(l, 2);
|
||||
auto cv = counter_cell_view(atomic_cell_view::from_bytes(*csv.type, csv.data));
|
||||
auto cv = counter_cell_view(atomic_cell_view::from_bytes(csv.data));
|
||||
if (strcmp(field, "value") == 0) {
|
||||
lua::push_data_value(l, data_value(cv.total_value()));
|
||||
} else if (strcmp(field, "shards") == 0) {
|
||||
|
||||
Reference in New Issue
Block a user