pub struct MappedSnapshotWriter { /* private fields */ }Expand description
Writable file mapping of a shared consciousness snapshot (single writer).
Implementations§
Source§impl MappedSnapshotWriter
impl MappedSnapshotWriter
Sourcepub fn create(path: &Path) -> Result<Self, String>
pub fn create(path: &Path) -> Result<Self, String>
Create (or truncate) the snapshot file and initialize its header.
Sourcepub fn open_or_create(path: &Path) -> Result<Self, String>
pub fn open_or_create(path: &Path) -> Result<Self, String>
Open an existing snapshot file for writing, or create a fresh one — without truncating an existing live mapping.
This is what stream processes use: a second instance must never clobber
the file out from under the first process’s mmap (truncating a mapped
file invalidates the other mapping and can crash it). Each whole-copy
write() is published under one odd/even seqlock window, so even
concurrent writers produce complete, non-torn snapshots.
Sourcepub fn write(&self, data: &SnapshotData) -> Result<(), String>
pub fn write(&self, data: &SnapshotData) -> Result<(), String>
Publish a full SnapshotData and flush the mapping.
Sourcepub fn begin_write(&self) -> Result<u64, String>
pub fn begin_write(&self) -> Result<u64, String>
Begin an in-place write (mirrors SharedSnapshot::begin_write).
Sourcepub unsafe fn data_mut(&self) -> &mut SnapshotData
pub unsafe fn data_mut(&self) -> &mut SnapshotData
Exclusive data access while the seqlock is held.
§Safety
Caller must hold the seqlock (begin_write, not yet end_write).
Auto Trait Implementations§
impl !RefUnwindSafe for MappedSnapshotWriter
impl !UnwindSafe for MappedSnapshotWriter
impl Freeze for MappedSnapshotWriter
impl Send for MappedSnapshotWriter
impl Sync for MappedSnapshotWriter
impl Unpin for MappedSnapshotWriter
impl UnsafeUnpin for MappedSnapshotWriter
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more