Skip to main content

ServerHooks

Trait ServerHooks 

Source
pub trait ServerHooks: Send + Sync {
    // Required methods
    fn hold_wan_for_unavailable(
        &self,
        mstore: &Store,
        handler: &ReactiveHandler,
        req: &InjectionRequest,
    ) -> bool;
    fn give_back_for_unavailable(
        &self,
        mstore: &Store,
        handler: &ReactiveHandler,
        req: &InjectionRequest,
    ) -> bool;
    fn agent_unavailable(
        &self,
        mstore: &Store,
        handler: &ReactiveHandler,
        target: &str,
    ) -> bool;
    fn hold_relayed<'a>(
        &'a self,
        req: &'a InjectionRequest,
    ) -> BoxFuture<'a, bool>;
    fn settle_files(&self, req: &InjectionRequest, delivered: bool);
    fn resolve_transcript_request_tier_fields(
        &self,
        mstore: &Arc<Store>,
        req: &mut InjectionRequest,
    );
    fn fetch_files<'a>(
        &'a self,
        base: &'a str,
        http: &'a Client,
        token: &'a str,
        agent_id: &'a str,
        req: &'a mut InjectionRequest,
        files: Vec<CloudFile>,
        wan_msg_id: Option<&'a str>,
    ) -> BoxFuture<'a, Result<(), String>>;
    fn prepare_files<'a>(
        &'a self,
        req: &'a mut InjectionRequest,
    ) -> BoxFuture<'a, ()>;
}
Expand description

The server-side steps of delivering a relayed message.

Required Methods§

Source

fn hold_wan_for_unavailable( &self, mstore: &Store, handler: &ReactiveHandler, req: &InjectionRequest, ) -> bool

Verified and its agent can’t work now: keep it here until it can. true when it is kept.

Source

fn give_back_for_unavailable( &self, mstore: &Store, handler: &ReactiveHandler, req: &InjectionRequest, ) -> bool

Not held, and its agent can’t work now (out of quota, signed out): injecting it would start a turn that ends in an error. true when the caller gives the claim back to the relay instead.

Source

fn agent_unavailable( &self, mstore: &Store, handler: &ReactiveHandler, target: &str, ) -> bool

The agent here that target names can’t work now (out of quota, signed out).

Source

fn hold_relayed<'a>(&'a self, req: &'a InjectionRequest) -> BoxFuture<'a, bool>

A routine message to a session gone cold waits for its next activity. true when it is kept.

Source

fn settle_files(&self, req: &InjectionRequest, delivered: bool)

A message’s inline files are charged until it is delivered; give the charge back when it was not.

Source

fn resolve_transcript_request_tier_fields( &self, mstore: &Arc<Store>, req: &mut InjectionRequest, )

The two tier fields a transcript request carries, from the responding agent’s own definition.

Source

fn fetch_files<'a>( &'a self, base: &'a str, http: &'a Client, token: &'a str, agent_id: &'a str, req: &'a mut InjectionRequest, files: Vec<CloudFile>, wan_msg_id: Option<&'a str>, ) -> BoxFuture<'a, Result<(), String>>

Check a cloud manifest, then fetch, decrypt and store each file. Err when the relay could not be reached, so the caller releases the claim.

Source

fn prepare_files<'a>( &'a self, req: &'a mut InjectionRequest, ) -> BoxFuture<'a, ()>

List the fetched files in the message the agent reads.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§