January 2019
Intermediate to advanced
520 pages
14h 32m
English
Add the src/server.rs source file and add generated modules to it:
mod ring;mod ring_grpc;
We need these modules because we will implement the Ring trait for our RPC handler. Look at the types we will use:
use crate::ring::Empty;use crate::ring_grpc::{Ring, RingServer};use failure::Error;use grpc::{Error as GrpcError, ServerBuilder, SingleResponse, RequestOptions};use grpc_ring::Remote;use log::{debug, trace};use std::env;use std::net::SocketAddr;use std::sync::Mutex;use std::sync::mpsc::{channel, Receiver, Sender};
The types you are not familiar with yet are ServerBuilder, which is used to create a server instance and fill it with service implementations, and SingleResponse is the result of handler calls. The other ...
Read now
Unlock full access