Skip to main content

BacktestStore

Trait BacktestStore 

Source
pub trait BacktestStore: Send + Sync {
    // Required methods
    fn save_definition<'life0, 'life1, 'async_trait>(
        &'life0 self,
        context: &'life1 RequestContext,
        definition: BacktestDefinition,
    ) -> Pin<Box<dyn Future<Output = Result<(), BacktestStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn start_run<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        context: &'life1 RequestContext,
        definition_id: &'life2 BacktestDefinitionId,
        input_snapshot: Value,
        idempotency_key: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<BacktestRunId, BacktestStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn get_run<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        context: &'life1 RequestContext,
        run_id: &'life2 BacktestRunId,
    ) -> Pin<Box<dyn Future<Output = Result<BacktestRun, BacktestStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn cancel_run<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        context: &'life1 RequestContext,
        run_id: &'life2 BacktestRunId,
    ) -> Pin<Box<dyn Future<Output = Result<(), BacktestStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn complete_run<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        context: &'life1 RequestContext,
        run_id: &'life2 BacktestRunId,
        report: Value,
        max_bytes: usize,
    ) -> Pin<Box<dyn Future<Output = Result<(), BacktestStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn fail_run<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        context: &'life1 RequestContext,
        run_id: &'life2 BacktestRunId,
        message: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<(), BacktestStoreError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
}
Expand description

Durable persistence port for definitions, snapshots, runs and bounded reports.

Required Methods§

Source

fn save_definition<'life0, 'life1, 'async_trait>( &'life0 self, context: &'life1 RequestContext, definition: BacktestDefinition, ) -> Pin<Box<dyn Future<Output = Result<(), BacktestStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Save or replace a tenant-owned definition.

Source

fn start_run<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, context: &'life1 RequestContext, definition_id: &'life2 BacktestDefinitionId, input_snapshot: Value, idempotency_key: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<BacktestRunId, BacktestStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Freeze definition and input under an owner-scoped key; retries return the original Run.

Source

fn get_run<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, context: &'life1 RequestContext, run_id: &'life2 BacktestRunId, ) -> Pin<Box<dyn Future<Output = Result<BacktestRun, BacktestStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Read a Run and its immutable snapshots, enforcing tenant and subject ownership.

Source

fn cancel_run<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, context: &'life1 RequestContext, run_id: &'life2 BacktestRunId, ) -> Pin<Box<dyn Future<Output = Result<(), BacktestStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Atomically cancel a running Run; repeating cancellation is safe.

Source

fn complete_run<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, context: &'life1 RequestContext, run_id: &'life2 BacktestRunId, report: Value, max_bytes: usize, ) -> Pin<Box<dyn Future<Output = Result<(), BacktestStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Complete a run with a report below max_bytes.

Source

fn fail_run<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, context: &'life1 RequestContext, run_id: &'life2 BacktestRunId, message: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<(), BacktestStoreError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Preserve a terminal failure for recovery diagnostics.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§