pub struct Storage { /* private fields */ }Implementations§
Source§impl Storage
impl Storage
pub fn open<P: AsRef<Path>>(path: P) -> Result<Self, Culprit<StorageErr>>
pub fn open_temporary() -> Result<Self, Culprit<StorageErr>>
Sourcepub fn local_changeset(&self) -> &ChangeSet<VolumeId>
pub fn local_changeset(&self) -> &ChangeSet<VolumeId>
Access the local commit changeset. This ChangeSet is updated whenever a
Volume receives a local commit.
Sourcepub fn remote_changeset(&self) -> &ChangeSet<VolumeId>
pub fn remote_changeset(&self) -> &ChangeSet<VolumeId>
Access the remote commit changeset. This ChangeSet is updated whenever a
Volume receives a remote commit.
Sourcepub fn set_volume_config(
&self,
vid: &VolumeId,
config: VolumeConfig,
) -> Result<(), Culprit<StorageErr>>
pub fn set_volume_config( &self, vid: &VolumeId, config: VolumeConfig, ) -> Result<(), Culprit<StorageErr>>
Set the specified Volume’s config
Sourcepub fn update_volume_config<F>(
&self,
vid: &VolumeId,
f: F,
) -> Result<(), Culprit<StorageErr>>
pub fn update_volume_config<F>( &self, vid: &VolumeId, f: F, ) -> Result<(), Culprit<StorageErr>>
Update a Volume’s config
pub fn get_volume_status( &self, vid: &VolumeId, ) -> Result<VolumeStatus, Culprit<StorageErr>>
pub fn volume_state( &self, vid: &VolumeId, ) -> Result<VolumeState, Culprit<StorageErr>>
pub fn snapshot( &self, vid: &VolumeId, ) -> Result<Option<Snapshot>, Culprit<StorageErr>>
pub fn iter_volumes( &self, ) -> impl TryIterator<Ok = VolumeState, Err = Culprit<StorageErr>>
pub fn volume_exists(&self, vid: VolumeId) -> Result<bool, Culprit<StorageErr>>
pub fn query_volumes( &self, sync: SyncDirection, vids: Option<HashSet<VolumeId>>, ) -> impl TryIterator<Ok = VolumeState, Err = Culprit<StorageErr>>
Sourcepub fn query_pages<'a, I>(
&self,
vid: &'a VolumeId,
lsn: LSN,
pages: I,
) -> impl TryIterator<Ok = (PageIdx, Option<PageValue>), Err = Culprit<StorageErr>> + 'a
pub fn query_pages<'a, I>( &self, vid: &'a VolumeId, lsn: LSN, pages: I, ) -> impl TryIterator<Ok = (PageIdx, Option<PageValue>), 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.
Sourcepub fn read(
&self,
vid: &VolumeId,
lsn: LSN,
pageidx: PageIdx,
) -> Result<(LSN, PageValue), Culprit<StorageErr>>
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.
pub fn commit( &self, vid: &VolumeId, snapshot: Option<Snapshot>, pages: impl Into<PageCount>, memtable: Memtable, ) -> Result<Snapshot, Culprit<StorageErr>>
Sourcepub fn receive_remote_commit(
&self,
vid: &VolumeId,
remote_snapshot: Snapshot,
changed: SplinterRef<Bytes>,
) -> Result<(), Culprit<StorageErr>>
pub fn receive_remote_commit( &self, vid: &VolumeId, remote_snapshot: Snapshot, changed: SplinterRef<Bytes>, ) -> Result<(), Culprit<StorageErr>>
Replicate a remote commit to local storage.
Sourcepub fn receive_pages(
&self,
vid: &VolumeId,
pages: HashMap<PageIdx, (LSN, PageValue)>,
) -> Result<(), Culprit<StorageErr>>
pub fn receive_pages( &self, vid: &VolumeId, pages: HashMap<PageIdx, (LSN, PageValue)>, ) -> Result<(), Culprit<StorageErr>>
Write a set of PageValue’s to storage.
Sourcepub 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>>
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
Sourcepub fn rejected_sync_to_remote(
&self,
vid: &VolumeId,
) -> Result<(), Culprit<StorageErr>>
pub fn rejected_sync_to_remote( &self, vid: &VolumeId, ) -> Result<(), Culprit<StorageErr>>
Update storage after a rejected sync
Sourcepub fn complete_sync_to_remote(
&self,
vid: &VolumeId,
remote_snapshot: Snapshot,
synced_lsns: RangeInclusive<LSN>,
) -> Result<(), Culprit<StorageErr>>
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.
Sourcepub fn reset_volume_to_remote(
&self,
vid: &VolumeId,
remote_snapshot: Snapshot,
remote_graft: SplinterRef<Bytes>,
) -> Result<(), Culprit<StorageErr>>
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§
Auto Trait Implementations§
impl !Freeze for Storage
impl !RefUnwindSafe for Storage
impl Send for Storage
impl Sync for Storage
impl Unpin for Storage
impl UnsafeUnpin for Storage
impl !UnwindSafe for Storage
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
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