mirror of
https://gitlab.com/fabinfra/fabaccess/bffh.git
synced 2024-11-22 14:57:56 +01:00
Load Machines
This commit is contained in:
parent
6fbf63a7b9
commit
a16712c66f
@ -76,6 +76,11 @@ impl Machine {
|
|||||||
let mut guard = self.inner.try_lock().unwrap();
|
let mut guard = self.inner.try_lock().unwrap();
|
||||||
guard.request_state_change(who, new_state)
|
guard.request_state_change(who, new_state)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn signal(&self) -> impl Signal<Item=MachineState> {
|
||||||
|
let mut guard = self.inner.try_lock().unwrap();
|
||||||
|
guard.signal()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Deref for Machine {
|
impl Deref for Machine {
|
||||||
@ -227,7 +232,14 @@ impl MachineDescription {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn load(config: &crate::config::Settings) -> Result<Vec<Machine>> {
|
pub fn load(config: &crate::config::Settings) -> Result<Vec<Machine>> {
|
||||||
unimplemented!()
|
let mut map = MachineDescription::load_file(&config.machines)?;
|
||||||
|
|
||||||
|
Ok(map.drain()
|
||||||
|
.map(|(k,v)| {
|
||||||
|
// TODO: Read state from the state db
|
||||||
|
Machine::construct(k, v, MachineState::new())
|
||||||
|
})
|
||||||
|
.collect())
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(test_DISABLED)]
|
#[cfg(test_DISABLED)]
|
||||||
|
@ -133,10 +133,9 @@ fn maybe(matches: clap::ArgMatches, log: Arc<Logger>) -> Result<(), Error> {
|
|||||||
error!(log, "Loading is currently not implemented");
|
error!(log, "Loading is currently not implemented");
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
//let machines = machine::load(&config)?;
|
|
||||||
let ex = Executor::new();
|
let ex = Executor::new();
|
||||||
|
|
||||||
|
let machines = machine::load(&config)?;
|
||||||
let m = futures_signals::signal::Mutable::new(crate::db::machine::MachineState::new());
|
let m = futures_signals::signal::Mutable::new(crate::db::machine::MachineState::new());
|
||||||
let (mut tx, actor) = actor::load()?;
|
let (mut tx, actor) = actor::load()?;
|
||||||
|
|
||||||
@ -145,7 +144,8 @@ fn maybe(matches: clap::ArgMatches, log: Arc<Logger>) -> Result<(), Error> {
|
|||||||
// TODO HERE: restore connections between initiators, machines, actors
|
// TODO HERE: restore connections between initiators, machines, actors
|
||||||
|
|
||||||
// Like so
|
// Like so
|
||||||
tx.try_send(Some(m.signal_cloned())).unwrap();
|
let m = machines[0].signal();
|
||||||
|
tx.try_send(Some(m)).unwrap();
|
||||||
|
|
||||||
// TODO HERE: Spawn all actors & inits
|
// TODO HERE: Spawn all actors & inits
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user