Skip to main content

Controller

Trait Controller 

Source
pub trait Controller {
    type Clock: Clock<TAI>;
    type Link<ControllerRef: AsRef<Self>>: Link<Error = Self::Error>;
    type Error: Debug;
    type ClockConfig: Default;
    type LinkConfig: Default;
    type TrackedLinkConfig: Default;

    // Required methods
    fn add_clock(
        &self,
        clock: Self::Clock,
        config: Self::ClockConfig,
    ) -> Result<ClockId, Self::Error>;
    fn remove_clock(&self, clock_id: ClockId) -> Result<(), Self::Error>;
    fn create_tracked_link<ControllerRef: AsRef<Self>>(
        this: ControllerRef,
        clock_a: ClockId,
        clock_b: Option<ClockId>,
        config: Self::LinkConfig,
        tracked_config: Self::TrackedLinkConfig,
    ) -> Result<Self::Link<ControllerRef>, Self::Error>;
    fn create_untracked_link<ControllerRef: AsRef<Self>>(
        this: ControllerRef,
        clock_a: ClockId,
        clock_b: Option<ClockId>,
        config: Self::LinkConfig,
    ) -> Result<Self::Link<ControllerRef>, Self::Error>;
    fn clock_snapshot(
        &self,
        clock: ClockId,
    ) -> Result<TimeSnapshot, Self::Error>;
    fn run<Fut: Future<Output = ()> + Send, F: Send + Fn(Duration) -> Fut>(
        this: impl AsRef<Self> + Send,
        sleep: F,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;
}
Expand description

A controller for clocks in a system.

Required Associated Types§

Source

type Clock: Clock<TAI>

Type of clocks which are managed by this controller

Measurement links between clocks belonging to the controller.

Source

type Error: Debug

Errors returned by the controller

Source

type ClockConfig: Default

Configuration for internal clocks

Source

type LinkConfig: Default

Configuration for links

Source

type TrackedLinkConfig: Default

Configuration for tracked links (links on which delay is automatically estimated)

Required Methods§

Source

fn add_clock( &self, clock: Self::Clock, config: Self::ClockConfig, ) -> Result<ClockId, Self::Error>

Add an internal, steered clock to the controller.

§Errors

May error if the controller is unable to handle more internal clocks

Source

fn remove_clock(&self, clock_id: ClockId) -> Result<(), Self::Error>

Remove an internal, steered clock from the controller

§Errors

May error if the internal clock in question is not known to the controller.

Create a measurement link between clocks where the delay and noise from the link itself are automatically determined.

The resulting link may need measurement in both directions to succesfully work

This is an assocatiated function to allow links to store references to the controller in a manner most convenient for the user.

§Errors

May fail if clocks are unknown to the controller, or when both clocks are external clocks.

Create a measurement link between clocks without delay estimation.

This is an associated function instead of a method to allow links to store references to the controller in a manner most convenient for the user.

§Errors

May fail if clocks are unknown to the controller, or when both clocks are external clocks.

Source

fn clock_snapshot(&self, clock: ClockId) -> Result<TimeSnapshot, Self::Error>

Get a time snapshot of the synchronization status of a clock.

§Errors

May fail if the clock is unknown to the controller.

Source

fn run<Fut: Future<Output = ()> + Send, F: Send + Fn(Duration) -> Fut>( this: impl AsRef<Self> + Send, sleep: F, ) -> impl Future<Output = Result<(), Self::Error>> + Send

Get a future which runs all the background tasks needed for the controller.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§