(
clock_params_receiver: Receiver<ClockParameters>,
clock_disruption_receiver: watch::Receiver<ClockDisruptionEvent>,
cancellation_token: CancellationToken,
disruption_
| 65 | } |
| 66 | |
| 67 | pub fn construct( |
| 68 | clock_params_receiver: Receiver<ClockParameters>, |
| 69 | clock_disruption_receiver: watch::Receiver<ClockDisruptionEvent>, |
| 70 | cancellation_token: CancellationToken, |
| 71 | disruption_marker: u64, |
| 72 | clock_disruption_support_enabled: bool, |
| 73 | ) -> Self { |
| 74 | // Build two writers, each writing to a specific shared memory segment path. |
| 75 | // |
| 76 | // FIXME: given these path are const strings, would be worth looking into moving the |
| 77 | // creation of these writers to the ClockStateWriter::new() method. |
| 78 | // |
| 79 | let shm_writer_0 = ShmWriter::new( |
| 80 | Path::new(CLOCKBOUND_SHM_DEFAULT_PATH_V0), |
| 81 | ClockErrorBoundLayoutVersion::V2, |
| 82 | ClockErrorBoundLayoutVersion::V2, |
| 83 | ) |
| 84 | .unwrap(); |
| 85 | let safe_shm_writer_0 = SafeShmWriter::new(shm_writer_0); |
| 86 | |
| 87 | let shm_writer_1 = ShmWriter::new( |
| 88 | Path::new(CLOCKBOUND_SHM_DEFAULT_PATH_V1), |
| 89 | ClockErrorBoundLayoutVersion::V3, |
| 90 | ClockErrorBoundLayoutVersion::V3, |
| 91 | ) |
| 92 | .unwrap(); |
| 93 | let safe_shm_writer_1 = SafeShmWriter::new(shm_writer_1); |
| 94 | |
| 95 | let clock_state_writer: ClockStateWriter<SafeShmWriter> = ClockStateWriter::builder() |
| 96 | .clock_disruption_support_enabled(clock_disruption_support_enabled) |
| 97 | .shm_writer_0(safe_shm_writer_0) |
| 98 | .shm_writer_1(safe_shm_writer_1) |
| 99 | .max_drift_ppb(MAX_DISPERSION_GROWTH_PPB) |
| 100 | .disruption_marker(disruption_marker) |
| 101 | .build(); |
| 102 | #[cfg(not(feature = "test-side-by-side"))] |
| 103 | let clock_adjuster: ClockAdjuster<KAPIClockAdjuster> = |
| 104 | ClockAdjuster::new(KAPIClockAdjuster); |
| 105 | #[cfg(feature = "test-side-by-side")] |
| 106 | let clock_adjuster: ClockAdjuster<NoopClockAdjuster> = |
| 107 | ClockAdjuster::new(NoopClockAdjuster); |
| 108 | |
| 109 | Self::new( |
| 110 | Box::new(clock_state_writer), |
| 111 | Box::new(clock_adjuster), |
| 112 | clock_params_receiver, |
| 113 | clock_disruption_receiver, |
| 114 | cancellation_token, |
| 115 | ) |
| 116 | } |
| 117 | |
| 118 | pub async fn run(&mut self) { |
| 119 | let mut clock_offset_metric_interval = |
nothing calls this directly
no test coverage detected