2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-11-20 11:21:14 +00:00

Instrument repo and store build methods

This commit is contained in:
asonix 2023-07-08 10:42:03 -05:00
parent d51c348a3f
commit 4680f9c3aa
5 changed files with 7 additions and 4 deletions

View file

@ -461,6 +461,7 @@ where
}
impl Repo {
#[tracing::instrument]
pub(crate) fn open(config: config::Repo) -> color_eyre::Result<Self> {
match config {
config::Repo::Sled(config::Sled {

View file

@ -44,6 +44,7 @@ pub(super) struct Old {
}
impl Old {
#[tracing::instrument]
pub(super) fn open(path: PathBuf) -> color_eyre::Result<Option<Self>> {
if let Some(db) = migrate::LatestDb::exists(path).migrate()? {
Ok(Some(Self {

View file

@ -71,6 +71,7 @@ pub(crate) struct SledRepo {
}
impl SledRepo {
#[tracing::instrument(skip(db))]
pub(crate) fn new(db: Db) -> Result<Self, SledError> {
Ok(SledRepo {
healthz_count: Arc::new(AtomicU64::new(0)),

View file

@ -162,12 +162,11 @@ impl Store for FileStore {
}
impl FileStore {
pub(crate) async fn build(root_dir: PathBuf, repo: Repo) -> Result<Self, StoreError> {
#[tracing::instrument(skip(repo))]
pub(crate) async fn build(root_dir: PathBuf, repo: Repo) -> color_eyre::Result<Self> {
let path_gen = init_generator(&repo).await?;
tokio::fs::create_dir_all(&root_dir)
.await
.map_err(FileError::from)?;
tokio::fs::create_dir_all(&root_dir).await?;
Ok(FileStore {
root_dir,

View file

@ -428,6 +428,7 @@ impl Store for ObjectStore {
impl ObjectStore {
#[allow(clippy::too_many_arguments)]
#[tracing::instrument(skip(access_key, secret_key, session_token, repo))]
pub(crate) async fn build(
endpoint: Url,
bucket_name: String,