AgentService

Trait AgentService 

Source
pub trait AgentService: Sized {
Show 14 methods // Required methods async fn handshake( self, context: Context, handshake: Handshake, ) -> Result<(), ReconcileError>; async fn get_addrs( self, context: Context, ) -> (PortConfig, Option<IpAddr>, Vec<IpAddr>); async fn reconcile( self, context: Context, to: AgentState, ) -> Result<(), ReconcileError>; async fn broadcast_tx( self, context: Context, tx: String, ) -> Result<(), AgentError>; async fn snarkos_get( self, context: Context, route: String, ) -> Result<String, SnarkosRequestError>; async fn kill(self, context: Context); async fn execute_authorization( self, context: Context, env_id: EnvId, network: NetworkId, query: String, auth: String, ) -> Result<String, AgentError>; async fn get_metric(self, context: Context, metric: AgentMetric) -> f64; async fn set_log_level( self, context: Context, level: String, ) -> Result<(), AgentError>; async fn find_transaction( self, context: Context, tx_id: String, ) -> Result<Option<String>, AgentError>; async fn get_snarkos_block_lite( self, context: Context, block_hash: String, ) -> Result<Option<SnarkOSLiteBlock>, AgentError>; async fn set_aot_log_level( self, context: Context, verbosity: u8, ) -> Result<(), AgentError>; async fn get_status( self, context: Context, ) -> Result<AgentStatus, AgentError>; // Provided method fn serve(self) -> ServeAgentService<Self> { ... }
}
Expand description

The RPC service that agents implement as a server.

Required Methods§

Source

async fn handshake( self, context: Context, handshake: Handshake, ) -> Result<(), ReconcileError>

Handshake with some initial connection details.

Source

async fn get_addrs( self, context: Context, ) -> (PortConfig, Option<IpAddr>, Vec<IpAddr>)

Control plane asks the agent for its external network address, along with local addrs.

Source

async fn reconcile( self, context: Context, to: AgentState, ) -> Result<(), ReconcileError>

Control plane instructs the agent to reconcile towards a particular state.

Source

async fn broadcast_tx( self, context: Context, tx: String, ) -> Result<(), AgentError>

Broadcast a transaction locally

Source

async fn snarkos_get( self, context: Context, route: String, ) -> Result<String, SnarkosRequestError>

Make a GET request to the snarkos server

Source

async fn kill(self, context: Context)

Close the agent process

Source

async fn execute_authorization( self, context: Context, env_id: EnvId, network: NetworkId, query: String, auth: String, ) -> Result<String, AgentError>

Locally execute an authorization, using the given query environment id is passed so the agent can determine which aot binary to use

Source

async fn get_metric(self, context: Context, metric: AgentMetric) -> f64

Source

async fn set_log_level( self, context: Context, level: String, ) -> Result<(), AgentError>

Source

async fn find_transaction( self, context: Context, tx_id: String, ) -> Result<Option<String>, AgentError>

Find a transaction’s block hash by its transaction id

Source

async fn get_snarkos_block_lite( self, context: Context, block_hash: String, ) -> Result<Option<SnarkOSLiteBlock>, AgentError>

Get a block info and transaction data from the agent’s running node

Source

async fn set_aot_log_level( self, context: Context, verbosity: u8, ) -> Result<(), AgentError>

Source

async fn get_status(self, context: Context) -> Result<AgentStatus, AgentError>

Provided Methods§

Source

fn serve(self) -> ServeAgentService<Self>

Returns a serving function to use with InFlightRequest::execute.

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§