pub trait Provider<E = Error>: Sync {
// Provided methods
fn init(
&self,
init_config: impl ProviderInitConfig,
) -> impl Future<Output = Result<(), E>> + Send { ... }
fn on_config_update(
&self,
update: impl ProviderConfigUpdate,
) -> impl Future<Output = Result<(), E>> + Send { ... }
fn receive_link_config_as_source(
&self,
config: LinkConfig<'_>,
) -> impl Future<Output = Result<(), E>> + Send { ... }
fn receive_link_config_as_target(
&self,
config: LinkConfig<'_>,
) -> impl Future<Output = Result<(), E>> + Send { ... }
fn delete_link_as_target(
&self,
_info: impl LinkDeleteInfo,
) -> impl Future<Output = Result<(), E>> + Send { ... }
fn delete_link_as_source(
&self,
_info: impl LinkDeleteInfo,
) -> impl Future<Output = Result<(), E>> + Send { ... }
fn health_request(
&self,
_arg: &HealthCheckRequest,
) -> impl Future<Output = Result<HealthCheckResponse, E>> + Send { ... }
fn shutdown(&self) -> impl Future<Output = Result<(), E>> + Send { ... }
}
Expand description
Capability Provider handling of messages from host
Provided Methods§
sourcefn init(
&self,
init_config: impl ProviderInitConfig,
) -> impl Future<Output = Result<(), E>> + Send
fn init( &self, init_config: impl ProviderInitConfig, ) -> impl Future<Output = Result<(), E>> + Send
Initialize the provider
§Arguments
static_config
- Merged named configuration attached to the provider prior to startup
sourcefn on_config_update(
&self,
update: impl ProviderConfigUpdate,
) -> impl Future<Output = Result<(), E>> + Send
fn on_config_update( &self, update: impl ProviderConfigUpdate, ) -> impl Future<Output = Result<(), E>> + Send
Process a configuration update for the provider
Providers are configured with zero or more config names which the host combines into a single config that they are provided with.
As named configurations change over time, the host makes updates to the bundles of configuration that are relevant to this provider, and this method helps the provider handle those changes.
For more information on how these updates are delivered, see run_provider()
§Arguments
update
- The relevant configuration update
sourcefn receive_link_config_as_source(
&self,
config: LinkConfig<'_>,
) -> impl Future<Output = Result<(), E>> + Send
fn receive_link_config_as_source( &self, config: LinkConfig<'_>, ) -> impl Future<Output = Result<(), E>> + Send
Receive and handle a link that has been established on the lattice where this provider is the source.
Implement this when your provider needs to call other components.
Links are uni-directional – a “source” operates as one end of the link, linking to a “target”. When a link is created on the lattice, and this provider is the source, this method is called.
sourcefn receive_link_config_as_target(
&self,
config: LinkConfig<'_>,
) -> impl Future<Output = Result<(), E>> + Send
fn receive_link_config_as_target( &self, config: LinkConfig<'_>, ) -> impl Future<Output = Result<(), E>> + Send
Receive and handle a link that has been established on the lattice where this provider is the target.
Implement this when your provider is called by other components.
Links are uni-directional – a “source” operates as one end of the link, linking to a “target”. When a link is created on the lattice, and this provider is the target, this method is called.
sourcefn delete_link_as_target(
&self,
_info: impl LinkDeleteInfo,
) -> impl Future<Output = Result<(), E>> + Send
fn delete_link_as_target( &self, _info: impl LinkDeleteInfo, ) -> impl Future<Output = Result<(), E>> + Send
Notify the provider that the link is dropped where the provider is the target
sourcefn delete_link_as_source(
&self,
_info: impl LinkDeleteInfo,
) -> impl Future<Output = Result<(), E>> + Send
fn delete_link_as_source( &self, _info: impl LinkDeleteInfo, ) -> impl Future<Output = Result<(), E>> + Send
Notify the provider that the link is dropped where the provider is the source
sourcefn health_request(
&self,
_arg: &HealthCheckRequest,
) -> impl Future<Output = Result<HealthCheckResponse, E>> + Send
fn health_request( &self, _arg: &HealthCheckRequest, ) -> impl Future<Output = Result<HealthCheckResponse, E>> + Send
Perform health check. Called at regular intervals by host Default implementation always returns healthy