feat: add churn v2
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2024-11-23 22:58:43 +01:00
parent 610a465279
commit 7487e7336e
6 changed files with 324 additions and 82 deletions

32
crates/churn/src/state.rs Normal file
View File

@@ -0,0 +1,32 @@
use std::{ops::Deref, sync::Arc};
#[derive(Clone)]
pub struct SharedState(Arc<State>);
impl SharedState {
pub async fn new() -> anyhow::Result<Self> {
Ok(Self(Arc::new(State::new().await?)))
}
}
impl From<&SharedState> for SharedState {
fn from(value: &SharedState) -> Self {
value.clone()
}
}
impl Deref for SharedState {
type Target = Arc<State>;
fn deref(&self) -> &Self::Target {
&self.0
}
}
pub struct State {}
impl State {
pub async fn new() -> anyhow::Result<Self> {
Ok(Self {})
}
}