NodeDelegate

Trait NodeDelegate 

Source
pub trait NodeDelegate: Send + Sync {
    type JwtAuthProviderT: JwtAuthProvider;

    // Required methods
    fn gather_metrics(&self) -> Vec<MetricFamily>;
    fn client_actor_index(&self) -> &ClientActorIndex;
    fn jwt_auth_provider(&self) -> &Self::JwtAuthProviderT;
    fn leader<'life0, 'async_trait>(
        &'life0 self,
        database_id: u64,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Host>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn module_logs_dir(&self, replica_id: u64) -> ModuleLogsDir;
}
Expand description

Defines the state / environment of a SpacetimeDB node from the PoV of the client API.

Types returned here should be considered internal state and never be surfaced to the API.

Required Associated Types§

Required Methods§

Source

fn gather_metrics(&self) -> Vec<MetricFamily>

Source

fn client_actor_index(&self) -> &ClientActorIndex

Source

fn jwt_auth_provider(&self) -> &Self::JwtAuthProviderT

Source

fn leader<'life0, 'async_trait>( &'life0 self, database_id: u64, ) -> Pin<Box<dyn Future<Output = Result<Option<Host>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Return the leader Host of database_id.

Returns None if the current leader is not hosted by this node. The Host is spawned implicitly if not already running.

Source

fn module_logs_dir(&self, replica_id: u64) -> ModuleLogsDir

Implementations on Foreign Types§

Source§

impl<T: NodeDelegate + ?Sized> NodeDelegate for Arc<T>

Source§

type JwtAuthProviderT = <T as NodeDelegate>::JwtAuthProviderT

Source§

fn gather_metrics(&self) -> Vec<MetricFamily>

Source§

fn client_actor_index(&self) -> &ClientActorIndex

Source§

fn jwt_auth_provider(&self) -> &Self::JwtAuthProviderT

Source§

fn leader<'life0, 'async_trait>( &'life0 self, database_id: u64, ) -> Pin<Box<dyn Future<Output = Result<Option<Host>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn module_logs_dir(&self, replica_id: u64) -> ModuleLogsDir

Implementors§