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
use crate::model::{Env, EnvId, Vm, VmId};
use lazy_static::lazy_static;
use parking_lot::RwLock;
use std::{
collections::{HashMap, HashSet},
sync::Arc,
};
lazy_static! {
pub static ref SERV: Arc<Service> = Arc::new(Service::default());
}
pub type UserId = String;
#[derive(Default)]
pub struct Service {
#[allow(missing_docs)]
pub user_to_env: Arc<RwLock<HashMap<UserId, HashSet<EnvId>>>>,
#[allow(missing_docs)]
pub all_env: Arc<RwLock<HashMap<EnvId, Env>>>,
#[allow(missing_docs)]
pub all_vm: Arc<RwLock<HashMap<VmId, Vm>>>,
}