Skip to main content

MetadataBackend

Trait MetadataBackend 

Source
pub trait MetadataBackend: Send + Sync {
    // Required methods
    fn connect<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = MetadataResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn publish_metadata<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        identity: &'life1 SourceIdentity,
        worker_id: &'life2 str,
        worker: WorkerMetadata,
    ) -> Pin<Box<dyn Future<Output = MetadataResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn get_metadata<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        source_id: &'life1 str,
        worker_id: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = MetadataResult<Option<ModelMetadataRecord>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn list_workers<'life0, 'async_trait>(
        &'life0 self,
        source_id: Option<String>,
        status_filter: Option<SourceStatus>,
    ) -> Pin<Box<dyn Future<Output = MetadataResult<Vec<SourceInstanceInfo>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn remove_metadata<'life0, 'life1, 'async_trait>(
        &'life0 self,
        source_id: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = MetadataResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn remove_worker<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        source_id: &'life1 str,
        worker_id: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = MetadataResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn list_sources<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = MetadataResult<Vec<(String, String)>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn update_status<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        source_id: &'life1 str,
        worker_id: &'life2 str,
        worker_rank: u32,
        status: SourceStatus,
        updated_at: i64,
    ) -> Pin<Box<dyn Future<Output = MetadataResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

Trait for metadata backend implementations

Required Methods§

Source

fn connect<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = MetadataResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Connect to the backend (initialize connections, etc.)

Source

fn publish_metadata<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, identity: &'life1 SourceIdentity, worker_id: &'life2 str, worker: WorkerMetadata, ) -> Pin<Box<dyn Future<Output = MetadataResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Publish metadata for a source worker. worker_id uniquely identifies this running pod/process among all replicas with the same identity. The backend derives mx_source_id from identity.

Source

fn get_metadata<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, source_id: &'life1 str, worker_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = MetadataResult<Option<ModelMetadataRecord>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Get full tensor metadata for one specific worker. Returns None if the worker is not found.

Source

fn list_workers<'life0, 'async_trait>( &'life0 self, source_id: Option<String>, status_filter: Option<SourceStatus>, ) -> Pin<Box<dyn Future<Output = MetadataResult<Vec<SourceInstanceInfo>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List available workers, optionally filtered by source_id and status. source_id: if Some, return only workers for that source; if None, all sources. status_filter: if Some(s), return only workers where all workers have status s.

Source

fn remove_metadata<'life0, 'life1, 'async_trait>( &'life0 self, source_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = MetadataResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Remove all workers of a source by mx_source_id

Source

fn remove_worker<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, source_id: &'life1 str, worker_id: &'life2 str, ) -> Pin<Box<dyn Future<Output = MetadataResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Remove a single worker by source_id and worker_id. Used by the reaper to garbage-collect individual stale entries.

Source

fn list_sources<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = MetadataResult<Vec<(String, String)>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

List all registered source IDs and their model names

Source

fn update_status<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, source_id: &'life1 str, worker_id: &'life2 str, worker_rank: u32, status: SourceStatus, updated_at: i64, ) -> Pin<Box<dyn Future<Output = MetadataResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Patch the status of a worker for a specific worker.

Implementors§