From 78608add1c69a877b76a05147f6c26b7abe66669 Mon Sep 17 00:00:00 2001 From: yuzu Date: Sat, 12 Jul 2025 06:17:38 +0000 Subject: add start, stop, restart endpoints git-svn-id: svn+ssh://diminuette.aengel.lesbianunix.dev/salaryman/trunk@14 b9215c17-b818-4693-b096-d1e41a411fef --- src/smd/context.rs | 38 +++++++++++++++++++++++++++++--------- 1 file changed, 29 insertions(+), 9 deletions(-) (limited to 'src/smd/context.rs') diff --git a/src/smd/context.rs b/src/smd/context.rs index d8194c5..5d8038c 100644 --- a/src/smd/context.rs +++ b/src/smd/context.rs @@ -1,27 +1,47 @@ -use super::Config; -use salaryman::service::Service; +use salaryman::service::{Service, ServiceConf}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use std::sync::Arc; use tokio::sync::Mutex; +use uuid::Uuid; + +pub struct SalarymanService { + pub config: ServiceConf, + pub service: Arc>, +} +impl SalarymanService { + pub fn new() -> Self { + Self { + config: ServiceConf::new(), + service: Arc::new(Mutex::new(Service::new())), + } + } + pub fn from_parts(config: ServiceConf, service: Arc>) -> Self { + Self { config, service } + } +} pub struct SalarymanDContext { - pub config: Config, - pub service: Vec>>, + pub services: Vec>, } impl SalarymanDContext { pub fn new() -> Self { Self { - config: Config::new(), - service: Vec::new(), + services: Vec::new(), } } - pub fn from_parts(config: Config, service: Vec>>) -> Self { - Self { config, service } + pub fn from_vec(services: Vec>) -> Self { + Self { services } } } #[derive(Serialize, Deserialize, JsonSchema, Debug)] pub struct StdinBuffer { - pub string: String, + pub stdin: String, + pub endl: Option, +} + +#[derive(Serialize, Deserialize, JsonSchema, Debug)] +pub struct ServicePath { + pub service_uuid: Uuid, } -- cgit 1.4.1-2-gfad0