pub trait Database:
Send
+ Sync
+ 'static {
// Required methods
fn insert_task<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 str,
task: &'life2 RequestTask,
) -> Pin<Box<dyn Future<Output = DatabaseResult<String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn get_task<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 str,
tes_id: &'life2 str,
params: GetTaskParams,
) -> Pin<Box<dyn Future<Output = DatabaseResult<TaskResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn get_tasks<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 str,
params: ListTasksParams,
) -> Pin<Box<dyn Future<Output = DatabaseResult<(Vec<TaskResponse>, Option<String>)>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_task_template_data<'life0, 'life1, 'async_trait>(
&'life0 self,
tes_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = DatabaseResult<TaskTemplateData>> + 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, 'life4, 'async_trait>(
&'life0 self,
tes_id: &'life1 str,
state: State,
messages: &'life2 [&'life3 str],
containers: Option<BoxFuture<'a, Result<Vec<TerminatedContainer<'a>>>>>,
outputs: Option<&'life4 [OutputFile]>,
) -> 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,
'life4: '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 add_task_resource_usage_samples<'life0, 'life1, 'async_trait>(
&'life0 self,
samples: &'life1 [ContainerUsageSample],
) -> Pin<Box<dyn Future<Output = DatabaseResult<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: '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§
Sourcefn insert_task<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 str,
task: &'life2 RequestTask,
) -> Pin<Box<dyn Future<Output = DatabaseResult<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn insert_task<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 str,
task: &'life2 RequestTask,
) -> Pin<Box<dyn Future<Output = DatabaseResult<String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Inserts a task into the database for the specified user.
Note: it is expected that the newly inserted task has the UNKNOWN
state.
Returns the generated TES task identifier.
Sourcefn get_task<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 str,
tes_id: &'life2 str,
params: GetTaskParams,
) -> Pin<Box<dyn Future<Output = DatabaseResult<TaskResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn get_task<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
username: &'life1 str,
tes_id: &'life2 str,
params: GetTaskParams,
) -> Pin<Box<dyn Future<Output = DatabaseResult<TaskResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Gets a task from the database for the specified user.
Sourcefn get_tasks<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 str,
params: ListTasksParams,
) -> Pin<Box<dyn Future<Output = DatabaseResult<(Vec<TaskResponse>, Option<String>)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_tasks<'life0, 'life1, 'async_trait>(
&'life0 self,
username: &'life1 str,
params: ListTasksParams,
) -> Pin<Box<dyn Future<Output = DatabaseResult<(Vec<TaskResponse>, Option<String>)>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Gets tasks from the database for the specified user.
Returns a list of tasks and the page token to use for the next request.
Sourcefn get_task_template_data<'life0, 'life1, 'async_trait>(
&'life0 self,
tes_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = DatabaseResult<TaskTemplateData>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_task_template_data<'life0, 'life1, 'async_trait>(
&'life0 self,
tes_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = DatabaseResult<TaskTemplateData>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Gets a task’s template data for use in rendering Kubernetes resource templates.
NOTE: this database operation does not filter the template data by user; it should only be used from internal contexts (e.g. from the Orchestrator) where authorization is assumed.
Sourcefn 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 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
Sourcefn update_task_state<'a, 'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
tes_id: &'life1 str,
state: State,
messages: &'life2 [&'life3 str],
containers: Option<BoxFuture<'a, Result<Vec<TerminatedContainer<'a>>>>>,
outputs: Option<&'life4 [OutputFile]>,
) -> 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,
'life4: 'async_trait,
fn update_task_state<'a, 'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
tes_id: &'life1 str,
state: State,
messages: &'life2 [&'life3 str],
containers: Option<BoxFuture<'a, Result<Vec<TerminatedContainer<'a>>>>>,
outputs: Option<&'life4 [OutputFile]>,
) -> 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,
'life4: '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.
The given output files will be associated with the task if the task
transitions to the given state; if None, the task’s output files will
not be set.
Returns Ok(true) if the status was updated or Ok(false) if the
task’s current state cannot be transitioned to the given state.
Sourcefn 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 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.
Sourcefn add_task_resource_usage_samples<'life0, 'life1, 'async_trait>(
&'life0 self,
samples: &'life1 [ContainerUsageSample],
) -> Pin<Box<dyn Future<Output = DatabaseResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn add_task_resource_usage_samples<'life0, 'life1, 'async_trait>(
&'life0 self,
samples: &'life1 [ContainerUsageSample],
) -> Pin<Box<dyn Future<Output = DatabaseResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Records per-container resource usage observations.
CPU counters are folded idempotently against durable per-container baselines, including after retries, missed rounds, and container restarts.
Sourcefn 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,
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.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".