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§

Required Methods§

source

fn new( clock: C, config: SystemConfig, algorithm_config: Self::AlgorithmConfig ) -> Self

Create a new clock controller controling the given clock

source

fn update_config( &mut self, config: SystemConfig, algorithm_config: Self::AlgorithmConfig )

Update used system config

source

fn peer_add(&mut self, id: PeerID)

Notify the controller that there is a new peer

source

fn peer_remove(&mut self, id: PeerID)

Notify the controller that a previous peer has gone

source

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.

source

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.

source

fn time_update(&mut self) -> StateUpdate<PeerID>

Non-measurement driven update (queued via next_update)

source

fn peer_snapshot(&self, id: PeerID) -> Option<ObservablePeerTimedata>

Get a snapshot of the timekeeping state of a peer.

Implementors§

source§

impl<C: NtpClock, PeerID: Hash + Eq + Copy + Debug> TimeSyncController<C, PeerID> for StandardClockController<C, PeerID>

§

type AlgorithmConfig = AlgorithmConfig