Skip to main content

TaskAttributionStore

Trait TaskAttributionStore 

Source
pub trait TaskAttributionStore: Send + Sync {
    // Required methods
    fn insert<'a>(
        &'a self,
        tenant_id: &'a str,
        task_id: &'a str,
        attribution: TaskAttribution,
    ) -> Pin<Box<dyn Future<Output = Result<(), TaskStoreError>> + Send + 'a>>;
    fn get<'a>(
        &'a self,
        tenant_id: &'a str,
        task_id: &'a str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<TaskAttribution>, TaskStoreError>> + Send + 'a>>;
    fn claim<'a>(
        &'a self,
        tenant_id: &'a str,
        task_id: &'a str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<TaskAttribution>, TaskStoreError>> + Send + 'a>>;
    fn remove<'a>(
        &'a self,
        tenant_id: &'a str,
        task_id: &'a str,
    ) -> Pin<Box<dyn Future<Output = Result<(), TaskStoreError>> + Send + 'a>>;
}
Expand description

Persists pre-priced, non-identifying attribution under a durable task ID.

Required Methods§

Source

fn insert<'a>( &'a self, tenant_id: &'a str, task_id: &'a str, attribution: TaskAttribution, ) -> Pin<Box<dyn Future<Output = Result<(), TaskStoreError>> + Send + 'a>>

Associate a task with its resolved price and fixed origin category.

Source

fn get<'a>( &'a self, tenant_id: &'a str, task_id: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Option<TaskAttribution>, TaskStoreError>> + Send + 'a>>

Resolve an association without consuming it.

Source

fn claim<'a>( &'a self, tenant_id: &'a str, task_id: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Option<TaskAttribution>, TaskStoreError>> + Send + 'a>>

Atomically consume and return an association.

A completed durable task can be returned by many later polls. Using this operation before recording usage guarantees that only one process can account for that task.

Source

fn remove<'a>( &'a self, tenant_id: &'a str, task_id: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), TaskStoreError>> + Send + 'a>>

Remove an association after a terminal task is accounted for.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl TaskAttributionStore for PostgresTaskStore

Source§

fn insert<'a>( &'a self, tenant_id: &'a str, task_id: &'a str, attribution: TaskAttribution, ) -> Pin<Box<dyn Future<Output = Result<(), TaskStoreError>> + Send + 'a>>

Source§

fn get<'a>( &'a self, tenant_id: &'a str, task_id: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Option<TaskAttribution>, TaskStoreError>> + Send + 'a>>

Source§

fn claim<'a>( &'a self, tenant_id: &'a str, task_id: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Option<TaskAttribution>, TaskStoreError>> + Send + 'a>>

Source§

fn remove<'a>( &'a self, tenant_id: &'a str, task_id: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), TaskStoreError>> + Send + 'a>>

Source§

impl TaskAttributionStore for RedisTaskStore

Source§

fn insert<'a>( &'a self, tenant_id: &'a str, task_id: &'a str, attribution: TaskAttribution, ) -> Pin<Box<dyn Future<Output = Result<(), TaskStoreError>> + Send + 'a>>

Source§

fn get<'a>( &'a self, tenant_id: &'a str, task_id: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Option<TaskAttribution>, TaskStoreError>> + Send + 'a>>

Source§

fn claim<'a>( &'a self, tenant_id: &'a str, task_id: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Option<TaskAttribution>, TaskStoreError>> + Send + 'a>>

Source§

fn remove<'a>( &'a self, tenant_id: &'a str, task_id: &'a str, ) -> Pin<Box<dyn Future<Output = Result<(), TaskStoreError>> + Send + 'a>>

Implementors§