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
impl ReplacementStore
Sourcepub fn device_reset(&self) -> DeviceReset
pub fn device_reset(&self) -> DeviceReset
The installation being replaced and its fresh successor.
Sourcepub fn is_swapped(&self) -> bool
pub fn is_swapped(&self) -> bool
Whether the new installation has taken the store’s place.
Sourcepub fn directory(&self) -> StoreDir
pub fn directory(&self) -> StoreDir
Where the new installation is: its hidden directory while it loads,
then the store’s own, unpublished until publish.
Sourcepub fn discarded_database_path(&self) -> PathBuf
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.
Sourcepub fn is_recorded(&self) -> bool
pub fn is_recorded(&self) -> bool
Whether the replacement is recorded: past its point of no return.
Sourcepub fn record(&self, name: String) -> Result<(), BootstrapDirectoryError>
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.
Sourcepub fn swap(&self, name: String) -> Result<(), BootstrapDirectoryError>
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.
Sourcepub fn abandon(self) -> Result<(), BootstrapDirectoryError>
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.
Sourcepub async fn remove_replaced(&self) -> Result<(), BootstrapDirectoryError>
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.
Sourcepub fn publish(&self) -> Result<(), BootstrapDirectoryError>
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.
Sourcepub fn cancel(self) -> Result<(), BootstrapDirectoryError>
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.