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

Method new_with_paths

clock-bound/src/client.rs:58–79  ·  view source on GitHub ↗

Creates and returns a new `ClockBoundClient`. The client accesses two shared memory segments. One written to by the ClockBound daemon. The second one by the VMClock device (if available). Explicitly specifies the paths to the two shared memory segments. # Errors Returns [`ClockBoundError`] if the shared memory segments cannot be open or accessed.

(
        clockbound_shm_path: &str,
        vmclock_shm_path: &str,
    )

Source from the content-addressed store, hash-verified

56 /// # Errors
57 /// Returns [`ClockBoundError`] if the shared memory segments cannot be open or accessed.
58 pub fn new_with_paths(
59 clockbound_shm_path: &str,
60 vmclock_shm_path: &str,
61 ) -> Result<ClockBoundClient, ClockBoundError> {
62 // Create the clockbound shared memory accessor
63 let mut clockbound_shm = ClockBoundSHM::new(clockbound_shm_path)?;
64
65 // Read the segment to determine whether the daemon has been instructed to provide support
66 // for clock disruption. If true, the VMClock will be accessed.
67 let cb_snapshot = clockbound_shm.snapshot()?;
68
69 // Create the VMClock shared memory accessor
70 let vmclock_shm = VMClockSHM::new(
71 vmclock_shm_path,
72 cb_snapshot.clock_disruption_support_enabled(),
73 )?;
74
75 Ok(ClockBoundClient {
76 clockbound_shm,
77 vmclock_shm,
78 })
79 }
80
81 /// Read the current time, but with a bound on accuracy and a status.
82 ///

Callers

nothing calls this directly

Calls 3

newFunction · 0.50
snapshotMethod · 0.45

Tested by

no test coverage detected