Database

Trait Database 

Source
pub trait Database:
    Send
    + Sync
    + 'static {
    // Required methods
    fn insert_task<'life0, 'life1, 'async_trait>(
        &'life0 self,
        task: &'life1 RequestTask,
    ) -> Pin<Box<dyn Future<Output = DatabaseResult<String>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_task<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tes_id: &'life1 str,
        params: GetTaskParams,
    ) -> Pin<Box<dyn Future<Output = DatabaseResult<TaskResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_tasks<'life0, 'async_trait>(
        &'life0 self,
        params: ListTasksParams,
    ) -> Pin<Box<dyn Future<Output = DatabaseResult<(Vec<TaskResponse>, Option<String>)>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_task_io<'life0, 'life1, 'async_trait>(
        &'life0 self,
        tes_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = DatabaseResult<TaskIo>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_in_progress_tasks<'life0, 'async_trait>(
        &'life0 self,
        before: DateTime<Utc>,
    ) -> Pin<Box<dyn Future<Output = DatabaseResult<Vec<String>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update_task_state<'a, 'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        tes_id: &'life1 str,
        state: State,
        messages: &'life2 [&'life3 str],
        containers: Option<BoxFuture<'a, Result<Vec<TerminatedContainer<'a>>>>>,
    ) -> Pin<Box<dyn Future<Output = DatabaseResult<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn append_system_log<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        tes_id: &'life1 str,
        messages: &'life2 [&'life3 str],
    ) -> Pin<Box<dyn Future<Output = DatabaseResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn update_task_output_files<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        tes_id: &'life1 str,
        files: &'life2 [OutputFile],
    ) -> Pin<Box<dyn Future<Output = DatabaseResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn insert_error<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        source: &'life1 str,
        tes_id: Option<&'life2 str>,
        message: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = DatabaseResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
}
Expand description

An abstraction for the planetary database.

Required Methods§

Source

fn insert_task<'life0, 'life1, 'async_trait>( &'life0 self, task: &'life1 RequestTask, ) -> Pin<Box<dyn Future<Output = DatabaseResult<String>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Inserts a task into the database.

Note: it is expected that the newly inserted task has the UNKNOWN state.

Returns the generated TES task identifier.

Source

fn get_task<'life0, 'life1, 'async_trait>( &'life0 self, tes_id: &'life1 str, params: GetTaskParams, ) -> Pin<Box<dyn Future<Output = DatabaseResult<TaskResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Gets a task from the database.

Source

fn get_tasks<'life0, 'async_trait>( &'life0 self, params: ListTasksParams, ) -> Pin<Box<dyn Future<Output = DatabaseResult<(Vec<TaskResponse>, Option<String>)>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets tasks from the database.

Returns a list of tasks and the page token to use for the next request.

Source

fn get_task_io<'life0, 'life1, 'async_trait>( &'life0 self, tes_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = DatabaseResult<TaskIo>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Gets the inputs and outputs of a task.

Source

fn get_in_progress_tasks<'life0, 'async_trait>( &'life0 self, before: DateTime<Utc>, ) -> Pin<Box<dyn Future<Output = DatabaseResult<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Gets the TES identifiers of in-progress tasks.

Only tasks created before the given datetime are returned.

An in-progress task is in one of the following states:

  • Unknown
  • Queued
  • Initializing
  • Running
Source

fn update_task_state<'a, 'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, tes_id: &'life1 str, state: State, messages: &'life2 [&'life3 str], containers: Option<BoxFuture<'a, Result<Vec<TerminatedContainer<'a>>>>>, ) -> Pin<Box<dyn Future<Output = DatabaseResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Updates the state of a task.

The provided message is added to the task’s system log if the task is transitioned to the given state.

The given future for retrieving the terminated containers will be called if the task is transitioned to the given state; the returned containers are then recorded in the database.

Returns Ok(true) if the status was updated or Ok(false) if the task’s current state cannot be transitioned to the given state.

Source

fn append_system_log<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, tes_id: &'life1 str, messages: &'life2 [&'life3 str], ) -> Pin<Box<dyn Future<Output = DatabaseResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Appends the given messages to the task’s system log.

Source

fn update_task_output_files<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, tes_id: &'life1 str, files: &'life2 [OutputFile], ) -> Pin<Box<dyn Future<Output = DatabaseResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Updates the output files of the given task.

Source

fn insert_error<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, source: &'life1 str, tes_id: Option<&'life2 str>, message: &'life3 str, ) -> Pin<Box<dyn Future<Output = DatabaseResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Inserts an internal system error with the database.

Implementors§