Client

Add the src/client.rs file and import a few types:

use failure::Error;
use grpc_ring::Remote;
use std::env;

We need a generic Error from the failure crate, because it's a universal type for most error handling cases, and import the Remote struct we created before.

The client is an extremely simple tool. It calls the StartRollCall remote gRPC method of a service with the address provided in the NEXT environment variable:

fn main() -> Result<(), Error> {
let next = env::var("NEXT")?.parse()?;
let remote = Remote::new(next)?;
remote.start_roll_call()?;
Ok(())
}

Create the Remote instance with the parsed SocketAddr value and perform a call. This is it. The server is very complex. Let's implement it.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.107.193