pub mod compact;
pub mod store;
pub mod text;
use std::{sync::OnceLock, time::Duration};
pub use compact::{ARTIFACT_THRESHOLD_CHARS, PreviewBudget, compact_text, compact_value};
pub use store::{ARTIFACT_SUBDIR, ArtifactId, ArtifactStore};
const HOUSEKEEP_INTERVAL: Duration = Duration::from_secs(6 * 60 * 60);
pub fn default_store() -> &'static ArtifactStore {
static STORE: OnceLock<ArtifactStore> = OnceLock::new();
STORE.get_or_init(|| {
let store = ArtifactStore::default_store();
store.housekeep();
if let Ok(handle) = tokio::runtime::Handle::try_current() {
let bg = store.clone();
handle.spawn(async move {
loop {
tokio::time::sleep(HOUSEKEEP_INTERVAL).await;
bg.housekeep();
}
});
}
store
})
}