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

Method new_with_max_version_unchecked

clock-bound/src/shm/reader.rs:205–230  ·  view source on GitHub ↗
(path: &CStr)

Source from the content-addressed store, hash-verified

203 /// returned.
204 #[expect(clippy::missing_errors_doc, reason = "todo")]
205 pub fn new_with_max_version_unchecked(path: &CStr) -> Result<(ShmReader, u16), ShmError> {
206 // Map the segment, with explicit pointers to fields
207 let (mmap_guard, version, generation, ceb_shm) = ShmReader::map_segment(path)?;
208
209 // Atomically read the current version from the shared memory segment
210 // SAFETY: `self.version` has been validated when creating the reader
211 let shm_version = unsafe { &*version };
212 let shm_version = shm_version.load(atomic::Ordering::Acquire);
213 let max_version = shm_version & 0x00ff;
214
215 let current_version =
216 ClockErrorBoundLayoutVersion::try_from(CLOCKBOUND_SHM_LATEST_VERSION)?;
217
218 Ok((
219 ShmReader {
220 _marker: std::marker::PhantomData,
221 _guard: mmap_guard,
222 version,
223 generation,
224 ceb_shm,
225 snapshot_ceb: ClockErrorBoundGeneric::builder().build(current_version),
226 snapshot_gen: 0,
227 },
228 max_version,
229 ))
230 }
231
232 /// Open and map the ClockBound shared memory segment.
233 ///

Callers

nothing calls this directly

Calls 1

buildMethod · 0.45

Tested by

no test coverage detected