ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/salaryman/trunk/src/smd/context.rs
Revision: 14
Committed: Sat Jul 12 06:17:38 2025 UTC (2 months, 4 weeks ago) by yuzu
File size: 1116 byte(s)
Log Message:
add start, stop, restart endpoints

File Contents

# User Rev Content
1 yuzu 14 use salaryman::service::{Service, ServiceConf};
2 yuzu 13 use schemars::JsonSchema;
3     use serde::{Deserialize, Serialize};
4     use std::sync::Arc;
5     use tokio::sync::Mutex;
6 yuzu 14 use uuid::Uuid;
7 yuzu 13
8 yuzu 14 pub struct SalarymanService {
9     pub config: ServiceConf,
10     pub service: Arc<Mutex<Service>>,
11     }
12     impl SalarymanService {
13     pub fn new() -> Self {
14     Self {
15     config: ServiceConf::new(),
16     service: Arc::new(Mutex::new(Service::new())),
17     }
18     }
19     pub fn from_parts(config: ServiceConf, service: Arc<Mutex<Service>>) -> Self {
20     Self { config, service }
21     }
22     }
23    
24 yuzu 13 pub struct SalarymanDContext {
25 yuzu 14 pub services: Vec<Arc<SalarymanService>>,
26 yuzu 13 }
27     impl SalarymanDContext {
28     pub fn new() -> Self {
29     Self {
30 yuzu 14 services: Vec::new(),
31 yuzu 13 }
32     }
33 yuzu 14 pub fn from_vec(services: Vec<Arc<SalarymanService>>) -> Self {
34     Self { services }
35 yuzu 13 }
36     }
37    
38     #[derive(Serialize, Deserialize, JsonSchema, Debug)]
39     pub struct StdinBuffer {
40 yuzu 14 pub stdin: String,
41     pub endl: Option<bool>,
42 yuzu 13 }
43 yuzu 14
44     #[derive(Serialize, Deserialize, JsonSchema, Debug)]
45     pub struct ServicePath {
46     pub service_uuid: Uuid,
47     }