pub struct DurabilityContract {
pub level: DurabilityLevel,
pub archive: WalArchiveConfig,
pub checkpoint: CheckpointConfig,
/* private fields */
}Expand description
Durability contract that enforces ARIES invariants
Fields§
§level: DurabilityLevelConfigured durability level
archive: WalArchiveConfigWAL archive configuration
checkpoint: CheckpointConfigCheckpoint configuration
Implementations§
Source§impl DurabilityContract
impl DurabilityContract
Sourcepub fn new(level: DurabilityLevel) -> Result<Self, DurabilityContractError>
pub fn new(level: DurabilityLevel) -> Result<Self, DurabilityContractError>
Create a new durability contract with safe defaults
Sourcepub fn production() -> Self
pub fn production() -> Self
Create with production defaults
Sourcepub fn with_archive(self, config: WalArchiveConfig) -> Self
pub fn with_archive(self, config: WalArchiveConfig) -> Self
Enable WAL archiving
Sourcepub fn with_checkpoint(self, config: CheckpointConfig) -> Self
pub fn with_checkpoint(self, config: CheckpointConfig) -> Self
Configure checkpointing
Sourcepub fn validate_page_flush(
&self,
page_lsn: u64,
flushed_lsn: u64,
) -> Result<(), DurabilityContractError>
pub fn validate_page_flush( &self, page_lsn: u64, flushed_lsn: u64, ) -> Result<(), DurabilityContractError>
Validate that a page flush respects WAL protocol
ARIES invariant: Page cannot be flushed until its log record is durable
Sourcepub fn validate_commit(
&self,
commit_lsn: u64,
flushed_lsn: u64,
) -> Result<(), DurabilityContractError>
pub fn validate_commit( &self, commit_lsn: u64, flushed_lsn: u64, ) -> Result<(), DurabilityContractError>
Validate that a commit respects force-on-commit
ARIES invariant: Commit record must be durable before returning
Sourcepub fn max_data_loss_window(&self) -> Option<Duration>
pub fn max_data_loss_window(&self) -> Option<Duration>
Get maximum data loss window based on durability level
Sourcepub fn is_production_ready(&self) -> bool
pub fn is_production_ready(&self) -> bool
Check if this contract is suitable for production
Sourcepub fn describe_guarantees(&self) -> String
pub fn describe_guarantees(&self) -> String
Generate a human-readable description of guarantees
Trait Implementations§
Auto Trait Implementations§
impl Freeze for DurabilityContract
impl RefUnwindSafe for DurabilityContract
impl Send for DurabilityContract
impl Sync for DurabilityContract
impl Unpin for DurabilityContract
impl UnsafeUnpin for DurabilityContract
impl UnwindSafe for DurabilityContract
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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 more