Skip to main content

TaskSource

Trait TaskSource 

Source
pub trait TaskSource: Send + Sync {
    // Required methods
    fn kind(&self) -> &'static str;
    fn capabilities(&self) -> Capabilities;
    fn health<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<Health, SourceError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_task<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 NativeId,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Task>, SourceError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn get_project<'life0, 'life1, 'async_trait>(
        &'life0 self,
        id: &'life1 NativeId,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Project>, SourceError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn query_tasks<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        query: &'life1 TaskQuery,
        page: &'life2 PageRequest,
    ) -> Pin<Box<dyn Future<Output = Result<Page<Task>, SourceError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn query_projects<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        query: &'life1 ProjectQuery,
        page: &'life2 PageRequest,
    ) -> Pin<Box<dyn Future<Output = Result<Page<Project>, SourceError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn labels<'life0, 'life1, 'async_trait>(
        &'life0 self,
        page: &'life1 PageRequest,
    ) -> Pin<Box<dyn Future<Output = Result<Page<Label>, SourceError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn task_dependencies<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        id: &'life1 NativeId,
        direction: Direction,
        page: &'life2 PageRequest,
    ) -> Pin<Box<dyn Future<Output = Result<Page<DependencyEdge>, SourceError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn project_dependencies<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        id: &'life1 NativeId,
        direction: Direction,
        page: &'life2 PageRequest,
    ) -> Pin<Box<dyn Future<Output = Result<Page<DependencyEdge>, SourceError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

One configured source, as the engine drives it.

Dyn-compatible through async_trait because the engine holds Vec<Box<dyn TaskSource>> over heterogeneous plugins.

Three rules bind every implementation, and the engine’s compensation is only correct while all three hold:

  1. Apply every predicate you declare Support::Native.
  2. Ignore every Support-typed predicate you declare Unsupported — return the wider result set, never a narrower one. Silently dropping rows for a predicate you did not declare is the one failure no test above the plugin can catch.
  3. Never return a silently empty dependency read. Rule 2 reaches the Support-typed predicates alone; a dependency read is always real.

Required Methods§

Source

fn kind(&self) -> &'static str

The plugin kind that built this source, for display and for plan output.

Source

fn capabilities(&self) -> Capabilities

What this source applies itself. Read once per query by the engine.

Source

fn health<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Health, SourceError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Whether the source is answering right now.

§Errors

Returns a SourceError when the check itself could not be made.

Source

fn get_task<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 NativeId, ) -> Pin<Box<dyn Future<Output = Result<Option<Task>, SourceError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch one task by its native id, or None when there is no such task.

§Errors

Returns a SourceError when the source could not answer.

Source

fn get_project<'life0, 'life1, 'async_trait>( &'life0 self, id: &'life1 NativeId, ) -> Pin<Box<dyn Future<Output = Result<Option<Project>, SourceError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Fetch one project by its native id, or None when there is no such project.

§Errors

Returns a SourceError when the source could not answer.

Source

fn query_tasks<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, query: &'life1 TaskQuery, page: &'life2 PageRequest, ) -> Pin<Box<dyn Future<Output = Result<Page<Task>, SourceError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

One page of the tasks matching query.

§Errors

Returns a SourceError when the source could not answer.

Source

fn query_projects<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, query: &'life1 ProjectQuery, page: &'life2 PageRequest, ) -> Pin<Box<dyn Future<Output = Result<Page<Project>, SourceError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

One page of the projects matching query.

§Errors

Returns a SourceError when the source could not answer.

Source

fn labels<'life0, 'life1, 'async_trait>( &'life0 self, page: &'life1 PageRequest, ) -> Pin<Box<dyn Future<Output = Result<Page<Label>, SourceError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

One page of every label this source knows.

§Errors

Returns a SourceError when the source could not answer.

Source

fn task_dependencies<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 NativeId, direction: Direction, page: &'life2 PageRequest, ) -> Pin<Box<dyn Future<Output = Result<Page<DependencyEdge>, SourceError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

One page of the task dependency edges at id, in direction.

§Errors

Returns a SourceError when the source could not answer.

Source

fn project_dependencies<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, id: &'life1 NativeId, direction: Direction, page: &'life2 PageRequest, ) -> Pin<Box<dyn Future<Output = Result<Page<DependencyEdge>, SourceError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

One page of the project dependency edges at id, in direction.

§Errors

Returns a SourceError when the source could not answer.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§