Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
13 changes: 11 additions & 2 deletions src/storage/src/region.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
#[cfg(test)]
mod tests;
mod writer;

use std::collections::BTreeMap;
use std::fmt;
use std::sync::Arc;

use async_trait::async_trait;
Expand Down Expand Up @@ -49,7 +51,6 @@ use crate::wal::Wal;
use crate::write_batch::WriteBatch;

/// [Region] implementation.
#[derive(Debug)]
pub struct RegionImpl<S: LogStore> {
inner: Arc<RegionInner<S>>,
}
Expand All @@ -62,6 +63,15 @@ impl<S: LogStore> Clone for RegionImpl<S> {
}
}

impl<S: LogStore> fmt::Debug for RegionImpl<S> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
f.debug_struct("RegionImpl")
.field("id", &self.inner.shared.id)
.field("name", &self.inner.shared.name)
.finish()
Comment thread
evenyag marked this conversation as resolved.
}
}

#[async_trait]
impl<S: LogStore> Region for RegionImpl<S> {
type Error = Error;
Expand Down Expand Up @@ -440,7 +450,6 @@ impl SharedData {

pub type SharedDataRef = Arc<SharedData>;

#[derive(Debug)]
struct RegionInner<S: LogStore> {
shared: SharedDataRef,
writer: RegionWriterRef,
Expand Down
4 changes: 4 additions & 0 deletions src/storage/src/region/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,10 @@ async fn test_new_region() {

assert_eq!(region_name, region.name());
assert_eq!(expect_schema, *region.in_memory_metadata().schema());
assert_eq!(
r#"RegionImpl { id: 0, name: "region-0" }"#,
format!("{:?}", region)
);
Comment thread
evenyag marked this conversation as resolved.
Outdated
}

#[tokio::test]
Expand Down