wasmcloud_interface_polling

Trait Polling

Source
pub trait Polling {
    // Required methods
    fn poll_tx<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        ctx: &'life1 Context,
        arg: &'life2 PollRequest,
    ) -> Pin<Box<dyn Future<Output = RpcResult<PollResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn add_poll_target<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        ctx: &'life1 Context,
        arg: &'life2 AddPollTargetRequest,
    ) -> Pin<Box<dyn Future<Output = RpcResult<AddPollTargetResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn remove_poll_target<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        ctx: &'life1 Context,
        arg: &'life2 RemovePollTargetRequest,
    ) -> Pin<Box<dyn Future<Output = RpcResult<RemovePollTargetResponse>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;

    // Provided method
    fn contract_id() -> &'static str { ... }
}
Expand description

The Polling interface describes a service that automatically polls external services/hardware at a set interval, or a service which simply ensures an actor performs certain functionality at a set interval without any external input from the Polling service itself.

The AddPollTarget and RemovePollTarget operations may not be necessary for all implementations; some implementations might monitor heartbeats from sources configured in the link definition rather than manually adding or removing targets. wasmbus.contractId: wasmcloud:polling wasmbus.providerReceive

Required Methods§

Source

fn poll_tx<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 Context, arg: &'life2 PollRequest, ) -> Pin<Box<dyn Future<Output = RpcResult<PollResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Manually request the provider to poll any external services/hardware

Source

fn add_poll_target<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 Context, arg: &'life2 AddPollTargetRequest, ) -> Pin<Box<dyn Future<Output = RpcResult<AddPollTargetResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Add a new target to be regularly polled

Source

fn remove_poll_target<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, ctx: &'life1 Context, arg: &'life2 RemovePollTargetRequest, ) -> Pin<Box<dyn Future<Output = RpcResult<RemovePollTargetResponse>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Remove a target that’s currently being polled so it will no longer be polled

Provided Methods§

Source

fn contract_id() -> &'static str

returns the capability contract id for this interface

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§