Skip to main content

FixtureImporter

Trait FixtureImporter 

Source
pub trait FixtureImporter: Sync {
    // Required methods
    fn progress(
        &self,
        assignment: &FixtureAssignment,
    ) -> Result<Option<FixtureImportProgress>, FixtureImportError>;
    fn begin(
        &self,
        assignment: &FixtureAssignment,
    ) -> Result<(), FixtureImportError>;
    fn apply_chunk(
        &self,
        assignment: &FixtureAssignment,
        index: u32,
        bytes: &[u8],
    ) -> Result<(), FixtureImportError>;
    fn validate_step(
        &self,
        assignment: &FixtureAssignment,
    ) -> Result<(), FixtureImportError>;
}
Expand description

Synchronous application participant for bounded import and validation steps.

Register once from the existing synchronous lifecycle participant, after restoring the database. Mutating methods must commit rows and their checkpoint in one message. Canic traps a returned error or invalid postcondition to roll back that message. Each validation step must inspect bounded stored data; completion must not rescan it.

Required Methods§

Source

fn progress( &self, assignment: &FixtureAssignment, ) -> Result<Option<FixtureImportProgress>, FixtureImportError>

Read the durable checkpoint without changing it; None means not begun.

Source

fn begin( &self, assignment: &FixtureAssignment, ) -> Result<(), FixtureImportError>

Initialize an absent checkpoint for this exact assignment without wiping existing data.

Source

fn apply_chunk( &self, assignment: &FixtureAssignment, index: u32, bytes: &[u8], ) -> Result<(), FixtureImportError>

Apply one verified chunk and advance the same durable checkpoint exactly once.

Source

fn validate_step( &self, assignment: &FixtureAssignment, ) -> Result<(), FixtureImportError>

Validate a bounded portion of stored data and eventually commit the exact receipt.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§