#generated-client #http-request #grpc #proto #protobuf #avalanche #resources

avalanche-proto

Protobuf generated client and server resources for Avalanche gRPC in rust

10 releases (4 breaking)

0.19.0 Nov 6, 2022
0.17.0 Oct 28, 2022
0.15.3 Jul 11, 2022

#2 in #avalanche

BSD-3-Clause

1.5MB
19K SLoC

Crates.io

https://crates.io/crates/avalanche-proto

avalanche-proto

Protobuf generated client and server resources for Avalanche gRPC in rust. The generated stubs use the upstream avalanchego/proto definitions as the source of truth and versioning will align with avalanchego releases.

Versions

Support for avalanchego protocol version 15+.

The release version will align with the protocol version for avalanchego. In our example linked above avalanchego is currently on protocol version 19. This aligns with the minor version of the avalanche-proto release. Patches to minor releases could include improvements or bug fixes.

avalanche-proto = { version = "0.19", features = [] } // supports avalanchego protocol version 19

Usage

use avalanche_proto::{
    http::{
        http_server::Http,
        HttpRequest, HandleSimpleHttpResponse, HandleSimpleHttpRequest
    },
    google::protobuf::Empty,
};
use avalanche_proto::grpcutil;

grpcutil::default_server()
    .add_service(VmServer::new(vm))
    .serve_with_incoming(TcpListenerStream::new(listener))
    .await
    .map_err(|e| {
        Error::new(
            ErrorKind::Other,
            format!("failed to serve vm service: {}", e),
        )
    })

Dependencies

~8–15MB
~195K SLoC