pub enum StorageError {
Show 13 variants
Corrupted(String),
DatabaseNotFound(PathBuf),
DatabaseLocked,
Transaction(String),
Serialization(String),
Redb(String),
SchemaVersionMismatch {
expected: u32,
found: u32,
},
TableNotFound(String),
SubstrateUpgradeRequired {
found: u8,
current: u8,
},
SubstrateFormatTooNew {
found: u8,
current: u8,
},
SubstrateMigrationTooLarge {
store_size: u64,
projected_peak: u64,
budget: u64,
},
SubstrateMigrationInsufficientDisk {
store_size: u64,
required: u64,
available: u64,
},
SubstrateMigrationRequiresSync,
}Expand description
Storage-related errors.
These errors indicate problems with the underlying storage layer.
Variants§
Corrupted(String)
Database file or data is corrupted.
DatabaseNotFound(PathBuf)
Database file not found at expected path.
DatabaseLocked
Database is locked by another process.
Transaction(String)
Transaction failed (commit, rollback, etc.).
Serialization(String)
Serialization/deserialization error.
Redb(String)
Error from the redb storage engine.
SchemaVersionMismatch
Database schema version doesn’t match expected version.
TableNotFound(String)
Table not found in database.
SubstrateUpgradeRequired
The database was written by an older substrate format and must be migrated before it can be opened.
The substrate format is the storage-substrate axis (redb file format +
value serializer), distinct from the logical schema_version. This is the
typed, actionable signal a guided migration keys off — it must never be a
raw redb UpgradeRequired or a bincode decode panic leaking through.
A writable open of such a store migrates automatically (the migration gate is wired in a later work item); this error is surfaced only when migration cannot proceed (e.g. a read-only open).
Fields
SubstrateFormatTooNew
The database was written by a newer PulseDB whose substrate format is ahead of this build — a forward-incompatibility.
This build must not touch the file: doing so risks silent corruption.
Upgrade PulseDB to a version that understands substrate format found.
Fields
SubstrateMigrationTooLarge
The bincode→postcard codec migration cannot run as a single transaction because the store is larger than the safe single-txn ceiling, and no declared available-memory budget (or a too-small one) authorizes it.
This is the fail-closed-above-floor valve (VS-4.0.3 work-1.04 §6.4):
rather than risk an OOM mid-migration (which would leave the migration
unfinishable) or ship a half-correct phased path, the codec pass refuses
with zero destructive writes. The caller can either declare an
available-memory budget via Config to raise the single-txn ceiling, or
use the offline pulsedb migrate tool (VS-4.0.4) for very large stores.
store_size is the on-disk file size at open; projected_peak is the
conservative peak-RSS estimate (store_size × coefficient); budget is
the single-txn ceiling that was exceeded.
Fields
SubstrateMigrationInsufficientDisk
The bincode→postcard codec migration cannot run because there is not enough
free disk space to hold the pristine .pre-substrate.bak backup plus the
migrated file plus a redb transaction-growth margin.
This is the disk axis of the unified headroom preflight (VS-4.0.3
work-1.05 / audit C3), the companion of Self::SubstrateMigrationTooLarge
(the memory axis). The pristine backup taken before any destructive write
(.pre-substrate.bak) roughly doubles the on-disk footprint, and the
postcard re-encode does not shrink the size-dominant Vec<f32> embedding
table, so the migrated file is conservatively assumed to be ~1× the store
size. The preflight fails here with zero destructive writes (no
half-migration that runs the disk out mid-pass) rather than risk an
unfinishable migration. Free up disk, or run the offline pulsedb migrate
tool (VS-4.0.4) for very large stores.
store_size is the on-disk file size at open; required is the conservative
free-space estimate (backup ≈ store_size + migrated ≈ store_size + redb
txn-growth margin); available is the free space observed on the store’s
filesystem at open.
Fields
SubstrateMigrationRequiresSync
The bincode→postcard codec migration was attempted by a build without the
sync feature, but the database contains sync_cursors rows written by a
prior sync-enabled build. Those rows can only be re-encoded by a build that
knows the SyncCursor type, so completing the migration here would leave them
bincode-encoded under a postcard marker — silent corruption a later sync build
would hit reading them as postcard. The migration fails closed with no marker
bump (the store stays re-migratable) so a sync-enabled build can finish it.
Implementations§
Source§impl StorageError
impl StorageError
Sourcepub fn corrupted(msg: impl Into<String>) -> Self
pub fn corrupted(msg: impl Into<String>) -> Self
Creates a corruption error with the given message.
Sourcepub fn transaction(msg: impl Into<String>) -> Self
pub fn transaction(msg: impl Into<String>) -> Self
Creates a transaction error with the given message.
Sourcepub fn serialization(msg: impl Into<String>) -> Self
pub fn serialization(msg: impl Into<String>) -> Self
Creates a serialization error with the given message.
Sourcepub fn substrate_upgrade_required(found: u8, current: u8) -> Self
pub fn substrate_upgrade_required(found: u8, current: u8) -> Self
Creates a substrate-upgrade-required error.
found is the substrate format stored in the database (0 = pre-4.0
bincode era), current is the format this build writes.
Sourcepub fn substrate_format_too_new(found: u8, current: u8) -> Self
pub fn substrate_format_too_new(found: u8, current: u8) -> Self
Creates a substrate-format-too-new error (forward-incompatibility).
Sourcepub fn substrate_migration_too_large(
store_size: u64,
projected_peak: u64,
budget: u64,
) -> Self
pub fn substrate_migration_too_large( store_size: u64, projected_peak: u64, budget: u64, ) -> Self
Creates a substrate-migration-too-large error (single-txn ceiling exceeded).
Sourcepub fn substrate_migration_insufficient_disk(
store_size: u64,
required: u64,
available: u64,
) -> Self
pub fn substrate_migration_insufficient_disk( store_size: u64, required: u64, available: u64, ) -> Self
Creates a substrate-migration-insufficient-disk error (disk-headroom axis).
Trait Implementations§
Source§impl Debug for StorageError
impl Debug for StorageError
Source§impl Display for StorageError
impl Display for StorageError
Source§impl Error for StorageError
impl Error for StorageError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<CommitError> for StorageError
impl From<CommitError> for StorageError
Source§fn from(err: CommitError) -> Self
fn from(err: CommitError) -> Self
Source§impl From<DatabaseError> for StorageError
impl From<DatabaseError> for StorageError
Source§fn from(err: DatabaseError) -> Self
fn from(err: DatabaseError) -> Self
Source§impl From<Error> for StorageError
impl From<Error> for StorageError
Source§impl From<Error> for StorageError
impl From<Error> for StorageError
Source§impl From<StorageError> for PulseDBError
impl From<StorageError> for PulseDBError
Source§fn from(source: StorageError) -> Self
fn from(source: StorageError) -> Self
Source§impl From<StorageError> for StorageError
impl From<StorageError> for StorageError
Source§fn from(err: StorageError) -> Self
fn from(err: StorageError) -> Self
Source§impl From<TableError> for StorageError
impl From<TableError> for StorageError
Source§fn from(err: TableError) -> Self
fn from(err: TableError) -> Self
Source§impl From<TransactionError> for StorageError
impl From<TransactionError> for StorageError
Source§fn from(err: TransactionError) -> Self
fn from(err: TransactionError) -> Self
Auto Trait Implementations§
impl Freeze for StorageError
impl RefUnwindSafe for StorageError
impl Send for StorageError
impl Sync for StorageError
impl Unpin for StorageError
impl UnsafeUnpin for StorageError
impl UnwindSafe for StorageError
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more