pub mod id_alloc;
pub mod index_builder;
pub mod recovery;
pub mod registry;
pub mod scope;
pub mod wal;
pub mod writer_factory;
pub use registry::{ForkHolderGuard, ForkRegistryHandle};
pub use scope::{ForkLocalIndexKind, ForkScope};
use std::sync::Arc;
use object_store::ObjectStore;
use object_store::path::Path as ObjectStorePath;
use uni_common::core::fork::ForkId;
use crate::store_utils::{DEFAULT_TIMEOUT, delete_with_timeout, list_with_timeout};
pub async fn delete_fork_artifacts(store: &Arc<dyn ObjectStore>, fork_id: &ForkId) {
let prefixes = [
ObjectStorePath::from(format!("catalog/forks/{fork_id}")),
wal::wal_prefix(fork_id),
];
for prefix in prefixes {
match list_with_timeout(store, Some(&prefix), DEFAULT_TIMEOUT).await {
Ok(metas) => {
for meta in metas {
if let Err(e) =
delete_with_timeout(store, &meta.location, DEFAULT_TIMEOUT).await
{
tracing::warn!(fork_id = %fork_id, path = %meta.location, "delete fork artifact returned {e}");
}
}
}
Err(e) => {
tracing::warn!(fork_id = %fork_id, prefix = %prefix, "list fork artifacts returned {e}")
}
}
}
}