Skip to content

Commit

Permalink
implement fmt::Display for Partition
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-rembridge committed May 6, 2024
1 parent b271d8f commit 7a2ce4d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions server/src/streaming/partitions/partition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use dashmap::DashMap;
use iggy::consumer::ConsumerKind;
use iggy::utils::duration::IggyDuration;
use iggy::utils::timestamp::IggyTimestamp;
use std::fmt;
use std::sync::atomic::{AtomicU32, AtomicU64, Ordering};
use std::sync::Arc;

Expand Down Expand Up @@ -41,6 +42,17 @@ pub struct Partition {
pub(crate) storage: Arc<SystemStorage>,
}

impl fmt::Display for Partition {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "ID: {}, ", self.partition_id)?;
write!(f, "created at: {}, ", self.created_at)?;
write!(f, "segments count: {}, ", self.get_segments_count())?;
write!(f, "current offset: {}, ", self.current_offset)?;
write!(f, "size bytes: {}, ", self.get_size_bytes())?;
write!(f, "messages count: {}, ", self.get_messages_count())
}
}

#[derive(Debug, PartialEq, Clone)]
pub struct ConsumerOffset {
pub kind: ConsumerKind,
Expand Down

0 comments on commit 7a2ce4d

Please sign in to comment.