pub struct OperationGuard { /* private fields */ }Expand description
RAII shared guard for one store operation on one database file.
Held for the duration of the operation; dropping it releases the lock.
Implementations§
Source§impl OperationGuard
impl OperationGuard
Sourcepub fn try_for_database_strict(db_path: &Path) -> Result<Self, SqliteStoreError>
pub fn try_for_database_strict(db_path: &Path) -> Result<Self, SqliteStoreError>
Require actual descriptor-scoped shared custody for online administration. Unlike ordinary I/O this has no maintenance-holder shortcut or fail-open fallback. Validate the database before creating any lock sidecar.
Sourcepub fn for_database(db_path: &Path) -> Result<Self, SqliteStoreError>
pub fn for_database(db_path: &Path) -> Result<Self, SqliteStoreError>
Acquire the shared guard for an operation on db_path.
Returns SqliteStoreError::MaintenanceFenceHeld when the exclusive
maintenance fence is held. In-memory databases and media where no
lock file can exist yield a no-op guard.
Sourcepub fn admit_missing_database(db_path: &Path) -> Result<(), SqliteStoreError>
pub fn admit_missing_database(db_path: &Path) -> Result<(), SqliteStoreError>
Admit an operation that finds db_path missing and answers without
touching it. The fence covers its database file whether or not the
file exists (an archive by rename removes the file while the fence is
held), so a missing database under the exclusive fence of another
holder fails typed with SqliteStoreError::MaintenanceFenceHeld,
as Self::for_database does. Nothing is created: the lock file is
opened only if it exists, and an absent lock file holds no fence. The
in-process fence holder is admitted, as by Self::for_database.