Skip to main content

ReplacementStore

Struct ReplacementStore 

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

A replacement of the installation in a published store’s directory. It holds the store’s bootstrap lease, and its writer lock until the new installation is in place. Dropping it keeps its work for the next call.

Implementations§

Source§

impl ReplacementStore

Source

pub fn device_reset(&self) -> DeviceReset

The installation being replaced and its fresh successor.

Source

pub fn is_swapped(&self) -> bool

Whether the new installation has taken the store’s place.

Source

pub fn directory(&self) -> StoreDir

Where the new installation is: its hidden directory while it loads, then the store’s own, unpublished until publish.

Source

pub fn discarded_database_path(&self) -> PathBuf

The replaced installation’s database: in place while the new one loads, then in its archive. Only its operation journal is read.

Source

pub fn is_recorded(&self) -> bool

Whether the replacement is recorded: past its point of no return.

Source

pub fn record(&self, name: String) -> Result<(), BootstrapDirectoryError>

Record the replacement before its fresh device registers, naming the call that began it and the store’s name in the loaded database: from here the store refuses opens and lists as this call’s to finish, and read-only handles are kept out until the swap. A reader holding the store refuses the record, changing nothing. Recording again keeps the first record.

Source

pub fn swap(&self, name: String) -> Result<(), BootstrapDirectoryError>

Mark the swap as begun, recording the replacement first when it has no registration to precede (an unconnected reset), then move the old local state into its archive and the loaded installation into the store’s directory, keeping the store’s custody files in place. Then release the writer and reader locks: from here the marker refuses other opens. The loading database must be closed. A failure leaves the swap for the next call to finish; nothing moves back.

Source

pub fn abandon(self) -> Result<(), BootstrapDirectoryError>

End a recorded replacement before its swap, once the facts say nothing in storage names its fresh device as the old one’s active replacement: remove the record, so the old installation is the store again, then the new installation. The loading database must be closed. A failure part way leaves the new installation without its record, which the next call continues as an unrecorded load.

Source

pub async fn remove_replaced(&self) -> Result<(), BootstrapDirectoryError>

Remove the swapped-out installation’s archive before publication: a restore keeps no old copy. The archive holds the old installation’s files and cache, of any size, so the removal runs on the blocking pool (§21.2). A failure leaves the swap for the next call to finish.

Source

pub fn publish(&self) -> Result<(), BootstrapDirectoryError>

Publish the swapped installation: remove the hidden directory, then the marker, then the record. A failure before the marker leaves the swap for the next call to finish. After a Create(Published { .. }) error the store is visible.

Source

pub fn cancel(self) -> Result<(), BootstrapDirectoryError>

Remove the unrecorded replacement after its database closed, leaving the store as it was. A later call starts a new one with a fresh id.

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.

§

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

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
§

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