use crate::models;
use crate::server::api::{
AccessGroupsApi, ComputeNodesApi, EventsApi, FailureHandlersApi, FilesApi, JobsApi,
RemoteWorkersApi, ResourceRequirementsApi, ResultsApi, RoCrateApi, SchedulersApi,
SlurmStatsApi, UserDataApi, WorkflowActionsApi, WorkflowsApi,
};
use crate::server::event_broadcast::BroadcastEvent;
use crate::server::response_types::{
access::*, artifacts::*, events::*, jobs::*, scheduling::*, system::*, workflows::*,
};
use crate::server::transport_types::context_types::ApiError;
use async_trait::async_trait;
use std::error::Error;
use std::task::{Context, Poll};
use tokio::sync::broadcast;
pub trait ArtifactDomainApi<C: Send + Sync>:
FilesApi<C> + ResultsApi<C> + RoCrateApi<C> + UserDataApi<C>
{
}
impl<T, C> ArtifactDomainApi<C> for T
where
C: Send + Sync,
T: FilesApi<C> + ResultsApi<C> + RoCrateApi<C> + UserDataApi<C>,
{
}
pub trait SchedulingDomainApi<C: Send + Sync>:
ComputeNodesApi<C>
+ RemoteWorkersApi<C>
+ ResourceRequirementsApi<C>
+ SchedulersApi<C>
+ SlurmStatsApi<C>
{
}
impl<T, C> SchedulingDomainApi<C> for T
where
C: Send + Sync,
T: ComputeNodesApi<C>
+ RemoteWorkersApi<C>
+ ResourceRequirementsApi<C>
+ SchedulersApi<C>
+ SlurmStatsApi<C>,
{
}
pub trait WorkflowDomainApi<C: Send + Sync>:
AccessGroupsApi<C> + WorkflowActionsApi<C> + WorkflowsApi<C>
{
}
impl<T, C> WorkflowDomainApi<C> for T
where
C: Send + Sync,
T: AccessGroupsApi<C> + WorkflowActionsApi<C> + WorkflowsApi<C>,
{
}
pub trait JobDomainApi<C: Send + Sync>: JobsApi<C> {}
impl<T, C> JobDomainApi<C> for T
where
C: Send + Sync,
T: JobsApi<C>,
{
}
pub trait EventDomainApi<C: Send + Sync>: EventsApi<C> + FailureHandlersApi<C> {}
impl<T, C> EventDomainApi<C> for T
where
C: Send + Sync,
T: EventsApi<C> + FailureHandlersApi<C>,
{
}
#[async_trait]
pub trait SystemApi<C: Send + Sync> {
fn poll_ready(
&self,
_cx: &mut Context,
) -> Poll<Result<(), Box<dyn Error + Send + Sync + 'static>>> {
Poll::Ready(Ok(()))
}
fn subscribe_to_events(&self) -> broadcast::Receiver<BroadcastEvent>;
async fn get_version(&self, context: &C) -> Result<GetVersionResponse, ApiError>;
async fn ping(&self, context: &C) -> Result<PingResponse, ApiError>;
async fn reload_auth(&self, context: &C) -> Result<ReloadAuthResponse, ApiError>;
}
#[async_trait]
#[allow(clippy::too_many_arguments, clippy::ptr_arg)]
pub trait TransportApiCore<C: Send + Sync> {
fn poll_ready(
&self,
_cx: &mut Context,
) -> Poll<Result<(), Box<dyn Error + Send + Sync + 'static>>> {
Poll::Ready(Ok(()))
}
async fn create_compute_node(
&self,
body: models::ComputeNodeModel,
context: &C,
) -> Result<CreateComputeNodeResponse, ApiError>;
async fn create_event(
&self,
body: models::EventModel,
context: &C,
) -> Result<CreateEventResponse, ApiError>;
async fn create_file(
&self,
body: models::FileModel,
context: &C,
) -> Result<CreateFileResponse, ApiError>;
async fn create_job(
&self,
body: models::JobModel,
context: &C,
) -> Result<CreateJobResponse, ApiError>;
async fn create_jobs(
&self,
body: models::JobsModel,
context: &C,
) -> Result<CreateJobsResponse, ApiError>;
async fn create_local_scheduler(
&self,
body: models::LocalSchedulerModel,
context: &C,
) -> Result<CreateLocalSchedulerResponse, ApiError>;
async fn create_failure_handler(
&self,
body: models::FailureHandlerModel,
context: &C,
) -> Result<CreateFailureHandlerResponse, ApiError>;
async fn get_failure_handler(
&self,
id: i64,
context: &C,
) -> Result<GetFailureHandlerResponse, ApiError>;
async fn list_failure_handlers(
&self,
workflow_id: i64,
offset: Option<i64>,
limit: Option<i64>,
context: &C,
) -> Result<ListFailureHandlersResponse, ApiError>;
async fn delete_failure_handler(
&self,
id: i64,
context: &C,
) -> Result<DeleteFailureHandlerResponse, ApiError>;
async fn create_ro_crate_entity(
&self,
body: models::RoCrateEntityModel,
context: &C,
) -> Result<CreateRoCrateEntityResponse, ApiError>;
async fn get_ro_crate_entity(
&self,
id: i64,
context: &C,
) -> Result<GetRoCrateEntityResponse, ApiError>;
async fn list_ro_crate_entities(
&self,
workflow_id: i64,
offset: Option<i64>,
limit: Option<i64>,
sort_by: Option<String>,
reverse_sort: Option<bool>,
context: &C,
) -> Result<ListRoCrateEntitiesResponse, ApiError>;
async fn update_ro_crate_entity(
&self,
id: i64,
body: models::RoCrateEntityModel,
context: &C,
) -> Result<UpdateRoCrateEntityResponse, ApiError>;
async fn delete_ro_crate_entity(
&self,
id: i64,
context: &C,
) -> Result<DeleteRoCrateEntityResponse, ApiError>;
async fn delete_ro_crate_entities(
&self,
workflow_id: i64,
context: &C,
) -> Result<DeleteRoCrateEntitiesResponse, ApiError>;
async fn create_resource_requirements(
&self,
body: models::ResourceRequirementsModel,
context: &C,
) -> Result<CreateResourceRequirementsResponse, ApiError>;
async fn create_result(
&self,
body: models::ResultModel,
context: &C,
) -> Result<CreateResultResponse, ApiError>;
async fn create_scheduled_compute_node(
&self,
body: models::ScheduledComputeNodesModel,
context: &C,
) -> Result<CreateScheduledComputeNodeResponse, ApiError>;
async fn create_slurm_scheduler(
&self,
body: models::SlurmSchedulerModel,
context: &C,
) -> Result<CreateSlurmSchedulerResponse, ApiError>;
async fn create_slurm_stats(
&self,
body: models::SlurmStatsModel,
context: &C,
) -> Result<CreateSlurmStatsResponse, ApiError>;
async fn list_slurm_stats(
&self,
workflow_id: i64,
job_id: Option<i64>,
run_id: Option<i64>,
attempt_id: Option<i64>,
offset: Option<i64>,
limit: Option<i64>,
context: &C,
) -> Result<ListSlurmStatsResponse, ApiError>;
async fn create_remote_workers(
&self,
workflow_id: i64,
workers: Vec<String>,
context: &C,
) -> Result<CreateRemoteWorkersResponse, ApiError>;
async fn list_remote_workers(
&self,
workflow_id: i64,
context: &C,
) -> Result<ListRemoteWorkersResponse, ApiError>;
async fn delete_remote_worker(
&self,
workflow_id: i64,
worker: String,
context: &C,
) -> Result<DeleteRemoteWorkerResponse, ApiError>;
async fn create_user_data(
&self,
body: models::UserDataModel,
consumer_job_id: Option<i64>,
producer_job_id: Option<i64>,
context: &C,
) -> Result<CreateUserDataResponse, ApiError>;
async fn create_workflow(
&self,
body: models::WorkflowModel,
context: &C,
) -> Result<CreateWorkflowResponse, ApiError>;
async fn create_workflow_action(
&self,
workflow_id: i64,
body: models::WorkflowActionModel,
context: &C,
) -> Result<CreateWorkflowActionResponse, ApiError>;
async fn get_workflow_actions(
&self,
workflow_id: i64,
context: &C,
) -> Result<GetWorkflowActionsResponse, ApiError>;
async fn get_pending_actions(
&self,
workflow_id: i64,
trigger_types: Option<Vec<String>>,
context: &C,
) -> Result<GetPendingActionsResponse, ApiError>;
async fn claim_action(
&self,
workflow_id: i64,
action_id: i64,
body: models::ClaimActionRequest,
context: &C,
) -> Result<ClaimActionResponse, ApiError>;
async fn delete_compute_nodes(
&self,
workflow_id: i64,
context: &C,
) -> Result<DeleteComputeNodesResponse, ApiError>;
async fn delete_events(
&self,
workflow_id: i64,
context: &C,
) -> Result<DeleteEventsResponse, ApiError>;
async fn delete_files(
&self,
workflow_id: i64,
context: &C,
) -> Result<DeleteFilesResponse, ApiError>;
async fn delete_jobs(
&self,
workflow_id: i64,
context: &C,
) -> Result<DeleteJobsResponse, ApiError>;
async fn delete_local_schedulers(
&self,
workflow_id: i64,
context: &C,
) -> Result<DeleteLocalSchedulersResponse, ApiError>;
async fn delete_all_resource_requirements(
&self,
workflow_id: i64,
context: &C,
) -> Result<DeleteAllResourceRequirementsResponse, ApiError>;
async fn delete_results(
&self,
workflow_id: i64,
context: &C,
) -> Result<DeleteResultsResponse, ApiError>;
async fn delete_scheduled_compute_nodes(
&self,
workflow_id: i64,
context: &C,
) -> Result<DeleteScheduledComputeNodesResponse, ApiError>;
async fn delete_slurm_schedulers(
&self,
workflow_id: i64,
context: &C,
) -> Result<DeleteSlurmSchedulersResponse, ApiError>;
async fn delete_all_user_data(
&self,
workflow_id: i64,
context: &C,
) -> Result<DeleteAllUserDataResponse, ApiError>;
async fn get_version(&self, context: &C) -> Result<GetVersionResponse, ApiError>;
async fn list_compute_nodes(
&self,
workflow_id: i64,
offset: Option<i64>,
limit: Option<i64>,
sort_by: Option<String>,
reverse_sort: Option<bool>,
hostname: Option<String>,
is_active: Option<bool>,
scheduled_compute_node_id: Option<i64>,
context: &C,
) -> Result<ListComputeNodesResponse, ApiError>;
async fn list_events(
&self,
workflow_id: i64,
offset: Option<i64>,
limit: Option<i64>,
sort_by: Option<String>,
reverse_sort: Option<bool>,
category: Option<String>,
after_timestamp: Option<i64>,
context: &C,
) -> Result<ListEventsResponse, ApiError>;
async fn list_files(
&self,
workflow_id: i64,
produced_by_job_id: Option<i64>,
offset: Option<i64>,
limit: Option<i64>,
sort_by: Option<String>,
reverse_sort: Option<bool>,
name: Option<String>,
path: Option<String>,
is_output: Option<bool>,
context: &C,
) -> Result<ListFilesResponse, ApiError>;
async fn list_jobs(
&self,
workflow_id: i64,
status: Option<models::JobStatus>,
needs_file_id: Option<i64>,
upstream_job_id: Option<i64>,
offset: Option<i64>,
limit: Option<i64>,
sort_by: Option<String>,
reverse_sort: Option<bool>,
include_relationships: Option<bool>,
active_compute_node_id: Option<i64>,
context: &C,
) -> Result<ListJobsResponse, ApiError>;
async fn list_job_dependencies(
&self,
workflow_id: i64,
offset: Option<i64>,
limit: Option<i64>,
sort_by: Option<String>,
reverse_sort: Option<bool>,
context: &C,
) -> Result<ListJobDependenciesResponse, ApiError>;
async fn list_job_file_relationships(
&self,
workflow_id: i64,
offset: Option<i64>,
limit: Option<i64>,
sort_by: Option<String>,
reverse_sort: Option<bool>,
context: &C,
) -> Result<ListJobFileRelationshipsResponse, ApiError>;
async fn list_job_user_data_relationships(
&self,
workflow_id: i64,
offset: Option<i64>,
limit: Option<i64>,
sort_by: Option<String>,
reverse_sort: Option<bool>,
context: &C,
) -> Result<ListJobUserDataRelationshipsResponse, ApiError>;
async fn list_local_schedulers(
&self,
workflow_id: i64,
offset: Option<i64>,
limit: Option<i64>,
sort_by: Option<String>,
reverse_sort: Option<bool>,
memory: Option<String>,
num_cpus: Option<i64>,
context: &C,
) -> Result<ListLocalSchedulersResponse, ApiError>;
async fn list_resource_requirements(
&self,
workflow_id: i64,
job_id: Option<i64>,
name: Option<String>,
memory: Option<String>,
num_cpus: Option<i64>,
num_gpus: Option<i64>,
num_nodes: Option<i64>,
runtime: Option<i64>,
offset: Option<i64>,
limit: Option<i64>,
sort_by: Option<String>,
reverse_sort: Option<bool>,
context: &C,
) -> Result<ListResourceRequirementsResponse, ApiError>;
async fn list_results(
&self,
workflow_id: i64,
job_id: Option<i64>,
run_id: Option<i64>,
return_code: Option<i64>,
status: Option<models::JobStatus>,
compute_node_id: Option<i64>,
offset: Option<i64>,
limit: Option<i64>,
sort_by: Option<String>,
reverse_sort: Option<bool>,
all_runs: Option<bool>,
context: &C,
) -> Result<ListResultsResponse, ApiError>;
async fn list_scheduled_compute_nodes(
&self,
workflow_id: i64,
offset: Option<i64>,
limit: Option<i64>,
sort_by: Option<String>,
reverse_sort: Option<bool>,
scheduler_id: Option<String>,
scheduler_config_id: Option<String>,
status: Option<String>,
context: &C,
) -> Result<ListScheduledComputeNodesResponse, ApiError>;
async fn list_slurm_schedulers(
&self,
workflow_id: i64,
offset: Option<i64>,
limit: Option<i64>,
sort_by: Option<String>,
reverse_sort: Option<bool>,
name: Option<String>,
account: Option<String>,
gres: Option<String>,
mem: Option<String>,
nodes: Option<i64>,
partition: Option<String>,
qos: Option<String>,
tmp: Option<String>,
walltime: Option<String>,
context: &C,
) -> Result<ListSlurmSchedulersResponse, ApiError>;
async fn list_user_data(
&self,
workflow_id: i64,
consumer_job_id: Option<i64>,
producer_job_id: Option<i64>,
offset: Option<i64>,
limit: Option<i64>,
sort_by: Option<String>,
reverse_sort: Option<bool>,
name: Option<String>,
is_ephemeral: Option<bool>,
context: &C,
) -> Result<ListUserDataResponse, ApiError>;
async fn list_workflows(
&self,
offset: Option<i64>,
sort_by: Option<String>,
reverse_sort: Option<bool>,
limit: Option<i64>,
name: Option<String>,
user: Option<String>,
description: Option<String>,
is_archived: Option<bool>,
context: &C,
) -> Result<ListWorkflowsResponse, ApiError>;
async fn ping(&self, context: &C) -> Result<PingResponse, ApiError>;
async fn cancel_workflow(
&self,
id: i64,
context: &C,
) -> Result<CancelWorkflowResponse, ApiError>;
async fn get_compute_node(
&self,
id: i64,
context: &C,
) -> Result<GetComputeNodeResponse, ApiError>;
async fn get_event(&self, id: i64, context: &C) -> Result<GetEventResponse, ApiError>;
async fn get_file(&self, id: i64, context: &C) -> Result<GetFileResponse, ApiError>;
async fn get_job(&self, id: i64, context: &C) -> Result<GetJobResponse, ApiError>;
async fn get_local_scheduler(
&self,
id: i64,
context: &C,
) -> Result<GetLocalSchedulerResponse, ApiError>;
async fn get_ready_job_requirements(
&self,
id: i64,
scheduler_config_id: Option<i64>,
context: &C,
) -> Result<GetReadyJobRequirementsResponse, ApiError>;
async fn get_resource_requirements(
&self,
id: i64,
context: &C,
) -> Result<GetResourceRequirementsResponse, ApiError>;
async fn get_result(&self, id: i64, context: &C) -> Result<GetResultResponse, ApiError>;
async fn get_scheduled_compute_node(
&self,
id: i64,
context: &C,
) -> Result<GetScheduledComputeNodeResponse, ApiError>;
async fn get_slurm_scheduler(
&self,
id: i64,
context: &C,
) -> Result<GetSlurmSchedulerResponse, ApiError>;
async fn get_user_data(&self, id: i64, context: &C) -> Result<GetUserDataResponse, ApiError>;
async fn get_workflow(&self, id: i64, context: &C) -> Result<GetWorkflowResponse, ApiError>;
async fn get_workflow_status(
&self,
id: i64,
context: &C,
) -> Result<GetWorkflowStatusResponse, ApiError>;
async fn initialize_jobs(
&self,
id: i64,
only_uninitialized: Option<bool>,
clear_ephemeral_user_data: Option<bool>,
context: &C,
) -> Result<InitializeJobsResponse, ApiError>;
async fn is_workflow_complete(
&self,
id: i64,
context: &C,
) -> Result<IsWorkflowCompleteResponse, ApiError>;
async fn is_workflow_uninitialized(
&self,
id: i64,
context: &C,
) -> Result<IsWorkflowUninitializedResponse, ApiError>;
async fn list_job_ids(&self, id: i64, context: &C) -> Result<ListJobIdsResponse, ApiError>;
async fn list_missing_user_data(
&self,
id: i64,
context: &C,
) -> Result<ListMissingUserDataResponse, ApiError>;
async fn list_required_existing_files(
&self,
id: i64,
context: &C,
) -> Result<ListRequiredExistingFilesResponse, ApiError>;
async fn update_compute_node(
&self,
id: i64,
body: models::ComputeNodeModel,
context: &C,
) -> Result<UpdateComputeNodeResponse, ApiError>;
async fn update_event(
&self,
id: i64,
body: serde_json::Value,
context: &C,
) -> Result<UpdateEventResponse, ApiError>;
async fn update_file(
&self,
id: i64,
body: models::FileModel,
context: &C,
) -> Result<UpdateFileResponse, ApiError>;
async fn update_job(
&self,
id: i64,
body: models::JobModel,
context: &C,
) -> Result<UpdateJobResponse, ApiError>;
async fn update_local_scheduler(
&self,
id: i64,
body: models::LocalSchedulerModel,
context: &C,
) -> Result<UpdateLocalSchedulerResponse, ApiError>;
async fn update_resource_requirements(
&self,
id: i64,
body: models::ResourceRequirementsModel,
context: &C,
) -> Result<UpdateResourceRequirementsResponse, ApiError>;
async fn update_result(
&self,
id: i64,
body: models::ResultModel,
context: &C,
) -> Result<UpdateResultResponse, ApiError>;
async fn update_scheduled_compute_node(
&self,
id: i64,
body: models::ScheduledComputeNodesModel,
context: &C,
) -> Result<UpdateScheduledComputeNodeResponse, ApiError>;
async fn update_slurm_scheduler(
&self,
id: i64,
body: models::SlurmSchedulerModel,
context: &C,
) -> Result<UpdateSlurmSchedulerResponse, ApiError>;
async fn update_user_data(
&self,
id: i64,
body: models::UserDataModel,
context: &C,
) -> Result<UpdateUserDataResponse, ApiError>;
async fn update_workflow(
&self,
id: i64,
body: models::WorkflowModel,
context: &C,
) -> Result<UpdateWorkflowResponse, ApiError>;
async fn update_workflow_status(
&self,
id: i64,
body: models::WorkflowStatusModel,
context: &C,
) -> Result<UpdateWorkflowStatusResponse, ApiError>;
async fn claim_jobs_based_on_resources(
&self,
id: i64,
body: models::ComputeNodesResources,
limit: i64,
strict_scheduler_match: Option<bool>,
context: &C,
) -> Result<ClaimJobsBasedOnResources, ApiError>;
async fn claim_next_jobs(
&self,
id: i64,
limit: Option<i64>,
context: &C,
) -> Result<ClaimNextJobsResponse, ApiError>;
async fn process_changed_job_inputs(
&self,
id: i64,
dry_run: Option<bool>,
context: &C,
) -> Result<ProcessChangedJobInputsResponse, ApiError>;
async fn delete_compute_node(
&self,
id: i64,
context: &C,
) -> Result<DeleteComputeNodeResponse, ApiError>;
async fn delete_event(&self, id: i64, context: &C) -> Result<DeleteEventResponse, ApiError>;
async fn delete_file(&self, id: i64, context: &C) -> Result<DeleteFileResponse, ApiError>;
async fn delete_job(&self, id: i64, context: &C) -> Result<DeleteJobResponse, ApiError>;
async fn delete_local_scheduler(
&self,
id: i64,
context: &C,
) -> Result<DeleteLocalSchedulerResponse, ApiError>;
async fn delete_resource_requirements(
&self,
id: i64,
context: &C,
) -> Result<DeleteResourceRequirementsResponse, ApiError>;
async fn delete_result(&self, id: i64, context: &C) -> Result<DeleteResultResponse, ApiError>;
async fn delete_scheduled_compute_node(
&self,
id: i64,
context: &C,
) -> Result<DeleteScheduledComputeNodeResponse, ApiError>;
async fn delete_slurm_scheduler(
&self,
id: i64,
context: &C,
) -> Result<DeleteSlurmSchedulerResponse, ApiError>;
async fn delete_user_data(
&self,
id: i64,
context: &C,
) -> Result<DeleteUserDataResponse, ApiError>;
async fn delete_workflow(
&self,
id: i64,
context: &C,
) -> Result<DeleteWorkflowResponse, ApiError>;
async fn reset_job_status(
&self,
id: i64,
failed_only: Option<bool>,
context: &C,
) -> Result<ResetJobStatusResponse, ApiError>;
async fn reset_workflow_status(
&self,
id: i64,
force: Option<bool>,
context: &C,
) -> Result<ResetWorkflowStatusResponse, ApiError>;
async fn manage_status_change(
&self,
id: i64,
status: models::JobStatus,
run_id: i64,
context: &C,
) -> Result<ManageStatusChangeResponse, ApiError>;
async fn start_job(
&self,
id: i64,
run_id: i64,
compute_node_id: i64,
context: &C,
) -> Result<StartJobResponse, ApiError>;
async fn complete_job(
&self,
id: i64,
status: models::JobStatus,
run_id: i64,
body: models::ResultModel,
context: &C,
) -> Result<CompleteJobResponse, ApiError>;
async fn retry_job(
&self,
id: i64,
run_id: i64,
max_retries: i32,
context: &C,
) -> Result<RetryJobResponse, ApiError>;
async fn prepare_ready_jobs(
&self,
workflow_id: i64,
resources: models::ComputeNodesResources,
limit: i64,
strict_scheduler_match: Option<bool>,
context: &C,
) -> Result<ClaimJobsBasedOnResources, ApiError>;
async fn create_access_group(
&self,
body: models::AccessGroupModel,
context: &C,
) -> Result<CreateAccessGroupResponse, ApiError>;
async fn get_access_group(
&self,
id: i64,
context: &C,
) -> Result<GetAccessGroupResponse, ApiError>;
async fn list_access_groups(
&self,
offset: Option<i64>,
limit: Option<i64>,
context: &C,
) -> Result<ListAccessGroupsApiResponse, ApiError>;
async fn delete_access_group(
&self,
id: i64,
context: &C,
) -> Result<DeleteAccessGroupResponse, ApiError>;
async fn add_user_to_group(
&self,
group_id: i64,
body: models::UserGroupMembershipModel,
context: &C,
) -> Result<AddUserToGroupResponse, ApiError>;
async fn remove_user_from_group(
&self,
group_id: i64,
user_name: String,
context: &C,
) -> Result<RemoveUserFromGroupResponse, ApiError>;
async fn list_group_members(
&self,
group_id: i64,
offset: Option<i64>,
limit: Option<i64>,
context: &C,
) -> Result<ListGroupMembersResponse, ApiError>;
async fn list_user_groups(
&self,
user_name: String,
offset: Option<i64>,
limit: Option<i64>,
context: &C,
) -> Result<ListUserGroupsApiResponse, ApiError>;
async fn add_workflow_to_group(
&self,
workflow_id: i64,
group_id: i64,
context: &C,
) -> Result<AddWorkflowToGroupResponse, ApiError>;
async fn remove_workflow_from_group(
&self,
workflow_id: i64,
group_id: i64,
context: &C,
) -> Result<RemoveWorkflowFromGroupResponse, ApiError>;
async fn list_workflow_groups(
&self,
workflow_id: i64,
offset: Option<i64>,
limit: Option<i64>,
context: &C,
) -> Result<ListWorkflowGroupsResponse, ApiError>;
async fn check_workflow_access(
&self,
workflow_id: i64,
user_name: String,
context: &C,
) -> Result<CheckWorkflowAccessResponse, ApiError>;
fn subscribe_to_events(&self) -> broadcast::Receiver<BroadcastEvent>;
async fn reload_auth(&self, context: &C) -> Result<ReloadAuthResponse, ApiError>;
}
pub trait ArtifactTransportApi<C: Send + Sync>: TransportApiCore<C> {}
impl<T, C> ArtifactTransportApi<C> for T
where
C: Send + Sync,
T: TransportApiCore<C>,
{
}
pub trait SchedulingTransportApi<C: Send + Sync>: TransportApiCore<C> {}
impl<T, C> SchedulingTransportApi<C> for T
where
C: Send + Sync,
T: TransportApiCore<C>,
{
}
pub trait WorkflowTransportApi<C: Send + Sync>: TransportApiCore<C> {}
impl<T, C> WorkflowTransportApi<C> for T
where
C: Send + Sync,
T: TransportApiCore<C>,
{
}
pub trait JobTransportApi<C: Send + Sync>: TransportApiCore<C> {}
impl<T, C> JobTransportApi<C> for T
where
C: Send + Sync,
T: TransportApiCore<C>,
{
}
pub trait EventTransportApi<C: Send + Sync>: TransportApiCore<C> {}
impl<T, C> EventTransportApi<C> for T
where
C: Send + Sync,
T: TransportApiCore<C>,
{
}
pub trait AccessTransportApi<C: Send + Sync>: TransportApiCore<C> {}
impl<T, C> AccessTransportApi<C> for T
where
C: Send + Sync,
T: TransportApiCore<C>,
{
}
pub trait TransportApi<C: Send + Sync>:
TransportApiCore<C>
+ ArtifactTransportApi<C>
+ SchedulingTransportApi<C>
+ WorkflowTransportApi<C>
+ JobTransportApi<C>
+ EventTransportApi<C>
+ AccessTransportApi<C>
{
}
impl<T, C> TransportApi<C> for T
where
C: Send + Sync,
T: TransportApiCore<C>
+ ArtifactTransportApi<C>
+ SchedulingTransportApi<C>
+ WorkflowTransportApi<C>
+ JobTransportApi<C>
+ EventTransportApi<C>
+ AccessTransportApi<C>,
{
}
pub trait Api<C: Send + Sync>:
TransportApi<C>
+ SystemApi<C>
+ ArtifactDomainApi<C>
+ SchedulingDomainApi<C>
+ WorkflowDomainApi<C>
+ JobDomainApi<C>
+ EventDomainApi<C>
{
}
impl<T, C> Api<C> for T
where
C: Send + Sync,
T: TransportApi<C>
+ SystemApi<C>
+ ArtifactDomainApi<C>
+ SchedulingDomainApi<C>
+ WorkflowDomainApi<C>
+ JobDomainApi<C>
+ EventDomainApi<C>,
{
}