def append_log(addr, logs): channel = grpc.insecure_channel(addr) stub = raft_pb2_grpc.ControlStub(channel) req = raft_pb2.AppendLogRequest() req.log.extend(logs) response = stub.AppendLog(req) channel.close() return response
def kick_off_rpc(addr): channel = grpc.insecure_channel(addr) stub = raft_pb2_grpc.ControlStub(channel) response = stub.Shutdown(raft_pb2.Void()) channel.close() return response
def alive(addr): channel = grpc.insecure_channel(addr) stub = raft_pb2_grpc.ControlStub(channel) response = stub.Alive(raft_pb2.Void(), timeout=0.3) channel.close() return response
def request_log(addr): channel = grpc.insecure_channel(addr) stub = raft_pb2_grpc.ControlStub(channel) response = stub.RequestLog(raft_pb2.Void()) channel.close() return response
def online(addr): channel = grpc.insecure_channel(addr) stub = raft_pb2_grpc.ControlStub(channel) response = stub.Online(raft_pb2.Void()) channel.close() return response