pub struct Server<V: Vm> {
pub vm: Arc<RwLock<V>>,
pub process_metrics: Arc<RwLock<Registry>>,
pub stop_ch: Sender<()>,
}
Fields§
§vm: Arc<RwLock<V>>
Underlying Vm implementation.
process_metrics: Arc<RwLock<Registry>>
Subnet Prometheus process metrics.
stop_ch: Sender<()>
Stop channel broadcast producer.
Implementations§
Trait Implementations§
source§impl<V> Vm for Server<V>where
V: Vm<DatabaseManager = DatabaseManager, AppSender = AppSenderClient> + Send + Sync + 'static,
impl<V> Vm for Server<V>where V: Vm<DatabaseManager = DatabaseManager, AppSender = AppSenderClient> + Send + Sync + 'static,
source§fn create_handlers<'life0, 'async_trait>(
&'life0 self,
_req: Request<Empty>
) -> Pin<Box<dyn Future<Output = Result<Response<CreateHandlersResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create_handlers<'life0, 'async_trait>( &'life0 self, _req: Request<Empty> ) -> Pin<Box<dyn Future<Output = Result<Response<CreateHandlersResponse>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Creates the HTTP handlers for custom chain network calls. This creates and exposes handlers that the outside world can use to communicate with the chain. Each handler has the path:
Returns a mapping from [extension]s to HTTP handlers. Each extension can specify how locking is managed for convenience.
For example, if this VM implements an account-based payments system,
it have an extension called accounts
, where clients could get
information about their accounts.
source§fn create_static_handlers<'life0, 'async_trait>(
&'life0 self,
_req: Request<Empty>
) -> Pin<Box<dyn Future<Output = Result<Response<CreateStaticHandlersResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn create_static_handlers<'life0, 'async_trait>( &'life0 self, _req: Request<Empty> ) -> Pin<Box<dyn Future<Output = Result<Response<CreateStaticHandlersResponse>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Creates the HTTP handlers for custom VM network calls.
This creates and exposes handlers that the outside world can use to communicate with a static reference to the VM. Each handler has the path: [Address of node]/ext/VM/[VM ID]/[extension]
Returns a mapping from [extension]s to HTTP handlers.
Each extension can specify how locking is managed for convenience.
For example, it might make sense to have an extension for creating genesis bytes this VM can interpret.
source§fn get_block<'life0, 'async_trait>(
&'life0 self,
req: Request<GetBlockRequest>
) -> Pin<Box<dyn Future<Output = Result<Response<GetBlockResponse>, Status>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_block<'life0, 'async_trait>( &'life0 self, req: Request<GetBlockRequest> ) -> Pin<Box<dyn Future<Output = Result<Response<GetBlockResponse>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Attempt to load a block.
If the block does not exist, an empty GetBlockResponse is returned with an error code.
It is expected that blocks that have been successfully verified should be returned correctly. It is also expected that blocks that have been accepted by the consensus engine should be able to be fetched. It is not required for blocks that have been rejected by the consensus engine to be able to be fetched.
ref: https://pkg.go.dev/github.com/ava-labs/avalanchego/snow/engine/snowman/block#Getter
fn initialize<'life0, 'async_trait>( &'life0 self, req: Request<InitializeRequest> ) -> Pin<Box<dyn Future<Output = Result<Response<InitializeResponse>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn shutdown<'life0, 'async_trait>( &'life0 self, _req: Request<Empty> ) -> Pin<Box<dyn Future<Output = Result<Response<Empty>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn build_block<'life0, 'async_trait>( &'life0 self, _req: Request<BuildBlockRequest> ) -> Pin<Box<dyn Future<Output = Result<Response<BuildBlockResponse>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn parse_block<'life0, 'async_trait>( &'life0 self, req: Request<ParseBlockRequest> ) -> Pin<Box<dyn Future<Output = Result<Response<ParseBlockResponse>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn set_state<'life0, 'async_trait>( &'life0 self, req: Request<SetStateRequest> ) -> Pin<Box<dyn Future<Output = Result<Response<SetStateResponse>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn set_preference<'life0, 'async_trait>( &'life0 self, req: Request<SetPreferenceRequest> ) -> Pin<Box<dyn Future<Output = Result<Response<Empty>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn health<'life0, 'async_trait>( &'life0 self, _req: Request<Empty> ) -> Pin<Box<dyn Future<Output = Result<Response<HealthResponse>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn version<'life0, 'async_trait>( &'life0 self, _req: Request<Empty> ) -> Pin<Box<dyn Future<Output = Result<Response<VersionResponse>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn connected<'life0, 'async_trait>( &'life0 self, req: Request<ConnectedRequest> ) -> Pin<Box<dyn Future<Output = Result<Response<Empty>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn disconnected<'life0, 'async_trait>( &'life0 self, req: Request<DisconnectedRequest> ) -> Pin<Box<dyn Future<Output = Result<Response<Empty>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn app_request<'life0, 'async_trait>( &'life0 self, req: Request<AppRequestMsg> ) -> Pin<Box<dyn Future<Output = Result<Response<Empty>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn app_request_failed<'life0, 'async_trait>( &'life0 self, req: Request<AppRequestFailedMsg> ) -> Pin<Box<dyn Future<Output = Result<Response<Empty>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn app_response<'life0, 'async_trait>( &'life0 self, req: Request<AppResponseMsg> ) -> Pin<Box<dyn Future<Output = Result<Response<Empty>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn app_gossip<'life0, 'async_trait>( &'life0 self, req: Request<AppGossipMsg> ) -> Pin<Box<dyn Future<Output = Result<Response<Empty>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn block_verify<'life0, 'async_trait>( &'life0 self, req: Request<BlockVerifyRequest> ) -> Pin<Box<dyn Future<Output = Result<Response<BlockVerifyResponse>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn block_accept<'life0, 'async_trait>( &'life0 self, req: Request<BlockAcceptRequest> ) -> Pin<Box<dyn Future<Output = Result<Response<Empty>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn block_reject<'life0, 'async_trait>( &'life0 self, req: Request<BlockRejectRequest> ) -> Pin<Box<dyn Future<Output = Result<Response<Empty>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn get_ancestors<'life0, 'async_trait>( &'life0 self, _req: Request<GetAncestorsRequest> ) -> Pin<Box<dyn Future<Output = Result<Response<GetAncestorsResponse>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn batched_parse_block<'life0, 'async_trait>( &'life0 self, _req: Request<BatchedParseBlockRequest> ) -> Pin<Box<dyn Future<Output = Result<Response<BatchedParseBlockResponse>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn gather<'life0, 'async_trait>( &'life0 self, _req: Request<Empty> ) -> Pin<Box<dyn Future<Output = Result<Response<GatherResponse>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn cross_chain_app_request<'life0, 'async_trait>( &'life0 self, req: Request<CrossChainAppRequestMsg> ) -> Pin<Box<dyn Future<Output = Result<Response<Empty>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn cross_chain_app_request_failed<'life0, 'async_trait>( &'life0 self, req: Request<CrossChainAppRequestFailedMsg> ) -> Pin<Box<dyn Future<Output = Result<Response<Empty>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn cross_chain_app_response<'life0, 'async_trait>( &'life0 self, req: Request<CrossChainAppResponseMsg> ) -> Pin<Box<dyn Future<Output = Result<Response<Empty>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn state_sync_enabled<'life0, 'async_trait>( &'life0 self, _req: Request<Empty> ) -> Pin<Box<dyn Future<Output = Result<Response<StateSyncEnabledResponse>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn get_ongoing_sync_state_summary<'life0, 'async_trait>( &'life0 self, _req: Request<Empty> ) -> Pin<Box<dyn Future<Output = Result<Response<GetOngoingSyncStateSummaryResponse>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn parse_state_summary<'life0, 'async_trait>( &'life0 self, _req: Request<ParseStateSummaryRequest> ) -> Pin<Box<dyn Future<Output = Result<Response<ParseStateSummaryResponse>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn get_state_summary<'life0, 'async_trait>( &'life0 self, _req: Request<GetStateSummaryRequest> ) -> Pin<Box<dyn Future<Output = Result<Response<GetStateSummaryResponse>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn get_last_state_summary<'life0, 'async_trait>( &'life0 self, _req: Request<Empty> ) -> Pin<Box<dyn Future<Output = Result<Response<GetLastStateSummaryResponse>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn state_summary_accept<'life0, 'async_trait>( &'life0 self, _req: Request<StateSummaryAcceptRequest> ) -> Pin<Box<dyn Future<Output = Result<Response<StateSummaryAcceptResponse>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn verify_height_index<'life0, 'async_trait>( &'life0 self, _req: Request<Empty> ) -> Pin<Box<dyn Future<Output = Result<Response<VerifyHeightIndexResponse>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
fn get_block_id_at_height<'life0, 'async_trait>( &'life0 self, _req: Request<GetBlockIdAtHeightRequest> ) -> Pin<Box<dyn Future<Output = Result<Response<GetBlockIdAtHeightResponse>, Status>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,
Auto Trait Implementations§
impl<V> !RefUnwindSafe for Server<V>
impl<V> Send for Server<V>where V: Send + Sync,
impl<V> Sync for Server<V>where V: Send + Sync,
impl<V> Unpin for Server<V>
impl<V> !UnwindSafe for Server<V>
Blanket Implementations§
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request