Skip to main content

DatasetResolver

Trait DatasetResolver 

Source
pub trait DatasetResolver: Send + Sync {
    // Required methods
    fn resolve_datasets<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        datasets: &'life1 [String],
        user_id: Uuid,
        permission: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Dataset>, CognifyError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             Self: 'async_trait;
    fn get_dataset_data<'life0, 'async_trait>(
        &'life0 self,
        dataset_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = Result<Vec<Data>, CognifyError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             Self: 'async_trait;

    // Provided method
    fn resolve_dataset_by_id<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _id: Uuid,
        _user_id: Uuid,
        _permission: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Dataset>, CognifyError>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait { ... }
}
Expand description

Resolve dataset names (or all datasets) to concrete Dataset and Data objects.

Implementations are expected to enforce authorization (the permission parameter mirrors Python’s get_authorized_existing_datasets).

Required Methods§

Source

fn resolve_datasets<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, datasets: &'life1 [String], user_id: Uuid, permission: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Dataset>, CognifyError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, Self: 'async_trait,

Resolve dataset names to Dataset objects for a given user.

  • If datasets is empty, implementations should return all datasets the user has access to (matching Python behaviour when datasets=None).
  • permission is a hint for access control (e.g. "read", "write").
Source

fn get_dataset_data<'life0, 'async_trait>( &'life0 self, dataset_id: Uuid, ) -> Pin<Box<dyn Future<Output = Result<Vec<Data>, CognifyError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Return all Data items attached to the given dataset.

Provided Methods§

Source

fn resolve_dataset_by_id<'life0, 'life1, 'async_trait>( &'life0 self, _id: Uuid, _user_id: Uuid, _permission: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Dataset>, CognifyError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Resolve a single dataset by its UUID.

Default implementation returns None (not supported). Implementors backed by a real database should override.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§