chore: change db/store traces to trace level

This commit is contained in:
Tomáš Mládek 2023-08-20 16:21:23 +02:00
parent 95e012d397
commit ad55fc19b2
2 changed files with 15 additions and 15 deletions

View file

@ -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<usize> {
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<Address> {
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<Address> {
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)?;

View file

@ -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<P: AsRef<Path>>(path: P) -> Result<FsStore> {
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<PathBuf> = 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<RwLock<Vec<db::File>>>,
quick_check: bool,
) -> Result<UpdatePathOutcome> {
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<u32> {
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<NaiveDateTime>) -> Result<usize> {
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<usize> {
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()?;