use std::pin::Pin;
use async_trait::async_trait;
use futures::Stream;
use uuid::Uuid;
use super::types::{
PipelineFuture, RegistryError, RunEvent, RunHandle, RunOutcome, RunPhase, RunSpec,
};
#[async_trait]
pub trait PipelineRunRegistry: Send + Sync {
async fn register_inline(
&self,
spec: RunSpec,
work: PipelineFuture,
) -> Result<RunOutcome, RegistryError>;
async fn register_background(
&self,
spec: RunSpec,
work: PipelineFuture,
) -> Result<RunHandle, RegistryError>;
fn subscribe(&self, run_id: Uuid) -> Pin<Box<dyn Stream<Item = RunEvent> + Send + 'static>>;
fn snapshot_status(&self, run_id: Uuid) -> Option<RunPhase>;
async fn abort(&self, run_id: Uuid) -> Result<(), RegistryError>;
async fn shutdown(&self) -> Result<(), RegistryError>;
}