64 lines
2.1 KiB
Python
64 lines
2.1 KiB
Python
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
|
|
import grpc
|
|
|
|
import MyRaft.raft_pb2 as raft__pb2
|
|
|
|
|
|
class RaftStub(object):
|
|
# missing associated documentation comment in .proto file
|
|
pass
|
|
|
|
def __init__(self, channel):
|
|
"""Constructor.
|
|
|
|
Args:
|
|
channel: A grpc.Channel.
|
|
"""
|
|
self.AppendEntriesRPC = channel.unary_unary(
|
|
'/raft.Raft/AppendEntriesRPC',
|
|
request_serializer=raft__pb2.AppendEntries.SerializeToString,
|
|
response_deserializer=raft__pb2.AppendEntriesResponse.FromString,
|
|
)
|
|
self.RequestVoteRPC = channel.unary_unary(
|
|
'/raft.Raft/RequestVoteRPC',
|
|
request_serializer=raft__pb2.RequestVote.SerializeToString,
|
|
response_deserializer=raft__pb2.RequestVoteResponse.FromString,
|
|
)
|
|
|
|
|
|
class RaftServicer(object):
|
|
# missing associated documentation comment in .proto file
|
|
pass
|
|
|
|
def AppendEntriesRPC(self, request, context):
|
|
# missing associated documentation comment in .proto file
|
|
pass
|
|
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
context.set_details('Method not implemented!')
|
|
raise NotImplementedError('Method not implemented!')
|
|
|
|
def RequestVoteRPC(self, request, context):
|
|
# missing associated documentation comment in .proto file
|
|
pass
|
|
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
|
|
context.set_details('Method not implemented!')
|
|
raise NotImplementedError('Method not implemented!')
|
|
|
|
|
|
def add_RaftServicer_to_server(servicer, server):
|
|
rpc_method_handlers = {
|
|
'AppendEntriesRPC': grpc.unary_unary_rpc_method_handler(
|
|
servicer.AppendEntriesRPC,
|
|
request_deserializer=raft__pb2.AppendEntries.FromString,
|
|
response_serializer=raft__pb2.AppendEntriesResponse.SerializeToString,
|
|
),
|
|
'RequestVoteRPC': grpc.unary_unary_rpc_method_handler(
|
|
servicer.RequestVoteRPC,
|
|
request_deserializer=raft__pb2.RequestVote.FromString,
|
|
response_serializer=raft__pb2.RequestVoteResponse.SerializeToString,
|
|
),
|
|
}
|
|
generic_handler = grpc.method_handlers_generic_handler(
|
|
'raft.Raft', rpc_method_handlers)
|
|
server.add_generic_rpc_handlers((generic_handler,))
|