From e3664580a7eb23542ce68b2b19c0204243948284 Mon Sep 17 00:00:00 2001 From: Abhijat Malviya Date: Thu, 11 Apr 2024 12:34:33 +0530 Subject: [PATCH] cst: Add ostream operator for chunk state (cherry picked from commit 963a5d3e30abd2a9714d84cd098afd442a486cae) --- src/v/cloud_storage/segment_chunk.cc | 11 +++++++++++ src/v/cloud_storage/segment_chunk.h | 2 ++ 2 files changed, 13 insertions(+) diff --git a/src/v/cloud_storage/segment_chunk.cc b/src/v/cloud_storage/segment_chunk.cc index fb0f951cdf8c3..6594a9db19edb 100644 --- a/src/v/cloud_storage/segment_chunk.cc +++ b/src/v/cloud_storage/segment_chunk.cc @@ -12,6 +12,17 @@ namespace cloud_storage { +std::ostream& operator<<(std::ostream& os, chunk_state c) { + switch (c) { + case chunk_state::not_available: + return os << "not available"; + case chunk_state::download_in_progress: + return os << "download in progress"; + case chunk_state::hydrated: + return os << "hydrated"; + } +} + std::strong_ordering segment_chunk::operator<=>(const segment_chunk& chunk) const { const auto cmp = required_by_readers_in_future diff --git a/src/v/cloud_storage/segment_chunk.h b/src/v/cloud_storage/segment_chunk.h index e2ccff522fcbe..5bad7d9be89fb 100644 --- a/src/v/cloud_storage/segment_chunk.h +++ b/src/v/cloud_storage/segment_chunk.h @@ -30,6 +30,8 @@ enum class chunk_state { hydrated, }; +std::ostream& operator<<(std::ostream& os, chunk_state); + struct segment_chunk { chunk_state current_state;