2021-10-13 04:57:40 +02:00
|
|
|
use std::{
|
|
|
|
sync::Arc,
|
|
|
|
collections::HashMap,
|
|
|
|
};
|
2020-12-07 14:39:35 +01:00
|
|
|
|
2021-10-13 04:57:40 +02:00
|
|
|
use futures_signals::signal::{
|
|
|
|
Mutable,
|
|
|
|
MutableSignalCloned
|
|
|
|
};
|
2020-12-07 14:39:35 +01:00
|
|
|
|
2021-10-13 04:57:40 +02:00
|
|
|
use crate::state::State;
|
2020-12-07 14:39:35 +01:00
|
|
|
|
2021-10-13 04:57:40 +02:00
|
|
|
type ResourceState = Mutable<Arc<State>>;
|
|
|
|
type ResourceStateSignal = MutableSignalCloned<Arc<State>>;
|
2020-12-07 14:39:35 +01:00
|
|
|
|
2021-10-13 04:57:40 +02:00
|
|
|
/// Connection Broker between Resources and Subscribers
|
2020-12-07 14:39:35 +01:00
|
|
|
///
|
2021-10-13 04:57:40 +02: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 {
|
2021-10-13 04:57:40 +02:00
|
|
|
sources: HashMap<u64, ResourceState>,
|
2020-12-07 14:39:35 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|