diff options
author | yuzu <yuzu@b9215c17-b818-4693-b096-d1e41a411fef> | 2025-07-12 06:17:38 +0000 |
---|---|---|
committer | yuzu <yuzu@b9215c17-b818-4693-b096-d1e41a411fef> | 2025-07-12 06:17:38 +0000 |
commit | 78608add1c69a877b76a05147f6c26b7abe66669 (patch) | |
tree | b2930fbf3c8e5f6bf2f5eb00f260b5b5092e09bb /src/smd/context.rs | |
parent | bc0fac1bf2a02c9a76c8c4b9eccc9235de4e86b2 (diff) | |
download | salaryman-78608add1c69a877b76a05147f6c26b7abe66669.tar.gz salaryman-78608add1c69a877b76a05147f6c26b7abe66669.tar.bz2 salaryman-78608add1c69a877b76a05147f6c26b7abe66669.zip |
add start, stop, restart endpoints
git-svn-id: svn+ssh://diminuette.aengel.lesbianunix.dev/salaryman/trunk@14 b9215c17-b818-4693-b096-d1e41a411fef
Diffstat (limited to 'src/smd/context.rs')
-rw-r--r-- | src/smd/context.rs | 38 |
1 files changed, 29 insertions, 9 deletions
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<Mutex<Service>>, +} +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<Mutex<Service>>) -> Self { + Self { config, service } + } +} pub struct SalarymanDContext { - pub config: Config, - pub service: Vec<Arc<Mutex<Service>>>, + pub services: Vec<Arc<SalarymanService>>, } impl SalarymanDContext { pub fn new() -> Self { Self { - config: Config::new(), - service: Vec::new(), + services: Vec::new(), } } - pub fn from_parts(config: Config, service: Vec<Arc<Mutex<Service>>>) -> Self { - Self { config, service } + pub fn from_vec(services: Vec<Arc<SalarymanService>>) -> Self { + Self { services } } } #[derive(Serialize, Deserialize, JsonSchema, Debug)] pub struct StdinBuffer { - pub string: String, + pub stdin: String, + pub endl: Option<bool>, +} + +#[derive(Serialize, Deserialize, JsonSchema, Debug)] +pub struct ServicePath { + pub service_uuid: Uuid, } |