Trait ic_agent::agent::ReplicaV2Transport[][src]

pub trait ReplicaV2Transport {
    fn call<'a>(
        &'a self,
        effective_canister_id: Principal,
        envelope: Vec<u8>,
        request_id: RequestId
    ) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send + 'a>>;
fn read_state<'a>(
        &'a self,
        effective_canister_id: Principal,
        envelope: Vec<u8>
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, AgentError>> + Send + 'a>>;
fn query<'a>(
        &'a self,
        effective_canister_id: Principal,
        envelope: Vec<u8>
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, AgentError>> + Send + 'a>>;
fn status<'a>(
        &'a self
    ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>, AgentError>> + Send + 'a>>; }
Expand description

A facade that connects to a Replica and does requests. These requests can be of any type (does not have to be HTTP). This trait is to inverse the control from the Agent over its connection code, and to resolve any direct dependencies to tokio or HTTP code from this crate.

An implementation of this trait for HTTP transport is implemented using Reqwest, with the feature flag reqwest. This might be deprecated in the future.

Any error returned by these methods will bubble up to the code that called the Agent.

Required methods

Sends an asynchronous request to a Replica. The Request ID is non-mutable and depends on the content of the envelope.

This normally corresponds to the /api/v2/canister/<effective_canister_id>/call endpoint.

Sends a synchronous request to a Replica. This call includes the body of the request message itself (envelope).

This normally corresponds to the /api/v2/canister/<effective_canister_id>/read_state endpoint.

Sends a synchronous request to a Replica. This call includes the body of the request message itself (envelope).

This normally corresponds to the /api/v2/canister/<effective_canister_id>/query endpoint.

Sends a status request to the Replica, returning whatever the replica returns. In the current spec v2, this is a CBOR encoded status message, but we are not making this API attach semantics to the response.

Implementors