Skip to main content

ModelHandler

Trait ModelHandler 

Source
pub trait ModelHandler:
    TttHandler
    + AdapterHandler
    + InferHandler
    + FsHandler {
    // Required methods
    fn handle_load<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        ctx: &'life1 EnvelopeContext,
        request_id: u64,
        data: &'life2 LoadModelRequest,
    ) -> Pin<Box<dyn Future<Output = Result<ModelResponseVariant>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn handle_unload<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        ctx: &'life1 EnvelopeContext,
        request_id: u64,
        data: &'life2 UnloadModelRequest,
    ) -> Pin<Box<dyn Future<Output = Result<ModelResponseVariant>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn handle_status<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        ctx: &'life1 EnvelopeContext,
        request_id: u64,
        data: &'life2 StatusRequest,
    ) -> Pin<Box<dyn Future<Output = Result<ModelResponseVariant>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn handle_health_check<'life0, 'life1, 'async_trait>(
        &'life0 self,
        ctx: &'life1 EnvelopeContext,
        request_id: u64,
    ) -> Pin<Box<dyn Future<Output = Result<ModelResponseVariant>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn authorize<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        ctx: &'life1 EnvelopeContext,
        resource: &'life2 str,
        operation: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
    fn is_resource_authorized<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        ctx: &'life1 EnvelopeContext,
        resource: &'life2 str,
        operation: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = bool> + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
}
Expand description

Generated handler trait for the Model service.

Required Methods§

Source

fn handle_load<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 EnvelopeContext, request_id: u64, data: &'life2 LoadModelRequest, ) -> Pin<Box<dyn Future<Output = Result<ModelResponseVariant>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Handle load request.

Source

fn handle_unload<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 EnvelopeContext, request_id: u64, data: &'life2 UnloadModelRequest, ) -> Pin<Box<dyn Future<Output = Result<ModelResponseVariant>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Handle unload request.

Source

fn handle_status<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 EnvelopeContext, request_id: u64, data: &'life2 StatusRequest, ) -> Pin<Box<dyn Future<Output = Result<ModelResponseVariant>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Handle status request.

Source

fn handle_health_check<'life0, 'life1, 'async_trait>( &'life0 self, ctx: &'life1 EnvelopeContext, request_id: u64, ) -> Pin<Box<dyn Future<Output = Result<ModelResponseVariant>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Handle healthCheck request.

Provided Methods§

Source

fn authorize<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, ctx: &'life1 EnvelopeContext, resource: &'life2 str, operation: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Authorize an operation on a resource. Override to enforce policy.

Called by generated dispatch functions before handler methods. Every method carries a mandatory $scope/$capability annotation (S3, #547) except explicit $scopeExempt methods, which are not gated here. Default: deny all. Services MUST override to enable access.

Source

fn is_resource_authorized<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, ctx: &'life1 EnvelopeContext, resource: &'life2 str, operation: &'life3 str, ) -> Pin<Box<dyn Future<Output = bool> + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Check if a specific resource+operation is authorized (non-failing).

Useful for filtering list results per-resource. Default delegates to authorize().is_ok().

Implementors§