mirror of
https://git.asonix.dog/asonix/pict-rs
synced 2024-12-22 19:31:35 +00:00
Instrument repo and store build methods
This commit is contained in:
parent
d51c348a3f
commit
4680f9c3aa
5 changed files with 7 additions and 4 deletions
|
@ -461,6 +461,7 @@ where
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Repo {
|
impl Repo {
|
||||||
|
#[tracing::instrument]
|
||||||
pub(crate) fn open(config: config::Repo) -> color_eyre::Result<Self> {
|
pub(crate) fn open(config: config::Repo) -> color_eyre::Result<Self> {
|
||||||
match config {
|
match config {
|
||||||
config::Repo::Sled(config::Sled {
|
config::Repo::Sled(config::Sled {
|
||||||
|
|
|
@ -44,6 +44,7 @@ pub(super) struct Old {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Old {
|
impl Old {
|
||||||
|
#[tracing::instrument]
|
||||||
pub(super) fn open(path: PathBuf) -> color_eyre::Result<Option<Self>> {
|
pub(super) fn open(path: PathBuf) -> color_eyre::Result<Option<Self>> {
|
||||||
if let Some(db) = migrate::LatestDb::exists(path).migrate()? {
|
if let Some(db) = migrate::LatestDb::exists(path).migrate()? {
|
||||||
Ok(Some(Self {
|
Ok(Some(Self {
|
||||||
|
|
|
@ -71,6 +71,7 @@ pub(crate) struct SledRepo {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl SledRepo {
|
impl SledRepo {
|
||||||
|
#[tracing::instrument(skip(db))]
|
||||||
pub(crate) fn new(db: Db) -> Result<Self, SledError> {
|
pub(crate) fn new(db: Db) -> Result<Self, SledError> {
|
||||||
Ok(SledRepo {
|
Ok(SledRepo {
|
||||||
healthz_count: Arc::new(AtomicU64::new(0)),
|
healthz_count: Arc::new(AtomicU64::new(0)),
|
||||||
|
|
|
@ -162,12 +162,11 @@ impl Store for FileStore {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl 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?;
|
let path_gen = init_generator(&repo).await?;
|
||||||
|
|
||||||
tokio::fs::create_dir_all(&root_dir)
|
tokio::fs::create_dir_all(&root_dir).await?;
|
||||||
.await
|
|
||||||
.map_err(FileError::from)?;
|
|
||||||
|
|
||||||
Ok(FileStore {
|
Ok(FileStore {
|
||||||
root_dir,
|
root_dir,
|
||||||
|
|
|
@ -428,6 +428,7 @@ impl Store for ObjectStore {
|
||||||
|
|
||||||
impl ObjectStore {
|
impl ObjectStore {
|
||||||
#[allow(clippy::too_many_arguments)]
|
#[allow(clippy::too_many_arguments)]
|
||||||
|
#[tracing::instrument(skip(access_key, secret_key, session_token, repo))]
|
||||||
pub(crate) async fn build(
|
pub(crate) async fn build(
|
||||||
endpoint: Url,
|
endpoint: Url,
|
||||||
bucket_name: String,
|
bucket_name: String,
|
||||||
|
|
Loading…
Reference in a new issue