Skip to main content

Slot

Struct Slot 

Source
pub struct Slot<P: Platform> { /* private fields */ }
Expand description

A small object (a manifest, a superblock) committed atomically: after any crash it reads back as exactly the old or exactly the new version.

One commit is one block write plus one barrier. Commits to one slot are serialised (at most one slot write in flight).

Implementations§

Source§

impl<P: Platform> Slot<P>
where P::Queue: Send,

Source

pub fn set_force_data_sync(&self, on: bool)

Makes every barrier on this region (for a slot, every commit; and Submitter::barrier_all) issue the OS data sync (fdatasync, FlushFileBuffers), even on a power-safe store, where writes are durable at completion and a barrier is otherwise free; receipts then report data_synced. For data whose durability should not rest on a power-safe classification alone: a device trusted as power-safe that still reports a volatile write cache has that cache flushed. (On a device with no volatile cache the OS has nothing to send it: the data is on media already. On Windows every power-safe write is already followed by a data flush, so forcing adds one.) It applies to every handle and generation of the region, but is not stored: set it again after each open.

Source

pub fn force_data_sync(&self) -> bool

Whether barriers on this region always flush (see Self::set_force_data_sync).

Source§

impl<P: Platform> Slot<P>
where P::Queue: Send,

Source

pub fn capacity(&self) -> usize

Largest payload a commit accepts.

Source

pub fn read(&self) -> Option<Vec<u8>>

The current committed object, or None if never committed.

Generation 1 of the slot pair is the provisioning header; commits start at generation 2.

Source

pub fn commit(&self, data: &[u8]) -> Result<DurableReceipt, Error>

Commits a new version of the object.

The receipt’s generation counts commits (the slot pair’s generation: 2 for the first). In format 2 a slot region also has a region generation, in its header, which a commit leaves as it is (only a recycle moves a region generation on, and slots are never recycled).

§Errors

NotWritten(TooLarge) beyond Self::capacity, Io if the store’s queue could not be prepared (nothing was written), Poisoned, or DurabilityUnknown (the domain is now poisoned).

Trait Implementations§

Source§

impl<P: Platform> Clone for Slot<P>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<P: Platform> Debug for Slot<P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<P> !RefUnwindSafe for Slot<P>

§

impl<P> !UnwindSafe for Slot<P>

§

impl<P> Forget for Slot<P>

§

impl<P> Freeze for Slot<P>
where Store<P>: Freeze,

§

impl<P> Move for Slot<P>

§

impl<P> Send for Slot<P>
where Store<P>: Send,

§

impl<P> Sync for Slot<P>
where Store<P>: Sync,

§

impl<P> Unpin for Slot<P>
where Store<P>: Unpin,

§

impl<P> UnsafeUnpin for Slot<P>
where Store<P>: UnsafeUnpin,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.