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§
Sourceasync fn handshake(
self,
context: Context,
handshake: Handshake,
) -> Result<(), ReconcileError>
async fn handshake( self, context: Context, handshake: Handshake, ) -> Result<(), ReconcileError>
Handshake with some initial connection details.
Sourceasync fn get_addrs(
self,
context: Context,
) -> (PortConfig, Option<IpAddr>, Vec<IpAddr>)
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.
Sourceasync fn reconcile(
self,
context: Context,
to: AgentState,
) -> Result<(), ReconcileError>
async fn reconcile( self, context: Context, to: AgentState, ) -> Result<(), ReconcileError>
Control plane instructs the agent to reconcile towards a particular state.
Sourceasync fn broadcast_tx(
self,
context: Context,
tx: String,
) -> Result<(), AgentError>
async fn broadcast_tx( self, context: Context, tx: String, ) -> Result<(), AgentError>
Broadcast a transaction locally
Sourceasync fn snarkos_get(
self,
context: Context,
route: String,
) -> Result<String, SnarkosRequestError>
async fn snarkos_get( self, context: Context, route: String, ) -> Result<String, SnarkosRequestError>
Make a GET request to the snarkos server
Locally execute an authorization, using the given query environment id is passed so the agent can determine which aot binary to use
async fn get_metric(self, context: Context, metric: AgentMetric) -> f64
async fn set_log_level( self, context: Context, level: String, ) -> Result<(), AgentError>
Sourceasync fn find_transaction(
self,
context: Context,
tx_id: String,
) -> Result<Option<String>, AgentError>
async fn find_transaction( self, context: Context, tx_id: String, ) -> Result<Option<String>, AgentError>
Find a transaction’s block hash by its transaction id
Sourceasync fn get_snarkos_block_lite(
self,
context: Context,
block_hash: String,
) -> Result<Option<SnarkOSLiteBlock>, AgentError>
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
async fn set_aot_log_level( self, context: Context, verbosity: u8, ) -> Result<(), AgentError>
async fn get_status(self, context: Context) -> Result<AgentStatus, AgentError>
Provided Methods§
Sourcefn serve(self) -> ServeAgentService<Self>
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.