From ad55fc19b2a77183de6f2c7729ee06627ef21b5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Sun, 20 Aug 2023 16:21:23 +0200 Subject: [PATCH] chore: change db/store traces to trace level --- db/src/lib.rs | 8 ++++---- db/src/stores/fs/mod.rs | 22 +++++++++++----------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/db/src/lib.rs b/db/src/lib.rs index 25f82c0..47a134d 100644 --- a/db/src/lib.rs +++ b/db/src/lib.rs @@ -205,7 +205,7 @@ impl UpEndConnection { use crate::inner::schema::meta::dsl; let key = key.as_ref(); - debug!("Querying META:{key}"); + trace!("Querying META:{key}"); let _lock = self.lock.read().unwrap(); let conn = self.pool.get()?; @@ -279,7 +279,7 @@ impl UpEndConnection { pub fn remove_object(&self, object_address: Address) -> Result { use crate::inner::schema::data::dsl::*; - debug!("Deleting {}!", object_address); + trace!("Deleting {}!", object_address); let _lock = self.lock.write().unwrap(); let conn = self.pool.get()?; @@ -309,14 +309,14 @@ impl UpEndConnection { } pub fn insert_entry(&self, entry: Entry) -> Result
{ - debug!("Inserting: {}", entry); + trace!("Inserting: {}", entry); let db_entry = models::Entry::try_from(&entry)?; self.insert_model_entry(db_entry)?; Ok(entry.address()?) } pub fn insert_entry_immutable(&self, entry: Entry) -> Result
{ - debug!("Inserting immutably: {}", entry); + trace!("Inserting immutably: {}", entry); let address = entry.address()?; let db_entry = models::Entry::try_from(&ImmutableEntry(entry))?; self.insert_model_entry(db_entry)?; diff --git a/db/src/stores/fs/mod.rs b/db/src/stores/fs/mod.rs index b081f0d..5639c7a 100644 --- a/db/src/stores/fs/mod.rs +++ b/db/src/stores/fs/mod.rs @@ -20,7 +20,7 @@ use std::path::{Component, Path}; use std::sync::{Arc, Mutex, RwLock}; use std::time::{Duration, Instant, SystemTime, UNIX_EPOCH}; use std::{fs, iter}; -use tracing::{debug, error, info, trace, warn}; +use tracing::{error, info, trace, warn}; use upend_base::addressing::Address; use upend_base::constants::{ATTR_ADDED, ATTR_BY, ATTR_IN, ATTR_LABEL, ATTR_OF, TYPE_HASH_ADDRESS}; use upend_base::entry::Entry; @@ -40,7 +40,7 @@ pub struct FsStore { impl FsStore { pub fn from_path>(path: P) -> Result { - debug!("Initializing FS store."); + trace!("Initializing FS store."); let path = path.as_ref().to_path_buf().canonicalize()?; let store_dir = path.join(UPEND_SUBDIR); if !store_dir.exists() { @@ -82,7 +82,7 @@ impl FsStore { let lock = Arc::new(RwLock::new(())); - debug!("FS store created."); + trace!("FS store created."); Ok(FsStore { path, pool, lock }) } @@ -101,7 +101,7 @@ impl FsStore { let upconnection = db.connection()?; // Initialize types, etc... - debug!("Initializing DB types."); + trace!("Initializing DB types."); upend_insert_addr!( upconnection, Address::Attribute(FILE_SIZE_KEY.to_string()), @@ -116,7 +116,7 @@ impl FsStore { )?; // Walk through the vault, find all paths - debug!("Traversing vault directory"); + trace!("Traversing vault directory"); let absolute_dir_path = fs::canonicalize(&*self.path)?; let path_entries: Vec = WalkDir::new(&*self.path) .follow_links(true) @@ -164,7 +164,7 @@ impl FsStore { }) .collect(); - debug!("Processing done, cleaning up..."); + trace!("Processing done, cleaning up..."); let existing_files = existing_files.read().unwrap(); @@ -242,7 +242,7 @@ impl FsStore { existing_files: &Arc>>, quick_check: bool, ) -> Result { - debug!("Processing: {:?}", path); + trace!("Processing: {:?}", path); // Prepare the data let existing_files = Arc::clone(existing_files); @@ -311,7 +311,7 @@ impl FsStore { if let Some(idx) = maybe_existing_file { existing_files_write.swap_remove(idx); - debug!("Unchanged: {:?}", path); + trace!("Unchanged: {:?}", path); return Ok(UpdatePathOutcome::Unchanged(path)); } } @@ -491,7 +491,7 @@ impl FsStore { } pub fn insert_file(&self, file: db::NewFile) -> Result { - debug!( + trace!( "Inserting {} ({})...", &file.path, Address::Hash(UpMultihash::from_bytes(&file.hash)?) @@ -552,7 +552,7 @@ impl FsStore { fn file_update_mtime(&self, file_id: i32, m_time: Option) -> Result { use self::db::files::dsl::*; - debug!("Setting file ID {}'s mtime = {:?}", file_id, m_time); + trace!("Setting file ID {}'s mtime = {:?}", file_id, m_time); let _lock = self.lock.write().unwrap(); let conn = self.pool.get()?; @@ -564,7 +564,7 @@ impl FsStore { fn file_set_valid(&self, file_id: i32, is_valid: bool) -> Result { use self::db::files::dsl::*; - debug!("Setting file ID {} to valid = {}", file_id, is_valid); + trace!("Setting file ID {} to valid = {}", file_id, is_valid); let _lock = self.lock.write().unwrap(); let conn = self.pool.get()?;