Expand description
§Sentinel WAL (Write-Ahead Logging)
This crate implements the Write-Ahead Logging (WAL) functionality for Cyberpath Sentinel. WAL ensures durability and crash recovery by logging all changes before they are applied to the filesystem.
§Architecture
The WAL consists of log entries written to a binary file. Each entry contains:
- Entry type (1 byte)
- Transaction ID (32 bytes, fixed length, padded cuid2)
- Collection name (variable, multiple of 16 bytes, max 256)
- Document ID (variable, multiple of 16 bytes, max 256)
- Timestamp (8 bytes, u64)
- Data length (8 bytes)
- Data (variable length, JSON string)
- CRC32 checksum (4 bytes)
§Features
- Postcard serialization for efficiency and maintainability
- CRC32 checksums for integrity
- Asynchronous I/O operations
- Checkpoint mechanism for log compaction
- Crash recovery via log replay
Re-exports§
pub use error::WalError;pub use entry::EntryType;pub use entry::FixedBytes256;pub use entry::FixedBytes32;pub use entry::LogEntry;pub use manager::WalConfig;pub use manager::WalFormat;pub use manager::WalManager;pub use config::CollectionWalConfig;pub use config::CollectionWalConfigOverrides;pub use config::StoreWalConfig;pub use config::WalFailureMode;pub use traits::WalDocumentOps;pub use verification::verify_wal_consistency;pub use verification::WalVerificationIssue;pub use verification::WalVerificationResult;pub use recovery::recover_from_wal_force;pub use recovery::recover_from_wal_safe;pub use recovery::WalRecoveryFailure;pub use recovery::WalRecoveryResult;pub use postcard;pub use cuid2;pub use compression::*;
Modules§
- compression
- Compression algorithms for WAL file rotation
- config
- WAL configuration structures and operational modes.
- entry
- WAL log entry types and structures
- error
- Error types for WAL operations
- manager
- WAL manager for handling log operations
- recovery
- WAL recovery functionality.
- traits
- Traits for WAL operations that require document access
- verification
- WAL verification functionality.
Type Aliases§
- Result
- Result type for WAL operations