Skip to content

Commit

Permalink
Merge pull request #59 from sorru94/update-grpc-plugin
Browse files Browse the repository at this point in the history
Update grpc plugin
  • Loading branch information
harlem88 authored Sep 2, 2024
2 parents 06a6c08 + 6fbcd4a commit eeb9848
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 27 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/python-code-generation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ jobs:
uses: actions/cache/restore@v4
with:
path: ./grpc/grpc_python_plugin
key: grpc-python-plugin-v1.58.1
key: grpc-python-plugin-v1.66.1
- name: Compile from source the grpc_python_plugin
if: steps.cache-grpc-python-plugin-restore.outputs.cache-hit != 'true'
run: |
git clone -b v1.58.1 https://github.com/grpc/grpc
git clone -b v1.66.1 https://github.com/grpc/grpc
cd grpc
git submodule update --init
cmake .
Expand Down
19 changes: 15 additions & 4 deletions python/astarteplatform/msghub/config_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def __init__(self, channel):
'/astarteplatform.msghub.MessageHubConfig/SetConfig',
request_serializer=astarteplatform_dot_msghub_dot_config__pb2.ConfigMessage.SerializeToString,
response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
)
_registered_method=True)


class MessageHubConfigServicer(object):
Expand All @@ -44,6 +44,7 @@ def add_MessageHubConfigServicer_to_server(servicer, server):
generic_handler = grpc.method_handlers_generic_handler(
'astarteplatform.msghub.MessageHubConfig', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
server.add_registered_method_handlers('astarteplatform.msghub.MessageHubConfig', rpc_method_handlers)


# This class is part of an EXPERIMENTAL API.
Expand All @@ -61,8 +62,18 @@ def SetConfig(request,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/astarteplatform.msghub.MessageHubConfig/SetConfig',
return grpc.experimental.unary_unary(
request,
target,
'/astarteplatform.msghub.MessageHubConfig/SetConfig',
astarteplatform_dot_msghub_dot_config__pb2.ConfigMessage.SerializeToString,
google_dot_protobuf_dot_empty__pb2.Empty.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
options,
channel_credentials,
insecure,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
_registered_method=True)
91 changes: 71 additions & 20 deletions python/astarteplatform/msghub/message_hub_service_pb2_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,27 @@ def __init__(self, channel):
'/astarteplatform.msghub.MessageHub/Attach',
request_serializer=astarteplatform_dot_msghub_dot_node__pb2.Node.SerializeToString,
response_deserializer=astarteplatform_dot_msghub_dot_astarte__message__pb2.MessageHubEvent.FromString,
)
_registered_method=True)
self.Send = channel.unary_unary(
'/astarteplatform.msghub.MessageHub/Send',
request_serializer=astarteplatform_dot_msghub_dot_astarte__message__pb2.AstarteMessage.SerializeToString,
response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
)
_registered_method=True)
self.Detach = channel.unary_unary(
'/astarteplatform.msghub.MessageHub/Detach',
request_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
)
_registered_method=True)
self.AddInterfaces = channel.unary_unary(
'/astarteplatform.msghub.MessageHub/AddInterfaces',
request_serializer=astarteplatform_dot_msghub_dot_interface__pb2.InterfacesJson.SerializeToString,
response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
)
_registered_method=True)
self.RemoveInterfaces = channel.unary_unary(
'/astarteplatform.msghub.MessageHub/RemoveInterfaces',
request_serializer=astarteplatform_dot_msghub_dot_interface__pb2.InterfacesName.SerializeToString,
response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString,
)
_registered_method=True)


class MessageHubServicer(object):
Expand Down Expand Up @@ -115,6 +115,7 @@ def add_MessageHubServicer_to_server(servicer, server):
generic_handler = grpc.method_handlers_generic_handler(
'astarteplatform.msghub.MessageHub', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
server.add_registered_method_handlers('astarteplatform.msghub.MessageHub', rpc_method_handlers)


# This class is part of an EXPERIMENTAL API.
Expand All @@ -132,11 +133,21 @@ def Attach(request,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_stream(request, target, '/astarteplatform.msghub.MessageHub/Attach',
return grpc.experimental.unary_stream(
request,
target,
'/astarteplatform.msghub.MessageHub/Attach',
astarteplatform_dot_msghub_dot_node__pb2.Node.SerializeToString,
astarteplatform_dot_msghub_dot_astarte__message__pb2.MessageHubEvent.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
options,
channel_credentials,
insecure,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
_registered_method=True)

@staticmethod
def Send(request,
Expand All @@ -149,11 +160,21 @@ def Send(request,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/astarteplatform.msghub.MessageHub/Send',
return grpc.experimental.unary_unary(
request,
target,
'/astarteplatform.msghub.MessageHub/Send',
astarteplatform_dot_msghub_dot_astarte__message__pb2.AstarteMessage.SerializeToString,
google_dot_protobuf_dot_empty__pb2.Empty.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
options,
channel_credentials,
insecure,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
_registered_method=True)

@staticmethod
def Detach(request,
Expand All @@ -166,11 +187,21 @@ def Detach(request,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/astarteplatform.msghub.MessageHub/Detach',
return grpc.experimental.unary_unary(
request,
target,
'/astarteplatform.msghub.MessageHub/Detach',
google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString,
google_dot_protobuf_dot_empty__pb2.Empty.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
options,
channel_credentials,
insecure,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
_registered_method=True)

@staticmethod
def AddInterfaces(request,
Expand All @@ -183,11 +214,21 @@ def AddInterfaces(request,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/astarteplatform.msghub.MessageHub/AddInterfaces',
return grpc.experimental.unary_unary(
request,
target,
'/astarteplatform.msghub.MessageHub/AddInterfaces',
astarteplatform_dot_msghub_dot_interface__pb2.InterfacesJson.SerializeToString,
google_dot_protobuf_dot_empty__pb2.Empty.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
options,
channel_credentials,
insecure,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
_registered_method=True)

@staticmethod
def RemoveInterfaces(request,
Expand All @@ -200,8 +241,18 @@ def RemoveInterfaces(request,
wait_for_ready=None,
timeout=None,
metadata=None):
return grpc.experimental.unary_unary(request, target, '/astarteplatform.msghub.MessageHub/RemoveInterfaces',
return grpc.experimental.unary_unary(
request,
target,
'/astarteplatform.msghub.MessageHub/RemoveInterfaces',
astarteplatform_dot_msghub_dot_interface__pb2.InterfacesName.SerializeToString,
google_dot_protobuf_dot_empty__pb2.Empty.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
options,
channel_credentials,
insecure,
call_credentials,
compression,
wait_for_ready,
timeout,
metadata,
_registered_method=True)
2 changes: 1 addition & 1 deletion scripts/python_codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ codegen () {

if [ ! -d "$DL_DIR/grpc" ]; then
cd "$DL_DIR"
git clone -b v1.58.1 https://github.com/grpc/grpc
git clone -b v1.66.1 https://github.com/grpc/grpc
cd grpc
git submodule update --init
fi
Expand Down

0 comments on commit eeb9848

Please sign in to comment.