Skip to content

Commit

Permalink
cloud_storage: ostream operator for segmenta_meta
Browse files Browse the repository at this point in the history
This is helpful for debugging issues with segment selection on the fetch
path.
  • Loading branch information
andrwng committed Jan 9, 2023
1 parent 5071b72 commit 0161370
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/v/cloud_storage/types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,28 @@

namespace cloud_storage {

std::ostream& operator<<(std::ostream& o, const segment_meta& s) {
fmt::print(
o,
"{{is_compacted: {}, size_bytes: {}, base_offset: {}, committed_offset: "
"{}, base_timestamp: {}, max_timestamp: {}, delta_offset: {}, "
"ntp_revision: {}, archiver_term: {}, segment_term: {}, "
"delta_offset_end: {}, sname_format: {}}}",
s.is_compacted,
s.size_bytes,
s.base_offset,
s.committed_offset,
s.base_timestamp,
s.max_timestamp,
s.delta_offset,
s.ntp_revision,
s.archiver_term,
s.segment_term,
s.delta_offset_end,
s.sname_format);
return o;
}

std::ostream& operator<<(std::ostream& o, const segment_name_format& r) {
switch (r) {
case segment_name_format::v1:
Expand Down
1 change: 1 addition & 0 deletions src/v/cloud_storage/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,5 +167,6 @@ struct segment_meta {

auto operator<=>(const segment_meta&) const = default;
};
std::ostream& operator<<(std::ostream& o, const segment_meta& r);

} // namespace cloud_storage

0 comments on commit 0161370

Please sign in to comment.