Skip to main content

RebuildDatabase

Struct RebuildDatabase 

Source
pub struct RebuildDatabase { /* private fields */ }
Expand description

A rebuild’s store, open at the version its circle is at. Its owner is the only one that writes to it or closes it; discard closes it and removes its folder.

Implementations§

Source§

impl RebuildDatabase

Source

pub async fn migrate_store_to( &mut self, circle: Audience, version: u32, ) -> Result<(), RebuildError>

Migrate the rebuild’s store, which holds only the store, up to version, the version of the circle about to load, with no migration write: the store’s changes come only from the store, so the rows are the ones every device that raised the store to version made, and the device’s own marker belongs to the migration past it (§18.3). The store is closed and opened again with the app’s migrations before the first breaking one past version.

A failure removes the rebuild’s folder, as open_rebuild does.

Source

pub async fn migrate(&mut self, header: WriteHeader) -> Result<(), RebuildError>

Run the app’s migrations the rebuild’s store hasn’t, in one run, the breaking ones making the migration write header and not a new one: the device’s migration write for this rebuild, which read the circle through the slot the store has applied (§18.3). The store is closed and opened again at the app’s newest version; the per-audience check of the run’s reads (§18.3) runs here as on any breaking open.

A failure removes the rebuild’s folder, as open_rebuild does; the caller’s discard after it finds nothing left.

Source

pub async fn export( self, id: SnapshotId, key: KeyId, into: &StoreDatabase, ) -> Result<SnapshotStaging, RebuildError>

Stage the circle’s counted state at the slot the rebuild’s store has applied into into as the snapshot id, sealed under key, then remove the rebuild (§18.3). The rows are the circle’s, migrated, as a device that held the circle and migrated would write them; the raise captures the rebuild’s store made are not consulted, since it sends nothing. Returns the staging, finished, for the caller to load; on a failure the rebuild is removed, nothing stays staged in into and the failure is returned.

Source§

impl RebuildDatabase

Source

pub async fn stage_snapshot( &self, id: SnapshotId, prefix: SnapshotObjectPrefix, ) -> Result<SnapshotStaging, DbError>

Begin staging a snapshot into the rebuild’s store (§16.2).

Source

pub async fn load<P: PendingValue, W>( &self, reload: SnapshotReload<SnapshotStaging, DownloadedWriteStream<W>>, store_through: u64, ) -> Result<Vec<LoadedSnapshot>, DbError>
where W: Read + Send + 'static,

Load snapshots staged here and the slots after them into the rebuild’s store, as a device loads them (§16.2).

The store’s parts in slots after store_through aren’t read: past the slot before the store’s raise beyond the circle’s version, the store holds no rows at the circle’s version. A write above the rebuild’s version is kept as a frozen lost value naming the breaking version it needs, not waited for (§18.3).

Source

pub async fn discard(self) -> Result<(), RebuildError>

Close the rebuild’s store and remove its folder with its row in the real store’s coven_library_bytes, reporting the first failure (both, as Cleanup, when both fail).

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
§

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

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

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

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

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

Source§

type Output = T

Should always be Self
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.
§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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