MCPcopy Create free account
hub / github.com/aws/clock-bound / construct

Method construct

clock-bound/src/daemon/io/phc.rs:184–203  ·  view source on GitHub ↗

Constructs a new `Phc` IO source instance using the given parameters. This implementation performs autoconfiguration to determine the PHC device that should be used for obtaining reference clock timestamps and the corresponding clock error bound for those timestamps.

(
        event_sender: async_ring_buffer::Sender<event::Phc>,
        ctrl_receiver: mpsc::Receiver<ControlRequest>,
        clock_disruption_receiver: watch::Receiver<ClockDisruptionEvent>,
    )

Source from the content-addressed store, hash-verified

182 /// This implementation performs autoconfiguration to determine
183 /// the PHC device that should be used for obtaining reference clock
184 /// timestamps and the corresponding clock error bound for those timestamps.
185 pub async fn construct(
186 event_sender: async_ring_buffer::Sender<event::Phc>,
187 ctrl_receiver: mpsc::Receiver<ControlRequest>,
188 clock_disruption_receiver: watch::Receiver<ClockDisruptionEvent>,
189 ) -> Result<Self, PhcError> {
190 let (phc_reader, phc_clock_error_bound_reader, device_path) =
191 Self::autoconfigure_phc_readers().await?;
192 let mut phc_interval = interval(PHC_SOURCE_INTERVAL_DURATION);
193 phc_interval.set_missed_tick_behavior(MissedTickBehavior::Delay);
194
195 Ok(Phc {
196 event_sender,
197 ctrl_receiver,
198 clock_disruption_receiver,
199 interval: phc_interval,
200 reader: phc_reader,
201 clock_error_bound_reader: phc_clock_error_bound_reader,
202 device_path,
203 })
204 }
205
206 /// Getter for `device_path`

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected