Trait ntp_proto::TimeSyncController
source · pub trait TimeSyncController<C: NtpClock, PeerID: Hash + Eq + Copy + Debug> {
type AlgorithmConfig: Debug + Copy + DeserializeOwned;
// Required methods
fn new(
clock: C,
config: SystemConfig,
algorithm_config: Self::AlgorithmConfig
) -> Self;
fn update_config(
&mut self,
config: SystemConfig,
algorithm_config: Self::AlgorithmConfig
);
fn peer_add(&mut self, id: PeerID);
fn peer_remove(&mut self, id: PeerID);
fn peer_update(&mut self, id: PeerID, usable: bool);
fn peer_measurement(
&mut self,
id: PeerID,
measurement: Measurement
) -> StateUpdate<PeerID>;
fn time_update(&mut self) -> StateUpdate<PeerID>;
fn peer_snapshot(&self, id: PeerID) -> Option<ObservablePeerTimedata>;
}Required Associated Types§
type AlgorithmConfig: Debug + Copy + DeserializeOwned
Required Methods§
sourcefn new(
clock: C,
config: SystemConfig,
algorithm_config: Self::AlgorithmConfig
) -> Self
fn new( clock: C, config: SystemConfig, algorithm_config: Self::AlgorithmConfig ) -> Self
Create a new clock controller controling the given clock
sourcefn update_config(
&mut self,
config: SystemConfig,
algorithm_config: Self::AlgorithmConfig
)
fn update_config( &mut self, config: SystemConfig, algorithm_config: Self::AlgorithmConfig )
Update used system config
sourcefn peer_remove(&mut self, id: PeerID)
fn peer_remove(&mut self, id: PeerID)
Notify the controller that a previous peer has gone
sourcefn peer_update(&mut self, id: PeerID, usable: bool)
fn peer_update(&mut self, id: PeerID, usable: bool)
Notify the controller that the status of a peer (whether or not it is usable for synchronization) has changed.
sourcefn peer_measurement(
&mut self,
id: PeerID,
measurement: Measurement
) -> StateUpdate<PeerID>
fn peer_measurement( &mut self, id: PeerID, measurement: Measurement ) -> StateUpdate<PeerID>
Notify the controller of a new measurement from a peer. The list of peerIDs is used for loop detection, with the first peerID given considered the primary peer used.
sourcefn time_update(&mut self) -> StateUpdate<PeerID>
fn time_update(&mut self) -> StateUpdate<PeerID>
Non-measurement driven update (queued via next_update)
sourcefn peer_snapshot(&self, id: PeerID) -> Option<ObservablePeerTimedata>
fn peer_snapshot(&self, id: PeerID) -> Option<ObservablePeerTimedata>
Get a snapshot of the timekeeping state of a peer.