Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cloud_storage: serde_fields for several structs #23116

Merged
merged 5 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/v/cloud_storage/lifecycle_marker.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ struct remote_nt_lifecycle_marker

lifecycle_status status;

auto serde_fields() { return std::tie(cluster_id, topic, status); }

cloud_storage_clients::object_key
get_key(const remote_path_provider& path_provider) {
return cloud_storage_clients::object_key{
Expand Down
23 changes: 23 additions & 0 deletions src/v/cloud_storage/partition_manifest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2523,6 +2523,29 @@ struct partition_manifest_serde
std::optional<model::offset> _last_scrubbed_offset;
model::producer_id _highest_producer_id;
model::offset _applied_offset;

auto serde_fields() {
return std::tie(
_ntp,
_rev,
_segments_serialized,
_replaced,
_last_offset,
_start_offset,
_last_uploaded_compacted_offset,
_insync_offset,
_cloud_log_size_bytes,
_archive_start_offset,
_archive_start_offset_delta,
_archive_clean_offset,
_start_kafka_offset,
archive_size_bytes,
_spillover_manifests_serialized,
_last_partition_scrub,
_last_scrubbed_offset,
_highest_producer_id,
_applied_offset);
}
};

static_assert(
Expand Down
11 changes: 11 additions & 0 deletions src/v/cloud_storage/partition_manifest.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,17 @@ class partition_manifest : public base_manifest {

segment_name_format sname_format{segment_name_format::v1};

auto serde_fields() {
return std::tie(
ntp_revision,
base_offset,
committed_offset,
archiver_term,
segment_term,
size_bytes,
sname_format);
}

auto operator<=>(const lw_segment_meta&) const = default;

static lw_segment_meta convert(const segment_meta& m);
Expand Down
22 changes: 22 additions & 0 deletions src/v/cloud_storage/remote_segment_index.cc
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,28 @@ struct offset_index_header
int64_t last_time{model::timestamp::missing().value()};
std::vector<int64_t> time_write_buf;
iobuf time_index;

auto serde_fields() {
return std::tie(
min_file_pos_step,
num_elements,
base_rp,
last_rp,
base_kaf,
last_kaf,
base_file,
last_file,
rp_write_buf,
kaf_write_buf,
file_write_buf,
rp_index,
kaf_index,
file_index,
base_time,
last_time,
time_write_buf,
time_index);
}
};

iobuf offset_index::to_iobuf() {
Expand Down
28 changes: 28 additions & 0 deletions src/v/cloud_storage/tests/partition_manifest_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1537,6 +1537,8 @@ struct metadata_stm_segment
cloud_storage::segment_name name;
cloud_storage::partition_manifest::segment_meta meta;

auto serde_fields() { return std::tie(name, meta); }

bool operator==(const metadata_stm_segment&) const = default;
};

Expand All @@ -1554,6 +1556,17 @@ struct segment_meta_v0 {
model::timestamp max_timestamp;
model::offset delta_offset;

auto serde_fields() {
return std::tie(
is_compacted,
size_bytes,
base_offset,
committed_offset,
base_timestamp,
max_timestamp,
delta_offset);
}

auto operator<=>(const segment_meta_v0&) const = default;
};
struct segment_meta_v1 {
Expand All @@ -1572,6 +1585,19 @@ struct segment_meta_v1 {
model::initial_revision_id ntp_revision;
model::term_id archiver_term;

auto serde_fields() {
return std::tie(
is_compacted,
size_bytes,
base_offset,
committed_offset,
base_timestamp,
max_timestamp,
delta_offset,
ntp_revision,
archiver_term);
}

auto operator<=>(const segment_meta_v1&) const = default;
};

Expand All @@ -1584,6 +1610,8 @@ struct metadata_stm_segment
cloud_storage::segment_name name;
segment_meta_t meta;

auto serde_fields() { return std::tie(name, meta); }

bool operator==(const metadata_stm_segment&) const = default;
};

Expand Down