Beispiel #1
0
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
Beispiel #2
0
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
Beispiel #3
0
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
Beispiel #4
0
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
Beispiel #5
0
def online(addr):
    channel = grpc.insecure_channel(addr)
    stub = raft_pb2_grpc.ControlStub(channel)
    response = stub.Online(raft_pb2.Void())
    channel.close()
    return response