diff --git a/src/adapters/ingresses/mod.rs b/src/adapters/ingresses/mod.rs index 5c7bb19..90b5665 100644 --- a/src/adapters/ingresses/mod.rs +++ b/src/adapters/ingresses/mod.rs @@ -1,7 +1,28 @@ -pub trait Ingress {} +use async_trait::async_trait; +use miette::Result; + +/// Ingresses are responsible for (1) controlling how much traffic the canary +/// gets (hence the name ingress, since it functions like a virtual LB) and +/// (2) deploying, yanking, and promoting both the canary and the baseline. +#[async_trait] +pub trait Ingress { + /// Deploy the canary app. Do not assign it any traffic. + async fn deploy(&mut self) -> Result<()>; + + // TODO: define the other methods on this type. + // async fn yank_canary(&mut self) -> Result<()>; + // async fn promote_canary(&mut self) -> Result<()>; + // async fn set_canary_traffic(&mut self, percent: u8); +} pub struct MockIngress; -impl Ingress for MockIngress {} + +#[async_trait] +impl Ingress for MockIngress { + async fn deploy(&mut self) -> Result<()> { + todo!() + } +} impl From for BoxIngress { fn from(value: MockIngress) -> Self { @@ -12,3 +33,6 @@ impl From for BoxIngress { /// Convenience alias since this type is often dynamically /// dispatched. pub type BoxIngress = Box; + +#[cfg(test)] +mod tests {}