fabaccess-bffh/bffhd/network.rs

26 lines
591 B
Rust
Raw Normal View History

use std::{
sync::Arc,
collections::HashMap,
};
2020-12-07 14:39:35 +01:00
use futures_signals::signal::{
Mutable,
MutableSignalCloned
};
2020-12-07 14:39:35 +01:00
use crate::state::State;
2020-12-07 14:39:35 +01:00
type ResourceState = Mutable<Arc<State>>;
type ResourceStateSignal = MutableSignalCloned<Arc<State>>;
2020-12-07 14:39:35 +01:00
/// Connection Broker between Resources and Subscribers
2020-12-07 14:39:35 +01:00
///
/// This serves as touch-off point between resources and anybody else. It doesn't drive
/// any state updates, it only allows subscribers to subscribe to the resources that are
/// driving the state updates
2020-12-07 14:39:35 +01:00
pub struct Network {
sources: HashMap<u64, ResourceState>,
2020-12-07 14:39:35 +01:00
}