diff --git a/Cargo.toml b/Cargo.toml index 349534b..9760bab 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -79,7 +79,7 @@ tracing-subscriber = { version = "0.3", features = ["env-filter", "registry", "s tracing-futures = { version = "0.2", features = ["futures-03"] } # API -api = { path = "api" } +api = { path = "api", features = ["generated"] } capnp = "0.14" capnp-rpc = "0.14.1" diff --git a/api/schema b/api/schema index 21574d8..b5f5a49 160000 --- a/api/schema +++ b/api/schema @@ -1 +1 @@ -Subproject commit 21574d818504d522db01053ce5c19630ac41959a +Subproject commit b5f5a4981f7d5f287682a7f545758dabd496d2cd diff --git a/api/src/schema.rs b/api/src/schema.rs index 1cd0a5c..e01f957 100644 --- a/api/src/schema.rs +++ b/api/src/schema.rs @@ -1,41 +1,53 @@ pub use capnpc::schema_capnp; -pub mod authenticationsystem_capnp { - include!(concat!(env!("OUT_DIR"), "/authenticationsystem_capnp.rs")); +pub mod auth_capnp { + include!(concat!(env!("OUT_DIR"), "/auth_capnp.rs")); } -pub mod connection_capnp { - include!(concat!(env!("OUT_DIR"), "/connection_capnp.rs")); +pub mod main_capnp { + include!(concat!(env!("OUT_DIR"), "/main_capnp.rs")); } -pub mod general_capnp { - include!(concat!(env!("OUT_DIR"), "/general_capnp.rs")); +pub mod resource_capnp { + include!(concat!(env!("OUT_DIR"), "/resource_capnp.rs")); } -pub mod machine_capnp { - include!(concat!(env!("OUT_DIR"), "/machine_capnp.rs")); -} - -pub mod machinesystem_capnp { - include!(concat!(env!("OUT_DIR"), "/machinesystem_capnp.rs")); -} - -pub mod permissionsystem_capnp { - include!(concat!(env!("OUT_DIR"), "/permissionsystem_capnp.rs")); +pub mod resources_capnp { + include!(concat!(env!("OUT_DIR"), "/resources_capnp.rs")); } pub mod role_capnp { include!(concat!(env!("OUT_DIR"), "/role_capnp.rs")); } -pub mod space_capnp { - include!(concat!(env!("OUT_DIR"), "/space_capnp.rs")); -} - pub mod user_capnp { include!(concat!(env!("OUT_DIR"), "/user_capnp.rs")); } -pub mod usersystem_capnp { - include!(concat!(env!("OUT_DIR"), "/usersystem_capnp.rs")); +pub mod users_capnp { + include!(concat!(env!("OUT_DIR"), "/users_capnp.rs")); +} + +pub mod claim_capnp { + include!(concat!(env!("OUT_DIR"), "/claim_capnp.rs")); +} + +pub mod interest_capnp { + include!(concat!(env!("OUT_DIR"), "/interest_capnp.rs")); +} + +pub mod notify_capnp { + include!(concat!(env!("OUT_DIR"), "/notify_capnp.rs")); +} + +pub mod state_capnp { + include!(concat!(env!("OUT_DIR"), "/state_capnp.rs")); +} + +pub mod utils_capnp { + include!(concat!(env!("OUT_DIR"), "/utils_capnp.rs")); +} + +pub mod persistent_capnp { + include!(concat!(env!("OUT_DIR"), "/persistent_capnp.rs")); } diff --git a/bffhd/capnp/authenticationsystem.rs b/bffhd/capnp/authenticationsystem.rs index 943933c..96b2b08 100644 --- a/bffhd/capnp/authenticationsystem.rs +++ b/bffhd/capnp/authenticationsystem.rs @@ -12,10 +12,10 @@ use tracing::Span; use crate::capnp::session::APISession; use crate::session::SessionManager; -use api::authenticationsystem_capnp::authentication::{ +use api::auth_capnp::authentication::{ AbortParams, AbortResults, Server as AuthenticationSystem, StepParams, StepResults, }; -use api::authenticationsystem_capnp::{response, response::Error as ErrorCode}; +use api::auth_capnp::{response, response::Error as ErrorCode}; use crate::authentication::V; const TARGET: &str = "bffh::api::authenticationsystem"; diff --git a/bffhd/capnp/connection.rs b/bffhd/capnp/connection.rs index 2e96dc6..1140154 100644 --- a/bffhd/capnp/connection.rs +++ b/bffhd/capnp/connection.rs @@ -1,5 +1,5 @@ -use api::connection_capnp::bootstrap; -pub use api::connection_capnp::bootstrap::Client; +use api::main_capnp::bootstrap; +pub use api::main_capnp::bootstrap::Client; use std::fmt; use std::fmt::{Formatter, Write}; use std::net::SocketAddr; diff --git a/bffhd/capnp/machine.rs b/bffhd/capnp/machine.rs index d05d4f2..a4fc534 100644 --- a/bffhd/capnp/machine.rs +++ b/bffhd/capnp/machine.rs @@ -2,8 +2,7 @@ use crate::capnp::user::User; use crate::resources::modules::fabaccess::{ArchivedStatus, Status}; use crate::resources::Resource; use crate::session::SessionHandle; -use api::general_capnp::optional; -use api::machine_capnp::machine::{ +use api::resource_capnp::resource::{ self, admin, admin::Server as AdminServer, check, check::Server as CheckServer, in_use as inuse, in_use::Server as InUseServer, info, info::Server as InfoServer, manage, manage::Server as ManageServer, use_, use_::Server as UseServer, MachineState, @@ -22,7 +21,7 @@ impl Machine { Self { session, resource } } - pub fn build_into(self, mut builder: machine::Builder) { + pub fn build_into(self, mut builder: resource::Builder) { builder.set_id(self.resource.get_id()); builder.set_name(self.resource.get_name()); if let Some(ref desc) = self.resource.get_description().description { @@ -313,7 +312,7 @@ impl AdminServer for Machine { params: admin::ForceSetStateParams, _: admin::ForceSetStateResults, ) -> Promise<(), ::capnp::Error> { - use api::schema::machine_capnp::machine::MachineState as APIMState; + use api::schema::resource_capnp::resource::MachineState as APIMState; let user = self.session.get_user_ref(); let state = match pry!(pry!(params.get()).get_state()) { APIMState::Free => Status::Free,