-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
213 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,22 @@ | ||
all: tmux_pb2.py tmux_pb2_grpc.py chrome_extension/chrome_pb.js chrome_extension/chrome_grpc_web_pb.js | ||
|
||
tmux_pb2.py: tmux.proto | ||
python -m grpc_tools.protoc -I. --python_out=. tmux.proto | ||
|
||
tmux_pb2_grpc.py: tmux.proto | ||
python -m grpc_tools.protoc -I. --grpc_python_out=. tmux.proto | ||
all: chrome_pb2.py chrome_pb2_grpc.py chrome_extension/chrome_pb.js chrome_extension/chrome_grpc_web_pb.js tmux_pb2.py tmux_pb2_grpc.py | ||
|
||
test: | ||
python -m unittest discover -p '*test.py' | ||
|
||
chrome_pb2.py: chrome.proto | ||
python -m grpc_tools.protoc -I. --python_out=. chrome.proto | ||
|
||
chrome_pb2_grpc.py: chrome.proto | ||
python -m grpc_tools.protoc -I. --grpc_python_out=. chrome.proto | ||
|
||
chrome_extension/chrome_pb.js: chrome.proto | ||
protoc -I=. chrome.proto --js_out=import_style=commonjs:chrome_extension --grpc-web_out=import_style=commonjs,mode=grpcweb:chrome_extension | ||
|
||
chrome_extension/chrome_grpc_web_pb.js: chrome.proto | ||
protoc -I=. chrome.proto --js_out=import_style=commonjs:chrome_extension --grpc-web_out=import_style=commonjs,mode=grpcweb:chrome_extension | ||
|
||
tmux_pb2.py: tmux.proto | ||
python -m grpc_tools.protoc -I. --python_out=. tmux.proto | ||
|
||
tmux_pb2_grpc.py: tmux.proto | ||
python -m grpc_tools.protoc -I. --grpc_python_out=. tmux.proto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import sys | ||
from wsgiref.simple_server import make_server | ||
import sonora.wsgi | ||
|
||
from google.protobuf import empty_pb2 | ||
|
||
import chrome_pb2_grpc | ||
|
||
|
||
class Chrome(chrome_pb2_grpc.ChromeServicer): | ||
|
||
def __init__(self, span_tracker): | ||
self._span_tracker = span_tracker | ||
|
||
def session_changed(self, request, context): | ||
print(request) | ||
return empty_pb2.Empty() | ||
|
||
|
||
def serve(servicer): | ||
grpc_wsgi_app = sonora.wsgi.grpcWSGI(None) | ||
|
||
with make_server("", 3142, grpc_wsgi_app) as httpd: | ||
chrome_pb2_grpc.add_ChromeServicer_to_server(servicer, grpc_wsgi_app) | ||
httpd.serve_forever() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT! | ||
"""Client and server classes corresponding to protobuf-defined services.""" | ||
import grpc | ||
|
||
import chrome_pb2 as chrome__pb2 | ||
from google.protobuf import empty_pb2 as google_dot_protobuf_dot_empty__pb2 | ||
|
||
|
||
class ChromeStub(object): | ||
"""Missing associated documentation comment in .proto file.""" | ||
|
||
def __init__(self, channel): | ||
"""Constructor. | ||
Args: | ||
channel: A grpc.Channel. | ||
""" | ||
self.session_changed = channel.unary_unary( | ||
'/trackd.Chrome/session_changed', | ||
request_serializer=chrome__pb2.SessionChangedRequest.SerializeToString, | ||
response_deserializer=google_dot_protobuf_dot_empty__pb2.Empty.FromString, | ||
) | ||
|
||
|
||
class ChromeServicer(object): | ||
"""Missing associated documentation comment in .proto file.""" | ||
|
||
def session_changed(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_ChromeServicer_to_server(servicer, server): | ||
rpc_method_handlers = { | ||
'session_changed': grpc.unary_unary_rpc_method_handler( | ||
servicer.session_changed, | ||
request_deserializer=chrome__pb2.SessionChangedRequest.FromString, | ||
response_serializer=google_dot_protobuf_dot_empty__pb2.Empty.SerializeToString, | ||
), | ||
} | ||
generic_handler = grpc.method_handlers_generic_handler( | ||
'trackd.Chrome', rpc_method_handlers) | ||
server.add_generic_rpc_handlers((generic_handler,)) | ||
|
||
|
||
# This class is part of an EXPERIMENTAL API. | ||
class Chrome(object): | ||
"""Missing associated documentation comment in .proto file.""" | ||
|
||
@staticmethod | ||
def session_changed(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, '/trackd.Chrome/session_changed', | ||
chrome__pb2.SessionChangedRequest.SerializeToString, | ||
google_dot_protobuf_dot_empty__pb2.Empty.FromString, | ||
options, channel_credentials, | ||
insecure, call_credentials, compression, wait_for_ready, timeout, metadata) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters