Skip to content

Commit

Permalink
c/types: fixed to string operators for some transactional types
Browse files Browse the repository at this point in the history
Some of the operators were incorrectly declared while all of them were
lacking definition

Signed-off-by: Michal Maslanka <michal@redpanda.com>
  • Loading branch information
mmaslankaprv committed Nov 3, 2023
1 parent ddb4225 commit acaba16
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
33 changes: 33 additions & 0 deletions src/v/cluster/types.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1177,6 +1177,39 @@ operator<<(std::ostream& o, const update_partition_replicas_cmd_data& data) {
return o;
}

std::ostream& operator<<(std::ostream& o, const fetch_tx_reply& r) {
fmt::print(
o,
"{{ec: {}, pid: {}, last_pid: {}, tx_seq: {}, timeout_ms: {}, status: "
"{}, partitions: {}, groups: {}}}",
r.ec,
r.pid,
r.last_pid,
r.tx_seq,
r.timeout_ms.count(),
r.status,
r.partitions,
r.groups);
return o;
}

std::ostream& operator<<(std::ostream& o, const fetch_tx_reply::tx_group& g) {
fmt::print(o, "{{etag: {}, group_id: {}}}", g.etag, g.group_id);
return o;
}

std::ostream&
operator<<(std::ostream& o, const fetch_tx_reply::tx_partition& p) {
fmt::print(
o,
"{{etag: {}, ntp: {}, revision: {}}}",
p.etag,
p.ntp,
p.topic_revision);

return o;
}

} // namespace cluster

namespace reflection {
Expand Down
2 changes: 1 addition & 1 deletion src/v/cluster/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ struct fetch_tx_reply

friend bool operator==(const tx_group&, const tx_group&) = default;

friend std::ostream& operator<<(std::ostream& o, const tx_partition& r);
friend std::ostream& operator<<(std::ostream& o, const tx_group& r);

auto serde_fields() { return std::tie(group_id, etag); }
};
Expand Down

0 comments on commit acaba16

Please sign in to comment.