Skip to main content

Storage

Struct Storage 

Source
pub struct Storage { /* private fields */ }

Implementations§

Source§

impl Storage

Source

pub fn open<P: AsRef<Path>>(path: P) -> Result<Self, Culprit<StorageErr>>

Source

pub fn open_temporary() -> Result<Self, Culprit<StorageErr>>

Source

pub fn local_changeset(&self) -> &ChangeSet<VolumeId>

Access the local commit changeset. This ChangeSet is updated whenever a Volume receives a local commit.

Source

pub fn remote_changeset(&self) -> &ChangeSet<VolumeId>

Access the remote commit changeset. This ChangeSet is updated whenever a Volume receives a remote commit.

Source

pub fn set_volume_config( &self, vid: &VolumeId, config: VolumeConfig, ) -> Result<(), Culprit<StorageErr>>

Set the specified Volume’s config

Source

pub fn update_volume_config<F>( &self, vid: &VolumeId, f: F, ) -> Result<(), Culprit<StorageErr>>

Update a Volume’s config

Source

pub fn get_volume_status( &self, vid: &VolumeId, ) -> Result<VolumeStatus, Culprit<StorageErr>>

Source

pub fn volume_state( &self, vid: &VolumeId, ) -> Result<VolumeState, Culprit<StorageErr>>

Source

pub fn snapshot( &self, vid: &VolumeId, ) -> Result<Option<Snapshot>, Culprit<StorageErr>>

Source

pub fn iter_volumes( &self, ) -> impl TryIterator<Ok = VolumeState, Err = Culprit<StorageErr>>

Source

pub fn volume_exists(&self, vid: VolumeId) -> Result<bool, Culprit<StorageErr>>

Source

pub fn query_volumes( &self, sync: SyncDirection, vids: Option<HashSet<VolumeId>>, ) -> impl TryIterator<Ok = VolumeState, Err = Culprit<StorageErr>>

Source

pub fn query_pages<'a, I>( &self, vid: &'a VolumeId, lsn: LSN, pages: I, ) -> impl TryIterator<Ok = (PageIdx, Option<PageValue>), Err = Culprit<StorageErr>> + 'a
where I: TryIterator<Ok = PageIdx, Err = Culprit<StorageErr>> + 'a,

Returns an iterator of PageValue’s at an exact LSN for a volume. Notably, this function will not return a page at an earlier LSN that is shadowed by this LSN.

Source

pub fn read( &self, vid: &VolumeId, lsn: LSN, pageidx: PageIdx, ) -> Result<(LSN, PageValue), Culprit<StorageErr>>

Returns the most recent visible page in a volume by LSN at a particular PageIdx. Notably, this will return a page from an earlier LSN if the page hasn’t changed since then.

Source

pub fn commit( &self, vid: &VolumeId, snapshot: Option<Snapshot>, pages: impl Into<PageCount>, memtable: Memtable, ) -> Result<Snapshot, Culprit<StorageErr>>

Source

pub fn receive_remote_commit( &self, vid: &VolumeId, remote_snapshot: Snapshot, changed: SplinterRef<Bytes>, ) -> Result<(), Culprit<StorageErr>>

Replicate a remote commit to local storage.

Source

pub fn receive_pages( &self, vid: &VolumeId, pages: HashMap<PageIdx, (LSN, PageValue)>, ) -> Result<(), Culprit<StorageErr>>

Write a set of PageValue’s to storage.

Source

pub fn prepare_sync_to_remote( &self, vid: &VolumeId, ) -> Result<(Option<LSN>, PageCount, RangeInclusive<LSN>, impl TryIterator<Ok = (LSN, SplinterRef<Slice>), Err = Culprit<StorageErr>>), Culprit<StorageErr>>

Prepare to sync a volume to the remote. Returns:

  • the last known remote LSN
  • the local page count we are syncing
  • the range of LSNs to sync
  • an iterator of commits to sync
Source

pub fn rejected_sync_to_remote( &self, vid: &VolumeId, ) -> Result<(), Culprit<StorageErr>>

Update storage after a rejected sync

Source

pub fn complete_sync_to_remote( &self, vid: &VolumeId, remote_snapshot: Snapshot, synced_lsns: RangeInclusive<LSN>, ) -> Result<(), Culprit<StorageErr>>

Complete a push operation by updating the volume snapshot and removing all synced commits.

Source

pub fn reset_volume_to_remote( &self, vid: &VolumeId, remote_snapshot: Snapshot, remote_graft: SplinterRef<Bytes>, ) -> Result<(), Culprit<StorageErr>>

Reset the volume to the provided remote snapshot. This will cause all pending commits to be rolled back and the volume status to be cleared.

Trait Implementations§

Source§

impl Debug for Storage

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

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> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,