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§
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>
sourcefn public_key(&self) -> &DecodingKey
fn public_key(&self) -> &DecodingKey
Return a JWT decoding key for verifying credentials.
sourcefn public_key_bytes(&self) -> &[u8] ⓘ
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.
sourcefn private_key(&self) -> &EncodingKey
fn private_key(&self) -> &EncodingKey
Return a JWT encoding key for signing credentials.
sourcefn 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,
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 await
ing the method never blocks.