feat: add release manager

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2024-02-11 14:44:15 +01:00
parent a444bff1ee
commit 8bab1a1df3
7 changed files with 118 additions and 0 deletions

View File

@@ -16,3 +16,6 @@ tonic = "0.11.0"
[build-dependencies]
tonic-build = "0.11.0"
[dev-dependencies]
mockall = "0.12.1"

View File

@@ -7,6 +7,8 @@ mod grpc;
mod app;
mod services;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
dotenv::dotenv().ok();

View File

@@ -0,0 +1 @@
pub mod release_manager;

View File

@@ -0,0 +1,25 @@
mod default;
pub mod traits;
use std::sync::Arc;
#[derive(Clone)]
pub struct ReleaseManager {
inner: Arc<dyn traits::ReleaseManager>,
}
impl ReleaseManager {
pub fn get_default() -> Self {
Self {
inner: Arc::new(default::ReleaseManager::new()),
}
}
}
impl std::ops::Deref for ReleaseManager {
type Target = Arc<dyn traits::ReleaseManager>;
fn deref(&self) -> &Self::Target {
&self.inner
}
}

View File

@@ -0,0 +1,11 @@
use super::traits;
pub struct ReleaseManager {}
impl ReleaseManager {
pub fn new() -> Self {
Self {}
}
}
impl traits::ReleaseManager for ReleaseManager {}

View File

@@ -0,0 +1,4 @@
#[cfg(test)]
use mockall::{automock, mock, predicate::*};
#[cfg_attr(test, automock)]
pub trait ReleaseManager {}