pub trait ApiHandler:
Send
+ Sync
+ 'static {
// Required methods
fn create_task<'life0, 'async_trait>(
&'life0 self,
manifest: TaskManifest,
) -> Pin<Box<dyn Future<Output = Result<Task, ApiError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn apply_task<'life0, 'async_trait>(
&'life0 self,
manifest: TaskManifest,
preconditions: WritePreconditions,
) -> Pin<Box<dyn Future<Output = Result<Task, ApiError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_task<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 TaskId,
) -> Pin<Box<dyn Future<Output = Result<Option<Task>, ApiError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn query_tasks<'life0, 'async_trait>(
&'life0 self,
query: TaskQuery,
) -> Pin<Box<dyn Future<Output = Result<TaskPage<Task>, ApiError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn watch_tasks<'life0, 'async_trait>(
&'life0 self,
filter: TaskFilter,
resource_version: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<TaskWatchEventStream, ApiError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn list_task_runs<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
) -> Pin<Box<dyn Future<Output = Result<Vec<TaskRun>, ApiError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn delete_task<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
preconditions: WritePreconditions,
) -> Pin<Box<dyn Future<Output = Result<(), ApiError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn stream_task_logs<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
) -> Pin<Box<dyn Future<Output = Result<OutputEventStream, ApiError>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Transport-independent task API.
The trait covers desired writes, current reads, collection watches, run history, deletion, and live output.
Implementations must not expose the built-in Embedded workload.
Both transports check that boundary before encoding a response.
§Operations
| Method | HTTP | gRPC |
|---|---|---|
create_task | POST /apis/solti.io/v1/tasks | CreateTask |
apply_task | PUT /apis/solti.io/v1/tasks/{name} | ApplyTask |
get_task | GET /apis/solti.io/v1/tasks/{name} | GetTask |
query_tasks | GET /apis/solti.io/v1/tasks | ListTasks |
watch_tasks | GET /apis/solti.io/v1/tasks?watch=true | WatchTasks |
list_task_runs | GET /apis/solti.io/v1/tasks/{name}/runs | ListTaskRuns |
delete_task | DELETE /apis/solti.io/v1/tasks/{name} | DeleteTask |
stream_task_logs | GET /apis/solti.io/v1/tasks/{name}/logs | StreamTaskLogs |
§See Also
SupervisorApiAdapterimplements this trait forsolti-core.ApiErrordefines the shared transport error categories.
Required Methods§
Sourcefn create_task<'life0, 'async_trait>(
&'life0 self,
manifest: TaskManifest,
) -> Pin<Box<dyn Future<Output = Result<Task, ApiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create_task<'life0, 'async_trait>(
&'life0 self,
manifest: TaskManifest,
) -> Pin<Box<dyn Future<Output = Result<Task, ApiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Creates one named task resource.
The bundled adapter returns committed desired state immediately.
Reconciliation continues in the background.
Its result appears in status.conditions[type=Reconciled].
§Errors
The bundled adapter returns:
ApiError::InvalidRequestwhen the manifest is rejected.ApiError::AlreadyExistswhen the name is retained.ApiError::Unavailableafter shutdown starts.
Later reconciliation failures are status updates. They are not create errors.
Sourcefn apply_task<'life0, 'async_trait>(
&'life0 self,
manifest: TaskManifest,
preconditions: WritePreconditions,
) -> Pin<Box<dyn Future<Output = Result<Task, ApiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn apply_task<'life0, 'async_trait>(
&'life0 self,
manifest: TaskManifest,
preconditions: WritePreconditions,
) -> Pin<Box<dyn Future<Output = Result<Task, ApiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Creates or updates the task addressed by metadata.name.
Empty preconditions make this an upsert. Any precondition requires an existing matching resource.
§Errors
The bundled adapter can return the errors from
create_task.
It can also return:
ApiError::TaskNotFoundwhen conditional apply finds no task.ApiError::Conflictwhen a precondition does not match.
Sourcefn get_task<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 TaskId,
) -> Pin<Box<dyn Future<Output = Result<Option<Task>, ApiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_task<'life0, 'life1, 'async_trait>(
&'life0 self,
name: &'life1 TaskId,
) -> Pin<Box<dyn Future<Output = Result<Option<Task>, ApiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn query_tasks<'life0, 'async_trait>(
&'life0 self,
query: TaskQuery,
) -> Pin<Box<dyn Future<Output = Result<TaskPage<Task>, ApiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn query_tasks<'life0, 'async_trait>(
&'life0 self,
query: TaskQuery,
) -> Pin<Box<dyn Future<Output = Result<TaskPage<Task>, ApiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Returns one filtered task page.
The returned page must match the query filters and limit.
Its continuation must describe the same snapshot and filter.
The transports reject an inconsistent page as ApiError::Internal.
§Errors
The bundled adapter returns:
ApiError::InvalidRequestfor an invalid continuation.ApiError::ResourceVersionExpiredfor a compacted snapshot.
Sourcefn watch_tasks<'life0, 'async_trait>(
&'life0 self,
filter: TaskFilter,
resource_version: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<TaskWatchEventStream, ApiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn watch_tasks<'life0, 'async_trait>(
&'life0 self,
filter: TaskFilter,
resource_version: Option<String>,
) -> Pin<Box<dyn Future<Output = Result<TaskWatchEventStream, ApiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Watches changes to tasks that match the filter.
With the bundled adapter, an absent resource version or "0" first
emits current matches as Added.
A specific version replays newer retained changes.
Both forms then continue with live changes.
§Errors
The bundled adapter returns ApiError::ResourceVersionExpired
when the requested position is no longer retained.
The stream can later yield the same error when it falls behind. That error is terminal.
Sourcefn list_task_runs<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
) -> Pin<Box<dyn Future<Output = Result<Vec<TaskRun>, ApiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list_task_runs<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
) -> Pin<Box<dyn Future<Output = Result<Vec<TaskRun>, ApiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Lists one task’s execution attempts from oldest to newest.
§Errors
The bundled adapter returns ApiError::TaskNotFound
when the task is not public or does not exist.
Sourcefn delete_task<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
preconditions: WritePreconditions,
) -> Pin<Box<dyn Future<Output = Result<(), ApiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_task<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
preconditions: WritePreconditions,
) -> Pin<Box<dyn Future<Output = Result<(), ApiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Stops and removes one task and its run history.
§Errors
The bundled adapter returns:
ApiError::TaskNotFoundwhen the task is not public or does not exist.ApiError::Conflictwhen a precondition does not match.ApiError::Internalwhen runtime cancellation fails.
Sourcefn stream_task_logs<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
) -> Pin<Box<dyn Future<Output = Result<OutputEventStream, ApiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn stream_task_logs<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 TaskId,
) -> Pin<Box<dyn Future<Output = Result<OutputEventStream, ApiError>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Subscribes to one task’s live output.
The stream is lossy and has no replay. It can cover later attempts of the same task generation. Run boundary events are best-effort observations. They are not ordering barriers for output chunks.
The bundled adapter pins the stream to the generation visible when this method is called.
§Errors
The bundled adapter returns ApiError::TaskNotFound
when no public live output channel exists for this task.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".