Yay stuffs?

This commit is contained in:
Nadja Reitzenstein 2022-11-01 13:14:14 +01:00
parent 2bbfc1e0c7
commit 2396046e88
6 changed files with 43 additions and 32 deletions

View File

@ -79,7 +79,7 @@ tracing-subscriber = { version = "0.3", features = ["env-filter", "registry", "s
tracing-futures = { version = "0.2", features = ["futures-03"] } tracing-futures = { version = "0.2", features = ["futures-03"] }
# API # API
api = { path = "api" } api = { path = "api", features = ["generated"] }
capnp = "0.14" capnp = "0.14"
capnp-rpc = "0.14.1" capnp-rpc = "0.14.1"

@ -1 +1 @@
Subproject commit 21574d818504d522db01053ce5c19630ac41959a Subproject commit b5f5a4981f7d5f287682a7f545758dabd496d2cd

View File

@ -1,41 +1,53 @@
pub use capnpc::schema_capnp; pub use capnpc::schema_capnp;
pub mod authenticationsystem_capnp { pub mod auth_capnp {
include!(concat!(env!("OUT_DIR"), "/authenticationsystem_capnp.rs")); include!(concat!(env!("OUT_DIR"), "/auth_capnp.rs"));
} }
pub mod connection_capnp { pub mod main_capnp {
include!(concat!(env!("OUT_DIR"), "/connection_capnp.rs")); include!(concat!(env!("OUT_DIR"), "/main_capnp.rs"));
} }
pub mod general_capnp { pub mod resource_capnp {
include!(concat!(env!("OUT_DIR"), "/general_capnp.rs")); include!(concat!(env!("OUT_DIR"), "/resource_capnp.rs"));
} }
pub mod machine_capnp { pub mod resources_capnp {
include!(concat!(env!("OUT_DIR"), "/machine_capnp.rs")); include!(concat!(env!("OUT_DIR"), "/resources_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 role_capnp { pub mod role_capnp {
include!(concat!(env!("OUT_DIR"), "/role_capnp.rs")); include!(concat!(env!("OUT_DIR"), "/role_capnp.rs"));
} }
pub mod space_capnp {
include!(concat!(env!("OUT_DIR"), "/space_capnp.rs"));
}
pub mod user_capnp { pub mod user_capnp {
include!(concat!(env!("OUT_DIR"), "/user_capnp.rs")); include!(concat!(env!("OUT_DIR"), "/user_capnp.rs"));
} }
pub mod usersystem_capnp { pub mod users_capnp {
include!(concat!(env!("OUT_DIR"), "/usersystem_capnp.rs")); 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"));
} }

View File

@ -12,10 +12,10 @@ use tracing::Span;
use crate::capnp::session::APISession; use crate::capnp::session::APISession;
use crate::session::SessionManager; use crate::session::SessionManager;
use api::authenticationsystem_capnp::authentication::{ use api::auth_capnp::authentication::{
AbortParams, AbortResults, Server as AuthenticationSystem, StepParams, StepResults, 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; use crate::authentication::V;
const TARGET: &str = "bffh::api::authenticationsystem"; const TARGET: &str = "bffh::api::authenticationsystem";

View File

@ -1,5 +1,5 @@
use api::connection_capnp::bootstrap; use api::main_capnp::bootstrap;
pub use api::connection_capnp::bootstrap::Client; pub use api::main_capnp::bootstrap::Client;
use std::fmt; use std::fmt;
use std::fmt::{Formatter, Write}; use std::fmt::{Formatter, Write};
use std::net::SocketAddr; use std::net::SocketAddr;

View File

@ -2,8 +2,7 @@ use crate::capnp::user::User;
use crate::resources::modules::fabaccess::{ArchivedStatus, Status}; use crate::resources::modules::fabaccess::{ArchivedStatus, Status};
use crate::resources::Resource; use crate::resources::Resource;
use crate::session::SessionHandle; use crate::session::SessionHandle;
use api::general_capnp::optional; use api::resource_capnp::resource::{
use api::machine_capnp::machine::{
self, admin, admin::Server as AdminServer, check, check::Server as CheckServer, 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, 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, manage::Server as ManageServer, use_, use_::Server as UseServer, MachineState,
@ -22,7 +21,7 @@ impl Machine {
Self { session, resource } 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_id(self.resource.get_id());
builder.set_name(self.resource.get_name()); builder.set_name(self.resource.get_name());
if let Some(ref desc) = self.resource.get_description().description { if let Some(ref desc) = self.resource.get_description().description {
@ -313,7 +312,7 @@ impl AdminServer for Machine {
params: admin::ForceSetStateParams, params: admin::ForceSetStateParams,
_: admin::ForceSetStateResults, _: admin::ForceSetStateResults,
) -> Promise<(), ::capnp::Error> { ) -> 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 user = self.session.get_user_ref();
let state = match pry!(pry!(params.get()).get_state()) { let state = match pry!(pry!(params.get()).get_state()) {
APIMState::Free => Status::Free, APIMState::Free => Status::Free,