pub struct SharedCell<T: Copy + 'static> { /* private fields */ }Implementations§
Sourcepub fn create(path: impl AsRef<Path>) -> Result<Self, SharedCellError>
pub fn create(path: impl AsRef<Path>) -> Result<Self, SharedCellError>
Obtain the cell at path, initializing an empty one if the path
does not yet exist and attaching to it if it does. Attaching
leaves the current value and version in place; a region built
for a different payload type is a LayoutMismatch.
reset reinitializes.
Sourcepub fn reset(path: impl AsRef<Path>) -> Result<Self, SharedCellError>
pub fn reset(path: impl AsRef<Path>) -> Result<Self, SharedCellError>
Truncate the cell at path and initialize an empty one,
discarding whatever value a live peer holds. For a caller that
knows it owns the path.
pub fn open(path: impl AsRef<Path>) -> Result<Self, SharedCellError>
Sourcepub fn set(&self, value: T)
pub fn set(&self, value: T)
Atomically replace the cell value. SeqLock protocol: odd version during the memcpy, even after.
Sourcepub fn get(&self) -> T
pub fn get(&self) -> T
Read the current value via the SeqLock retry loop. Always returns; the loop is bounded by writer frequency.
pub fn version(&self) -> u32
Sourcepub fn flush_async(&self) -> Result<(), SharedCellError>
pub fn flush_async(&self) -> Result<(), SharedCellError>
Non-blocking flush: schedules a writeback via the OS. Note: Windows is only partially async (sync to page cache, not to disk).
pub fn flush(&self) -> Result<(), SharedCellError>
Trait Implementations§
fn header(&self) -> &HandshakeHeader
fn ring(&self) -> &ObservationRing
fn make_policy(&self) -> Box<dyn Policy>
Source§fn apply_migration(&self, new_tag: u32)
fn apply_migration(&self, new_tag: u32)
Called by the sidecar when the policy returns a new strategy
tag. Default implementation: just set the tag on the header.
Primitives that need heavier migration (data-layout swap)
override this to perform the swap before (or after) updating
the tag.
Auto Trait Implementations§
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
Mutably borrows from an owned value. Read more