mirror of
https://gitlab.com/fabinfra/fabaccess/bffh.git
synced 2024-11-11 01:53:23 +01:00
Actually implement fill_info in a way that compiles. ^^'
This commit is contained in:
parent
cfa71f8be2
commit
a279a2ed48
@ -1,4 +1,5 @@
|
||||
use std::sync::Arc;
|
||||
use std::ops::Deref;
|
||||
|
||||
use capnp::capability::Promise;
|
||||
use capnp::Error;
|
||||
@ -28,29 +29,32 @@ impl Machine {
|
||||
// TODO set all the others
|
||||
}
|
||||
|
||||
pub async fn fill_info(&self, builder: &mut m_info::Builder) {
|
||||
pub async fn fill_info(&self, builder: &mut m_info::Builder<'_>) {
|
||||
let guard = self.machine.lock().await;
|
||||
|
||||
builder.set_name(guard.desc.name.as_ref());
|
||||
builder.set_description(guard.desc.description.as_ref());
|
||||
|
||||
match guard.state.read_only().lock_ref().status {
|
||||
if let Some(desc) = guard.desc.description.as_ref() {
|
||||
builder.set_description(desc);
|
||||
}
|
||||
|
||||
match guard.read_state().lock_ref().deref().state {
|
||||
Status::Free => {
|
||||
builder.set_state(State::Free);
|
||||
}
|
||||
Status::Disabled => {
|
||||
builder.set_state(State::Disabled);
|
||||
}
|
||||
Status::Blocked(who, prio) => {
|
||||
Status::Blocked(_,_) => {
|
||||
builder.set_state(State::Blocked);
|
||||
}
|
||||
Status::InUse(who, prio) => {
|
||||
Status::InUse(_,_) => {
|
||||
builder.set_state(State::InUse);
|
||||
}
|
||||
Status::ToCheck(who, prio) => {
|
||||
Status::ToCheck(_,_) => {
|
||||
builder.set_state(State::ToCheck);
|
||||
}
|
||||
Status::Reserved(who, prio) => {
|
||||
Status::Reserved(_,_) => {
|
||||
builder.set_state(State::Reserved);
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@ use serde::{Serialize, Deserialize};
|
||||
|
||||
use futures_signals::signal::Signal;
|
||||
use futures_signals::signal::SignalExt;
|
||||
use futures_signals::signal::Mutable;
|
||||
use futures_signals::signal::{Mutable, ReadOnlyMutable};
|
||||
|
||||
use uuid::Uuid;
|
||||
|
||||
@ -172,6 +172,10 @@ impl Inner {
|
||||
return Ok(tx);
|
||||
}
|
||||
|
||||
pub fn read_state(&self) -> ReadOnlyMutable<MachineState> {
|
||||
self.state.read_only()
|
||||
}
|
||||
|
||||
pub fn get_signal(&self) -> impl Signal {
|
||||
self.state.signal_cloned()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user