Trait spacetimedb_client_api::NodeDelegate

source ·
pub trait NodeDelegate: Send + Sync {
    // Required methods
    fn gather_metrics(&self) -> Vec<MetricFamily>;
    fn database_instance_context_controller(
        &self
    ) -> &DatabaseInstanceContextController;
    fn host_controller(&self) -> &Arc<HostController>;
    fn client_actor_index(&self) -> &ClientActorIndex;
    fn sendgrid_controller(&self) -> Option<&SendGridController>;
    fn public_key(&self) -> &DecodingKey;
    fn public_key_bytes(&self) -> &[u8] ;
    fn private_key(&self) -> &EncodingKey;
    fn load_module_host_context<'life0, 'async_trait>(
        &'life0 self,
        db: Database,
        instance_id: u64
    ) -> Pin<Box<dyn Future<Output = Result<ModuleHostContext>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
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 Methods§

source

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

source

fn database_instance_context_controller( &self ) -> &DatabaseInstanceContextController

source

fn host_controller(&self) -> &Arc<HostController>

source

fn client_actor_index(&self) -> &ClientActorIndex

source

fn sendgrid_controller(&self) -> Option<&SendGridController>

source

fn public_key(&self) -> &DecodingKey

Return a JWT decoding key for verifying credentials.

source

fn public_key_bytes(&self) -> &[u8]

Return the public key used to verify JWTs, as the bytes of a PEM public key file.

The /identity/public-key route calls this method to return the public key to callers.

source

fn private_key(&self) -> &EncodingKey

Return a JWT encoding key for signing credentials.

source

fn load_module_host_context<'life0, 'async_trait>( &'life0 self, db: Database, instance_id: u64 ) -> Pin<Box<dyn Future<Output = Result<ModuleHostContext>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Load the ModuleHostContext for instance instance_id of Database db.

This method is defined as async, as that obliges the implementer to ensure that any necessary blocking I/O is made async-safe. In other words, it is the responsibility of the implementation to make use of spawn_blocking or block_in_place as appropriate, while the client-api assumes that awaiting the method never blocks.

Implementations on Foreign Types§

source§

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

source§

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

source§

fn database_instance_context_controller( &self ) -> &DatabaseInstanceContextController

source§

fn host_controller(&self) -> &Arc<HostController>

source§

fn client_actor_index(&self) -> &ClientActorIndex

source§

fn public_key(&self) -> &DecodingKey

source§

fn public_key_bytes(&self) -> &[u8]

source§

fn private_key(&self) -> &EncodingKey

source§

fn sendgrid_controller(&self) -> Option<&SendGridController>

source§

fn load_module_host_context<'life0, 'async_trait>( &'life0 self, db: Database, instance_id: u64 ) -> Pin<Box<dyn Future<Output = Result<ModuleHostContext>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Implementors§