use crate::manifest::{ImplKind, TransformManifest};
use arrow::array::RecordBatch;
use std::path::Path;
#[derive(Debug, thiserror::Error)]
pub enum ComputeError {
#[error("failed to load transform `{id}`: {msg}")]
Load { id: String, msg: String },
#[error("schema mismatch in `{id}`: {msg}")]
Schema { id: String, msg: String },
#[error("transform `{id}` failed: {msg}")]
Run { id: String, msg: String },
#[error("no backend registered for impl `{kind:?}`")]
NoBackend { kind: ImplKind },
}
pub trait Compute: Send + Sync {
fn manifest(&self) -> &TransformManifest;
fn run(&self, inputs: &[RecordBatch]) -> Result<RecordBatch, ComputeError>;
}
pub trait TransformBackend: Send + Sync {
fn kind(&self) -> ImplKind;
fn load(&self, manifest: &TransformManifest, root: &Path) -> Result<Box<dyn Compute>, ComputeError>;
}