Skip to main content

AutonomyStore

Trait AutonomyStore 

Source
pub trait AutonomyStore: Send + Sync {
    // Required methods
    fn get<'life0, 'life1, 'async_trait>(
        &'life0 self,
        site: Uuid,
        job: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<JobAutonomy>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn list<'life0, 'async_trait>(
        &'life0 self,
        site: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<JobAutonomy>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn apply<'life0, 'async_trait>(
        &'life0 self,
        record: JobAutonomy,
        change: AutonomyChange,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn history<'life0, 'life1, 'async_trait>(
        &'life0 self,
        site: Uuid,
        job: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<AutonomyChange>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn record_decision<'life0, 'async_trait>(
        &'life0 self,
        decision: JobDecision,
    ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn decisions<'life0, 'life1, 'async_trait>(
        &'life0 self,
        site: Uuid,
        job: &'life1 str,
        since: DateTime<Utc>,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<JobDecision>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Every job’s autonomy, its history and the owner’s decisions on its proposals (spec 3.5 §7.11), on in-memory, SQLite, PostgreSQL and Redis.

apply is a compare-and-set on the job’s revision, so two replicas changing one job move it once.

Required Methods§

Source

fn get<'life0, 'life1, 'async_trait>( &'life0 self, site: Uuid, job: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<JobAutonomy>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The job’s autonomy, or None for a job never registered.

§Errors

Returns KernelError::Store when the backend fails.

Source

fn list<'life0, 'async_trait>( &'life0 self, site: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<JobAutonomy>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Every job of the site, by job id.

§Errors

Returns KernelError::Store when the backend fails.

Source

fn apply<'life0, 'async_trait>( &'life0 self, record: JobAutonomy, change: AutonomyChange, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Writes record and appends change when record.revision is one past the stored revision (1 for a job with none) and change makes that revision; false, writing nothing, otherwise.

§Errors

Returns KernelError::Config when change does not match record, or KernelError::Store when the backend fails.

Source

fn history<'life0, 'life1, 'async_trait>( &'life0 self, site: Uuid, job: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<AutonomyChange>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The job’s changes, oldest first.

§Errors

Returns KernelError::Store when the backend fails.

Source

fn record_decision<'life0, 'async_trait>( &'life0 self, decision: JobDecision, ) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Records decision; false when the job already has a decision with its id.

§Errors

Returns KernelError::Store when the backend fails.

Source

fn decisions<'life0, 'life1, 'async_trait>( &'life0 self, site: Uuid, job: &'life1 str, since: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = Result<Vec<JobDecision>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

The job’s decisions made at or after since, oldest first (by time, then id).

§Errors

Returns KernelError::Store when the backend fails.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§