use async_trait::async_trait;
use lance_core::Result;
use std::sync::Arc;
#[async_trait]
pub trait IndexBuildProgress: std::fmt::Debug + Sync + Send {
async fn stage_start(&self, stage: &str, total: Option<u64>, unit: &str) -> Result<()>;
async fn stage_progress(&self, stage: &str, completed: u64) -> Result<()>;
async fn stage_complete(&self, stage: &str) -> Result<()>;
}
#[derive(Debug, Clone, Default)]
pub struct NoopIndexBuildProgress;
#[async_trait]
impl IndexBuildProgress for NoopIndexBuildProgress {
async fn stage_start(&self, _: &str, _: Option<u64>, _: &str) -> Result<()> {
Ok(())
}
async fn stage_progress(&self, _: &str, _: u64) -> Result<()> {
Ok(())
}
async fn stage_complete(&self, _: &str) -> Result<()> {
Ok(())
}
}
pub fn noop_progress() -> Arc<dyn IndexBuildProgress> {
Arc::new(NoopIndexBuildProgress)
}