store: don't include cached objects in Debug format

I was looking into some overly verbose logs and happened to notice
that `Store` uses the default derived, which presumably means it's
going to include all objects in its cached. Just including the
backend's debug string seems enough.
This commit is contained in:
Martin von Zweigbergk 2023-09-01 10:21:11 -07:00 committed by Martin von Zweigbergk
parent 16c897d8b4
commit e3825495e3

View File

@ -16,6 +16,7 @@
use std::any::Any;
use std::collections::HashMap;
use std::fmt::{Debug, Formatter};
use std::io::Read;
use std::sync::{Arc, RwLock};
@ -33,7 +34,6 @@ use crate::tree_builder::TreeBuilder;
/// Wraps the low-level backend and makes it return more convenient types. Also
/// adds caching.
#[derive(Debug)]
pub struct Store {
backend: Box<dyn Backend>,
commit_cache: RwLock<HashMap<CommitId, Arc<backend::Commit>>>,
@ -41,6 +41,14 @@ pub struct Store {
use_tree_conflict_format: bool,
}
impl Debug for Store {
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), std::fmt::Error> {
f.debug_struct("Store")
.field("backend", &self.backend)
.finish_non_exhaustive()
}
}
impl Store {
pub fn new(backend: Box<dyn Backend>, use_tree_conflict_format: bool) -> Arc<Self> {
Arc::new(Store {