2022-05-05 15:50:44 +02:00
|
|
|
use crate::capnp::machine::Machine;
|
|
|
|
use crate::resources::search::ResourcesHandle;
|
|
|
|
use crate::resources::Resource;
|
2022-03-12 17:31:53 +01:00
|
|
|
use crate::session::SessionHandle;
|
2022-05-05 15:50:44 +02:00
|
|
|
use crate::RESOURCES;
|
2022-11-04 17:25:17 +01:00
|
|
|
use api::resources_capnp::resources;
|
2022-03-12 17:31:53 +01:00
|
|
|
use capnp::capability::Promise;
|
2022-03-13 17:29:21 +01:00
|
|
|
use capnp_rpc::pry;
|
2022-06-24 13:57:47 +02:00
|
|
|
use tracing::Span;
|
|
|
|
|
|
|
|
const TARGET: &str = "bffh::api::machinesystem";
|
2021-12-06 21:53:42 +01:00
|
|
|
|
2022-03-13 17:29:21 +01:00
|
|
|
#[derive(Clone)]
|
2022-03-11 22:13:54 +01:00
|
|
|
pub struct Machines {
|
2022-06-24 13:57:47 +02:00
|
|
|
span: Span,
|
2022-03-12 17:31:53 +01:00
|
|
|
session: SessionHandle,
|
2022-03-13 17:29:21 +01:00
|
|
|
resources: ResourcesHandle,
|
2021-12-06 21:53:42 +01:00
|
|
|
}
|
|
|
|
|
2022-03-11 22:13:54 +01:00
|
|
|
impl Machines {
|
2022-03-12 17:31:53 +01:00
|
|
|
pub fn new(session: SessionHandle) -> Self {
|
2022-06-24 13:57:47 +02:00
|
|
|
let span = tracing::info_span!(
|
|
|
|
target: TARGET,
|
|
|
|
parent: &session.span,
|
|
|
|
"MachineSystem",
|
|
|
|
);
|
2022-03-13 20:33:26 +01:00
|
|
|
// FIXME no unwrap bad
|
2022-05-05 15:50:44 +02:00
|
|
|
Self {
|
2022-06-24 13:57:47 +02:00
|
|
|
span,
|
2022-05-05 15:50:44 +02:00
|
|
|
session,
|
|
|
|
resources: RESOURCES.get().unwrap().clone(),
|
|
|
|
}
|
2021-12-06 21:53:42 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-11-04 17:25:17 +01:00
|
|
|
impl resources::Server for Machines {
|
2022-06-24 13:57:47 +02:00
|
|
|
|
2022-03-12 17:31:53 +01:00
|
|
|
}
|