January 2019
Intermediate to advanced
520 pages
14h 32m
English
Now we can implement gRPC methods of the Ring service we declared in the ring.proto file before. We have the Ring trait with the same names of the methods. Every method expects the Empty value and has to return this type, because we defined this in the declaration. Also, every method has to return the SingleResponse type as a result. We already defined the send_action method that sends the Action value to a worker and returns the SingleResponse response with the Empty value. Let's use the send_action method for both methods we have to implement:
impl Ring for RingImpl { fn start_roll_call(&self, _: RequestOptions, _: Empty) -> SingleResponse<Empty> { trace!("START_ROLL_CALL"); self.send_action(Action::StartRollCall) } fn mark_itself(&self, ...Read now
Unlock full access