Skip to content

Commit

Permalink
added zookeeper proto
Browse files Browse the repository at this point in the history
  • Loading branch information
AlisaLC committed Feb 11, 2024
1 parent f784751 commit d9f7d25
Show file tree
Hide file tree
Showing 10 changed files with 375 additions and 36 deletions.
32 changes: 16 additions & 16 deletions broker/proto/broker_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions broker/proto/broker_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ def __init__(self, channel):
request_serializer=broker__pb2.ReplicaID.SerializeToString,
response_deserializer=broker__pb2.Empty.FromString,
)
self.DropReplica = channel.unary_unary(
'/Broker/DropReplica',
request_serializer=broker__pb2.ReplicaID.SerializeToString,
response_deserializer=broker__pb2.Empty.FromString,
)
self.PushReplica = channel.unary_unary(
'/Broker/PushReplica',
request_serializer=broker__pb2.MessageList.SerializeToString,
Expand Down Expand Up @@ -84,6 +89,12 @@ def LeadReplica(self, request, context):
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def DropReplica(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def PushReplica(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
Expand Down Expand Up @@ -124,6 +135,11 @@ def add_BrokerServicer_to_server(servicer, server):
request_deserializer=broker__pb2.ReplicaID.FromString,
response_serializer=broker__pb2.Empty.SerializeToString,
),
'DropReplica': grpc.unary_unary_rpc_method_handler(
servicer.DropReplica,
request_deserializer=broker__pb2.ReplicaID.FromString,
response_serializer=broker__pb2.Empty.SerializeToString,
),
'PushReplica': grpc.unary_unary_rpc_method_handler(
servicer.PushReplica,
request_deserializer=broker__pb2.MessageList.FromString,
Expand Down Expand Up @@ -229,6 +245,23 @@ def LeadReplica(request,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def DropReplica(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/Broker/DropReplica',
broker__pb2.ReplicaID.SerializeToString,
broker__pb2.Empty.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def PushReplica(request,
target,
Expand Down
30 changes: 30 additions & 0 deletions broker/proto/zookeeper_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

99 changes: 99 additions & 0 deletions broker/proto/zookeeper_pb2_grpc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc

import zookeeper_pb2 as zookeeper__pb2


class ZookeeperStub(object):
"""Missing associated documentation comment in .proto file."""

def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.Ack = channel.unary_unary(
'/Zookeeper/Ack',
request_serializer=zookeeper__pb2.Empty.SerializeToString,
response_deserializer=zookeeper__pb2.Empty.FromString,
)
self.Register = channel.unary_unary(
'/Zookeeper/Register',
request_serializer=zookeeper__pb2.ReplicaRequest.SerializeToString,
response_deserializer=zookeeper__pb2.Empty.FromString,
)


class ZookeeperServicer(object):
"""Missing associated documentation comment in .proto file."""

def Ack(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')

def Register(self, request, context):
"""Missing associated documentation comment in .proto file."""
context.set_code(grpc.StatusCode.UNIMPLEMENTED)
context.set_details('Method not implemented!')
raise NotImplementedError('Method not implemented!')


def add_ZookeeperServicer_to_server(servicer, server):
rpc_method_handlers = {
'Ack': grpc.unary_unary_rpc_method_handler(
servicer.Ack,
request_deserializer=zookeeper__pb2.Empty.FromString,
response_serializer=zookeeper__pb2.Empty.SerializeToString,
),
'Register': grpc.unary_unary_rpc_method_handler(
servicer.Register,
request_deserializer=zookeeper__pb2.ReplicaRequest.FromString,
response_serializer=zookeeper__pb2.Empty.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'Zookeeper', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))


# This class is part of an EXPERIMENTAL API.
class Zookeeper(object):
"""Missing associated documentation comment in .proto file."""

@staticmethod
def Ack(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/Zookeeper/Ack',
zookeeper__pb2.Empty.SerializeToString,
zookeeper__pb2.Empty.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

@staticmethod
def Register(request,
target,
options=(),
channel_credentials=None,
call_credentials=None,
insecure=False,
compression=None,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/Zookeeper/Register',
zookeeper__pb2.ReplicaRequest.SerializeToString,
zookeeper__pb2.Empty.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
9 changes: 5 additions & 4 deletions proto/broker.proto
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ message Message {
}

message MessageList {
int32 replica_id = 1;
string replica_uuid = 1;
repeated Message messages = 2;
}

message ReplicaRequest {
int32 id = 1;
string uuid = 1;
string url = 2;
}

message ReplicaID {
int32 id = 1;
string uuid = 1;
}

message MessageCount {
int32 replica_id = 1;
string replica_uuid = 1;
int32 count = 2;
}

Expand All @@ -43,6 +43,7 @@ service Broker {

rpc SetReplica(ReplicaRequest) returns (Empty) {}
rpc LeadReplica(ReplicaID) returns (Empty) {}
rpc DropReplica(ReplicaID) returns (Empty) {}

rpc PushReplica(MessageList) returns (PushResponse) {}
rpc DropReplicaMessages(MessageCount) returns (Empty) {}
Expand Down
14 changes: 14 additions & 0 deletions proto/zookeeper.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
syntax = "proto3";

message ReplicaRequest {
string uuid = 1;
string url = 2;
}

message Empty {}

service Zookeeper {
rpc Ack(Empty) returns (Empty) {}

rpc Register(ReplicaRequest) returns (Empty) {}
}
32 changes: 16 additions & 16 deletions zookeeper/proto/broker_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d9f7d25

Please sign in to comment.