1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
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 services: Vec<Arc<SalarymanService>>,
}
impl SalarymanDContext {
pub fn new() -> Self {
Self {
services: Vec::new(),
}
}
pub fn from_vec(services: Vec<Arc<SalarymanService>>) -> Self {
Self { services }
}
}
#[derive(Serialize, Deserialize, JsonSchema, Debug)]
pub struct StdinBuffer {
pub stdin: String,
pub endl: Option<bool>,
}
#[derive(Serialize, Deserialize, JsonSchema, Debug)]
pub struct ServicePath {
pub service_uuid: Uuid,
}
|