use serde::Serialize;
use crate::ops::Ops;
pub trait Module: Send + Sync + Sized + 'static {
fn manifest(&self) -> Manifest;
fn register(&self, ops: &mut Ops<Self>);
}
#[derive(Clone, Debug, Serialize)]
pub struct Manifest {
pub name: &'static str,
pub contract_version: &'static str,
pub routing: Routing,
pub long_running: bool,
pub scopes: Vec<&'static str>,
pub metering_unit: &'static str,
pub hardware: Hardware,
pub audience: Audience,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum Routing {
ShardedByProject,
Stateless,
GpuPool,
}
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize)]
pub struct Hardware {
pub memory_mib: u32,
pub gpu: bool,
}
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize)]
#[serde(rename_all = "snake_case")]
pub enum Audience {
#[default]
Model,
Host,
}