Unified ServeSegments

This commit is contained in:
Eden Kirin
2023-03-22 23:09:54 +01:00
parent 1d26d6625e
commit 1542bd98c2
38 changed files with 1217 additions and 1743 deletions

View File

@ -7,10 +7,7 @@
@startuml @startuml
participant FE as "Frontend" << React >> participant FE as "Frontend" << React >>
participant Funnel as "Funnel" << Python >> participant Funnel as "Funnel" << Python >>
participant Hours as "ServeHours" << Go >> participant Segments as "ServeSegments" << Go >>
participant Minutes as "ServeMinutes" << Go >>
participant Seconds as "ServeSeconds" << Go >>
participant Milliseconds as "ServeMilliseconds" << Go >>
participant CurrentTime as "ServeCurrentTime" << NodeJS >> participant CurrentTime as "ServeCurrentTime" << NodeJS >>
activate FE #hotpink activate FE #hotpink
@ -19,30 +16,30 @@ activate FE #hotpink
loop #ivory loop #ivory
activate Funnel #gold activate Funnel #gold
Funnel -> Hours: GetHours() Funnel -> Segments: GetHours()
activate Hours #skyblue activate Segments #skyblue
Hours -> CurrentTime: GetCurrentTime() Segments -> CurrentTime: GetCurrentTime()
activate CurrentTime #sandybrown activate CurrentTime #sandybrown
return HH:MM:SS.ms return HH:MM:SS.ms
return HH return HH
Funnel -> Minutes: GetMinutes() Funnel -> Segments: GetMinutes()
activate Minutes #skyblue activate Segments #skyblue
Minutes -> CurrentTime: GetCurrentTime() Segments -> CurrentTime: GetCurrentTime()
activate CurrentTime #sandybrown activate CurrentTime #sandybrown
return HH:MM:SS.ms return HH:MM:SS.ms
return MM return MM
Funnel -> Seconds: GetSeconds() Funnel -> Segments: GetSeconds()
activate Seconds #skyblue activate Segments #skyblue
Seconds -> CurrentTime: GetCurrentTime() Segments -> CurrentTime: GetCurrentTime()
activate CurrentTime #sandybrown activate CurrentTime #sandybrown
return HH:MM:SS.ms return HH:MM:SS.ms
return SS return SS
Funnel -> Milliseconds: GetMilliseconds() Funnel -> Segments: GetMilliseconds()
activate Milliseconds #skyblue activate Segments #skyblue
Milliseconds -> CurrentTime: GetCurrentTime() Segments -> CurrentTime: GetCurrentTime()
activate CurrentTime #sandybrown activate CurrentTime #sandybrown
return HH:MM:SS.ms return HH:MM:SS.ms
return ms return ms
@ -61,10 +58,7 @@ deactivate FE
| -- | -- | -- | | -- | -- | -- |
| Funnel | Python | - | | Funnel | Python | - |
| ServeCurrentTime | NodeJS | 50000 | | ServeCurrentTime | NodeJS | 50000 |
| ServeHours | Go | 50001 | | ServeSegments | Go | 50001 |
| ServeMinutes | Go | 50002 |
| ServeSeconds | Go | 50003 |
| ServeMilliseconds | Go | 50004 |
### Funnel ### Funnel

View File

@ -13,9 +13,7 @@ proto:
--python_out=$(STUBS_DIR) \ --python_out=$(STUBS_DIR) \
--pyi_out=$(STUBS_DIR) \ --pyi_out=$(STUBS_DIR) \
--grpc_python_out=$(STUBS_DIR) \ --grpc_python_out=$(STUBS_DIR) \
$(PROTO_DIR)/serve_hours.proto \ $(PROTO_DIR)/serve_segments.proto \
$(PROTO_DIR)/serve_minutes.proto \
$(PROTO_DIR)/serve_seconds.proto \
$(PROTO_DIR)/serve_milliseconds.proto \
$(PROTO_DIR)/serve_currenttime.proto $(PROTO_DIR)/serve_currenttime.proto
@sed -i -E 's/^(import\s[a-zA-Z0-9_]+_pb2)/from . \1/g' $(STUBS_DIR)/*_grpc.py @sed -i -E 's/^(import\s[a-zA-Z0-9_]+_pb2)/from . \1/g' $(STUBS_DIR)/*_grpc.py

View File

@ -1,114 +1,74 @@
from contextlib import contextmanager
import logging import logging
import time import time
from typing import Optional from typing import Generator, Optional
import grpc import grpc
from models import GetCurrentTimeResponse from stubs.serve_segments_pb2_grpc import ServeSegmentsStub
from stubs import ( from stubs.serve_segments_pb2 import (
serve_hours_pb2, GetHoursRequest,
serve_hours_pb2_grpc, GetHoursResponse,
serve_minutes_pb2, GetMinutesRequest,
serve_minutes_pb2_grpc, GetMinutesResponse,
serve_seconds_pb2, GetSecondsRequest,
serve_seconds_pb2_grpc, GetSecondsResponse,
serve_milliseconds_pb2, GetMillisecondsRequest,
serve_milliseconds_pb2_grpc, GetMillisecondsResponse,
) )
from stubs import serve_currenttime_pb2
from stubs import serve_currenttime_pb2_grpc
SERVE_CURRENTTIME_HOST = "localhost" SERVE_CURRENTTIME_HOST = "localhost"
SERVE_CURRENTTIME_PORT = 50000 SERVE_CURRENTTIME_PORT = 50000
SERVE_HOURS_HOST = "localhost" SERVE_SEGMENTS_HOST = "localhost"
SERVE_HOURS_PORT = 50001 SERVE_SEGMENTS_PORT = 50001
SERVE_MINUTES_HOST = "localhost"
SERVE_MINUTES_PORT = 50002
SERVE_SECONDS_HOST = "localhost"
SERVE_SECONDS_PORT = 50003
SERVE_MILLISECONDS_HOST = "localhost"
SERVE_MILLISECONDS_PORT = 50004
TIMEZONE = "Europe/Zagreb" TIMEZONE = "Europe/Zagreb"
def get_hours() -> Optional[int]: @contextmanager
try: def get_serve_segments_stub() -> Generator[ServeSegmentsStub, None, None]:
with grpc.insecure_channel(f"{SERVE_HOURS_HOST}:{SERVE_HOURS_PORT}") as channel: with grpc.insecure_channel(
stub = serve_hours_pb2_grpc.ServeHoursStub(channel) f"{SERVE_SEGMENTS_HOST}:{SERVE_SEGMENTS_PORT}"
response = stub.GetHours(serve_hours_pb2.GetHoursRequest(timezone=TIMEZONE)) ) as channel:
stub = ServeSegmentsStub(channel)
yield stub
def get_hours(stub: ServeSegmentsStub) -> Optional[int]:
response: GetHoursResponse = stub.GetHours(GetHoursRequest(timezone=TIMEZONE))
return response.hours return response.hours
except Exception as ex:
logging.error(ex)
return None
def get_minutes() -> Optional[int]: def get_minutes(stub: ServeSegmentsStub) -> Optional[int]:
try: response: GetMinutesResponse = stub.GetMinutes(GetMinutesRequest(timezone=TIMEZONE))
with grpc.insecure_channel(
f"{SERVE_MINUTES_HOST}:{SERVE_MINUTES_PORT}"
) as channel:
stub = serve_minutes_pb2_grpc.ServeMinutesStub(channel)
response = stub.GetMinutes(
serve_minutes_pb2.GetMinutesRequest(timezone=TIMEZONE)
)
return response.minutes return response.minutes
except Exception as ex:
logging.error(ex)
return None
def get_seconds() -> Optional[int]: def get_seconds(stub: ServeSegmentsStub) -> Optional[int]:
try: response: GetSecondsResponse = stub.GetSeconds(GetSecondsRequest(timezone=TIMEZONE))
with grpc.insecure_channel(
f"{SERVE_SECONDS_HOST}:{SERVE_SECONDS_PORT}"
) as channel:
stub = serve_seconds_pb2_grpc.ServeSecondsStub(channel)
response = stub.GetSeconds(
serve_seconds_pb2.GetSecondsRequest(timezone=TIMEZONE)
)
return response.seconds return response.seconds
except Exception as ex:
logging.error(ex)
return None
def get_milliseconds() -> Optional[int]: def get_milliseconds(stub: ServeSegmentsStub) -> Optional[int]:
try: response: GetMillisecondsResponse = stub.GetMilliseconds(
with grpc.insecure_channel( GetMillisecondsRequest(timezone=TIMEZONE)
f"{SERVE_MILLISECONDS_HOST}:{SERVE_MILLISECONDS_PORT}"
) as channel:
stub = serve_milliseconds_pb2_grpc.ServeMillisecondsStub(channel)
response = stub.GetMilliseconds(
serve_milliseconds_pb2.GetMillisecondsRequest(timezone=TIMEZONE)
) )
return response.milliseconds return response.milliseconds
except Exception as ex:
logging.error(ex)
return None
def get_currenttime() -> GetCurrentTimeResponse:
with grpc.insecure_channel(
f"{SERVE_CURRENTTIME_HOST}:{SERVE_CURRENTTIME_PORT}"
) as channel:
stub = serve_currenttime_pb2_grpc.ServeCurrentTimeServiceStub(channel)
raw_response = stub.GetCurrentTime(
serve_currenttime_pb2.GetCurrentTimeRequest(timezone=TIMEZONE)
)
return GetCurrentTimeResponse.from_orm(raw_response)
def run(): def run():
with get_serve_segments_stub() as stub:
while True:
t = time.perf_counter() t = time.perf_counter()
hours = get_hours() hours = get_hours(stub)
minutes = get_minutes() minutes = get_minutes(stub)
seconds = get_seconds() seconds = get_seconds(stub)
milliseconds = get_milliseconds() milliseconds = get_milliseconds(stub)
t = time.perf_counter() - t t = time.perf_counter() - t
print(f"RESULT: {hours}:{minutes}:{seconds}:{milliseconds}") print(
print(f"T: {t}") f"RESULT: {hours:02d}:{minutes:02d}:{seconds:02d}:{milliseconds:03d}, T: {t}"
)
if __name__ == "__main__": if __name__ == "__main__":

View File

@ -13,13 +13,14 @@ _sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x17serve_currenttime.proto\x12\x11serve_currenttime\")\n\x15GetCurrentTimeRequest\x12\x10\n\x08timezone\x18\x01 \x01(\t\"w\n\x16GetCurrentTimeResponse\x12\r\n\x05hours\x18\x01 \x01(\r\x12\x0f\n\x07minutes\x18\x02 \x01(\r\x12\x0f\n\x07seconds\x18\x03 \x01(\r\x12\x14\n\x0cmilliseconds\x18\x04 \x01(\r\x12\x16\n\x0e\x66ormatted_time\x18\x05 \x01(\t2\x80\x01\n\x17ServeCurrentTimeService\x12\x65\n\x0eGetCurrentTime\x12(.serve_currenttime.GetCurrentTimeRequest\x1a).serve_currenttime.GetCurrentTimeResponseb\x06proto3') DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x17serve_currenttime.proto\x12\x11serve_currenttime\")\n\x15GetCurrentTimeRequest\x12\x10\n\x08timezone\x18\x01 \x01(\t\"w\n\x16GetCurrentTimeResponse\x12\r\n\x05hours\x18\x01 \x01(\r\x12\x0f\n\x07minutes\x18\x02 \x01(\r\x12\x0f\n\x07seconds\x18\x03 \x01(\r\x12\x14\n\x0cmilliseconds\x18\x04 \x01(\r\x12\x16\n\x0e\x66ormatted_time\x18\x05 \x01(\t2\x80\x01\n\x17ServeCurrentTimeService\x12\x65\n\x0eGetCurrentTime\x12(.serve_currenttime.GetCurrentTimeRequest\x1a).serve_currenttime.GetCurrentTimeResponseB.Z,example.com/project/protos/serve_currenttimeb\x06proto3')
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals()) _builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'serve_currenttime_pb2', globals()) _builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'serve_currenttime_pb2', globals())
if _descriptor._USE_C_DESCRIPTORS == False: if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None DESCRIPTOR._options = None
DESCRIPTOR._serialized_options = b'Z,example.com/project/protos/serve_currenttime'
_GETCURRENTTIMEREQUEST._serialized_start=46 _GETCURRENTTIMEREQUEST._serialized_start=46
_GETCURRENTTIMEREQUEST._serialized_end=87 _GETCURRENTTIMEREQUEST._serialized_end=87
_GETCURRENTTIMERESPONSE._serialized_start=89 _GETCURRENTTIMERESPONSE._serialized_start=89

View File

@ -1,30 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: serve_hours.proto
"""Generated protocol buffer code."""
from google.protobuf.internal import builder as _builder
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x11serve_hours.proto\"#\n\x0fGetHoursRequest\x12\x10\n\x08timezone\x18\x01 \x01(\t\"!\n\x10GetHoursResponse\x12\r\n\x05hours\x18\x01 \x01(\r2=\n\nServeHours\x12/\n\x08GetHours\x12\x10.GetHoursRequest\x1a\x11.GetHoursResponseB(Z&example.com/project/protos/serve_hoursb\x06proto3')
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'serve_hours_pb2', globals())
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
DESCRIPTOR._serialized_options = b'Z&example.com/project/protos/serve_hours'
_GETHOURSREQUEST._serialized_start=21
_GETHOURSREQUEST._serialized_end=56
_GETHOURSRESPONSE._serialized_start=58
_GETHOURSRESPONSE._serialized_end=91
_SERVEHOURS._serialized_start=93
_SERVEHOURS._serialized_end=154
# @@protoc_insertion_point(module_scope)

View File

@ -1,17 +0,0 @@
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from typing import ClassVar as _ClassVar, Optional as _Optional
DESCRIPTOR: _descriptor.FileDescriptor
class GetHoursRequest(_message.Message):
__slots__ = ["timezone"]
TIMEZONE_FIELD_NUMBER: _ClassVar[int]
timezone: str
def __init__(self, timezone: _Optional[str] = ...) -> None: ...
class GetHoursResponse(_message.Message):
__slots__ = ["hours"]
HOURS_FIELD_NUMBER: _ClassVar[int]
hours: int
def __init__(self, hours: _Optional[int] = ...) -> None: ...

View File

@ -1,66 +0,0 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from . import serve_hours_pb2 as serve__hours__pb2
class ServeHoursStub(object):
"""Missing associated documentation comment in .proto file."""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.GetHours = channel.unary_unary(
'/ServeHours/GetHours',
request_serializer=serve__hours__pb2.GetHoursRequest.SerializeToString,
response_deserializer=serve__hours__pb2.GetHoursResponse.FromString,
)
class ServeHoursServicer(object):
"""Missing associated documentation comment in .proto file."""
def GetHours(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_ServeHoursServicer_to_server(servicer, server):
rpc_method_handlers = {
'GetHours': grpc.unary_unary_rpc_method_handler(
servicer.GetHours,
request_deserializer=serve__hours__pb2.GetHoursRequest.FromString,
response_serializer=serve__hours__pb2.GetHoursResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'ServeHours', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
# This class is part of an EXPERIMENTAL API.
class ServeHours(object):
"""Missing associated documentation comment in .proto file."""
@staticmethod
def GetHours(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, '/ServeHours/GetHours',
serve__hours__pb2.GetHoursRequest.SerializeToString,
serve__hours__pb2.GetHoursResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

View File

@ -1,29 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: serve_milliseconds.proto
"""Generated protocol buffer code."""
from google.protobuf.internal import builder as _builder
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x18serve_milliseconds.proto\"*\n\x16GetMillisecondsRequest\x12\x10\n\x08timezone\x18\x01 \x01(\t\"/\n\x17GetMillisecondsResponse\x12\x14\n\x0cmilliseconds\x18\x01 \x01(\r2Y\n\x11ServeMilliseconds\x12\x44\n\x0fGetMilliseconds\x12\x17.GetMillisecondsRequest\x1a\x18.GetMillisecondsResponseb\x06proto3')
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'serve_milliseconds_pb2', globals())
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
_GETMILLISECONDSREQUEST._serialized_start=28
_GETMILLISECONDSREQUEST._serialized_end=70
_GETMILLISECONDSRESPONSE._serialized_start=72
_GETMILLISECONDSRESPONSE._serialized_end=119
_SERVEMILLISECONDS._serialized_start=121
_SERVEMILLISECONDS._serialized_end=210
# @@protoc_insertion_point(module_scope)

View File

@ -1,17 +0,0 @@
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from typing import ClassVar as _ClassVar, Optional as _Optional
DESCRIPTOR: _descriptor.FileDescriptor
class GetMillisecondsRequest(_message.Message):
__slots__ = ["timezone"]
TIMEZONE_FIELD_NUMBER: _ClassVar[int]
timezone: str
def __init__(self, timezone: _Optional[str] = ...) -> None: ...
class GetMillisecondsResponse(_message.Message):
__slots__ = ["milliseconds"]
MILLISECONDS_FIELD_NUMBER: _ClassVar[int]
milliseconds: int
def __init__(self, milliseconds: _Optional[int] = ...) -> None: ...

View File

@ -1,66 +0,0 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from . import serve_milliseconds_pb2 as serve__milliseconds__pb2
class ServeMillisecondsStub(object):
"""Missing associated documentation comment in .proto file."""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.GetMilliseconds = channel.unary_unary(
'/ServeMilliseconds/GetMilliseconds',
request_serializer=serve__milliseconds__pb2.GetMillisecondsRequest.SerializeToString,
response_deserializer=serve__milliseconds__pb2.GetMillisecondsResponse.FromString,
)
class ServeMillisecondsServicer(object):
"""Missing associated documentation comment in .proto file."""
def GetMilliseconds(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_ServeMillisecondsServicer_to_server(servicer, server):
rpc_method_handlers = {
'GetMilliseconds': grpc.unary_unary_rpc_method_handler(
servicer.GetMilliseconds,
request_deserializer=serve__milliseconds__pb2.GetMillisecondsRequest.FromString,
response_serializer=serve__milliseconds__pb2.GetMillisecondsResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'ServeMilliseconds', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
# This class is part of an EXPERIMENTAL API.
class ServeMilliseconds(object):
"""Missing associated documentation comment in .proto file."""
@staticmethod
def GetMilliseconds(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, '/ServeMilliseconds/GetMilliseconds',
serve__milliseconds__pb2.GetMillisecondsRequest.SerializeToString,
serve__milliseconds__pb2.GetMillisecondsResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

View File

@ -1,29 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: serve_minutes.proto
"""Generated protocol buffer code."""
from google.protobuf.internal import builder as _builder
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x13serve_minutes.proto\"%\n\x11GetMinutesRequest\x12\x10\n\x08timezone\x18\x01 \x01(\t\"%\n\x12GetMinutesResponse\x12\x0f\n\x07minutes\x18\x01 \x01(\r2E\n\x0cServeMinutes\x12\x35\n\nGetMinutes\x12\x12.GetMinutesRequest\x1a\x13.GetMinutesResponseb\x06proto3')
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'serve_minutes_pb2', globals())
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
_GETMINUTESREQUEST._serialized_start=23
_GETMINUTESREQUEST._serialized_end=60
_GETMINUTESRESPONSE._serialized_start=62
_GETMINUTESRESPONSE._serialized_end=99
_SERVEMINUTES._serialized_start=101
_SERVEMINUTES._serialized_end=170
# @@protoc_insertion_point(module_scope)

View File

@ -1,17 +0,0 @@
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from typing import ClassVar as _ClassVar, Optional as _Optional
DESCRIPTOR: _descriptor.FileDescriptor
class GetMinutesRequest(_message.Message):
__slots__ = ["timezone"]
TIMEZONE_FIELD_NUMBER: _ClassVar[int]
timezone: str
def __init__(self, timezone: _Optional[str] = ...) -> None: ...
class GetMinutesResponse(_message.Message):
__slots__ = ["minutes"]
MINUTES_FIELD_NUMBER: _ClassVar[int]
minutes: int
def __init__(self, minutes: _Optional[int] = ...) -> None: ...

View File

@ -1,66 +0,0 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from . import serve_minutes_pb2 as serve__minutes__pb2
class ServeMinutesStub(object):
"""Missing associated documentation comment in .proto file."""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.GetMinutes = channel.unary_unary(
'/ServeMinutes/GetMinutes',
request_serializer=serve__minutes__pb2.GetMinutesRequest.SerializeToString,
response_deserializer=serve__minutes__pb2.GetMinutesResponse.FromString,
)
class ServeMinutesServicer(object):
"""Missing associated documentation comment in .proto file."""
def GetMinutes(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_ServeMinutesServicer_to_server(servicer, server):
rpc_method_handlers = {
'GetMinutes': grpc.unary_unary_rpc_method_handler(
servicer.GetMinutes,
request_deserializer=serve__minutes__pb2.GetMinutesRequest.FromString,
response_serializer=serve__minutes__pb2.GetMinutesResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'ServeMinutes', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
# This class is part of an EXPERIMENTAL API.
class ServeMinutes(object):
"""Missing associated documentation comment in .proto file."""
@staticmethod
def GetMinutes(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, '/ServeMinutes/GetMinutes',
serve__minutes__pb2.GetMinutesRequest.SerializeToString,
serve__minutes__pb2.GetMinutesResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

View File

@ -1,29 +0,0 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: serve_seconds.proto
"""Generated protocol buffer code."""
from google.protobuf.internal import builder as _builder
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x13serve_seconds.proto\"%\n\x11GetSecondsRequest\x12\x10\n\x08timezone\x18\x01 \x01(\t\"%\n\x12GetSecondsResponse\x12\x0f\n\x07seconds\x18\x01 \x01(\r2E\n\x0cServeSeconds\x12\x35\n\nGetSeconds\x12\x12.GetSecondsRequest\x1a\x13.GetSecondsResponseb\x06proto3')
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'serve_seconds_pb2', globals())
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
_GETSECONDSREQUEST._serialized_start=23
_GETSECONDSREQUEST._serialized_end=60
_GETSECONDSRESPONSE._serialized_start=62
_GETSECONDSRESPONSE._serialized_end=99
_SERVESECONDS._serialized_start=101
_SERVESECONDS._serialized_end=170
# @@protoc_insertion_point(module_scope)

View File

@ -1,17 +0,0 @@
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from typing import ClassVar as _ClassVar, Optional as _Optional
DESCRIPTOR: _descriptor.FileDescriptor
class GetSecondsRequest(_message.Message):
__slots__ = ["timezone"]
TIMEZONE_FIELD_NUMBER: _ClassVar[int]
timezone: str
def __init__(self, timezone: _Optional[str] = ...) -> None: ...
class GetSecondsResponse(_message.Message):
__slots__ = ["seconds"]
SECONDS_FIELD_NUMBER: _ClassVar[int]
seconds: int
def __init__(self, seconds: _Optional[int] = ...) -> None: ...

View File

@ -1,66 +0,0 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from . import serve_seconds_pb2 as serve__seconds__pb2
class ServeSecondsStub(object):
"""Missing associated documentation comment in .proto file."""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.GetSeconds = channel.unary_unary(
'/ServeSeconds/GetSeconds',
request_serializer=serve__seconds__pb2.GetSecondsRequest.SerializeToString,
response_deserializer=serve__seconds__pb2.GetSecondsResponse.FromString,
)
class ServeSecondsServicer(object):
"""Missing associated documentation comment in .proto file."""
def GetSeconds(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_ServeSecondsServicer_to_server(servicer, server):
rpc_method_handlers = {
'GetSeconds': grpc.unary_unary_rpc_method_handler(
servicer.GetSeconds,
request_deserializer=serve__seconds__pb2.GetSecondsRequest.FromString,
response_serializer=serve__seconds__pb2.GetSecondsResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'ServeSeconds', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
# This class is part of an EXPERIMENTAL API.
class ServeSeconds(object):
"""Missing associated documentation comment in .proto file."""
@staticmethod
def GetSeconds(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, '/ServeSeconds/GetSeconds',
serve__seconds__pb2.GetSecondsRequest.SerializeToString,
serve__seconds__pb2.GetSecondsResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

View File

@ -0,0 +1,42 @@
# -*- coding: utf-8 -*-
# Generated by the protocol buffer compiler. DO NOT EDIT!
# source: serve_segments.proto
"""Generated protocol buffer code."""
from google.protobuf.internal import builder as _builder
from google.protobuf import descriptor as _descriptor
from google.protobuf import descriptor_pool as _descriptor_pool
from google.protobuf import symbol_database as _symbol_database
# @@protoc_insertion_point(imports)
_sym_db = _symbol_database.Default()
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x14serve_segments.proto\"#\n\x0fGetHoursRequest\x12\x10\n\x08timezone\x18\x01 \x01(\t\"%\n\x11GetMinutesRequest\x12\x10\n\x08timezone\x18\x01 \x01(\t\"%\n\x11GetSecondsRequest\x12\x10\n\x08timezone\x18\x01 \x01(\t\"*\n\x16GetMillisecondsRequest\x12\x10\n\x08timezone\x18\x01 \x01(\t\"!\n\x10GetHoursResponse\x12\r\n\x05hours\x18\x01 \x01(\r\"%\n\x12GetMinutesResponse\x12\x0f\n\x07minutes\x18\x01 \x01(\r\"%\n\x12GetSecondsResponse\x12\x0f\n\x07seconds\x18\x01 \x01(\r\"/\n\x17GetMillisecondsResponse\x12\x14\n\x0cmilliseconds\x18\x01 \x01(\r2\xf4\x01\n\rServeSegments\x12/\n\x08GetHours\x12\x10.GetHoursRequest\x1a\x11.GetHoursResponse\x12\x35\n\nGetMinutes\x12\x12.GetMinutesRequest\x1a\x13.GetMinutesResponse\x12\x35\n\nGetSeconds\x12\x12.GetSecondsRequest\x1a\x13.GetSecondsResponse\x12\x44\n\x0fGetMilliseconds\x12\x17.GetMillisecondsRequest\x1a\x18.GetMillisecondsResponseB+Z)example.com/project/protos/serve_segmentsb\x06proto3')
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, globals())
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'serve_segments_pb2', globals())
if _descriptor._USE_C_DESCRIPTORS == False:
DESCRIPTOR._options = None
DESCRIPTOR._serialized_options = b'Z)example.com/project/protos/serve_segments'
_GETHOURSREQUEST._serialized_start=24
_GETHOURSREQUEST._serialized_end=59
_GETMINUTESREQUEST._serialized_start=61
_GETMINUTESREQUEST._serialized_end=98
_GETSECONDSREQUEST._serialized_start=100
_GETSECONDSREQUEST._serialized_end=137
_GETMILLISECONDSREQUEST._serialized_start=139
_GETMILLISECONDSREQUEST._serialized_end=181
_GETHOURSRESPONSE._serialized_start=183
_GETHOURSRESPONSE._serialized_end=216
_GETMINUTESRESPONSE._serialized_start=218
_GETMINUTESRESPONSE._serialized_end=255
_GETSECONDSRESPONSE._serialized_start=257
_GETSECONDSRESPONSE._serialized_end=294
_GETMILLISECONDSRESPONSE._serialized_start=296
_GETMILLISECONDSRESPONSE._serialized_end=343
_SERVESEGMENTS._serialized_start=346
_SERVESEGMENTS._serialized_end=590
# @@protoc_insertion_point(module_scope)

View File

@ -0,0 +1,53 @@
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from typing import ClassVar as _ClassVar, Optional as _Optional
DESCRIPTOR: _descriptor.FileDescriptor
class GetHoursRequest(_message.Message):
__slots__ = ["timezone"]
TIMEZONE_FIELD_NUMBER: _ClassVar[int]
timezone: str
def __init__(self, timezone: _Optional[str] = ...) -> None: ...
class GetHoursResponse(_message.Message):
__slots__ = ["hours"]
HOURS_FIELD_NUMBER: _ClassVar[int]
hours: int
def __init__(self, hours: _Optional[int] = ...) -> None: ...
class GetMillisecondsRequest(_message.Message):
__slots__ = ["timezone"]
TIMEZONE_FIELD_NUMBER: _ClassVar[int]
timezone: str
def __init__(self, timezone: _Optional[str] = ...) -> None: ...
class GetMillisecondsResponse(_message.Message):
__slots__ = ["milliseconds"]
MILLISECONDS_FIELD_NUMBER: _ClassVar[int]
milliseconds: int
def __init__(self, milliseconds: _Optional[int] = ...) -> None: ...
class GetMinutesRequest(_message.Message):
__slots__ = ["timezone"]
TIMEZONE_FIELD_NUMBER: _ClassVar[int]
timezone: str
def __init__(self, timezone: _Optional[str] = ...) -> None: ...
class GetMinutesResponse(_message.Message):
__slots__ = ["minutes"]
MINUTES_FIELD_NUMBER: _ClassVar[int]
minutes: int
def __init__(self, minutes: _Optional[int] = ...) -> None: ...
class GetSecondsRequest(_message.Message):
__slots__ = ["timezone"]
TIMEZONE_FIELD_NUMBER: _ClassVar[int]
timezone: str
def __init__(self, timezone: _Optional[str] = ...) -> None: ...
class GetSecondsResponse(_message.Message):
__slots__ = ["seconds"]
SECONDS_FIELD_NUMBER: _ClassVar[int]
seconds: int
def __init__(self, seconds: _Optional[int] = ...) -> None: ...

View File

@ -0,0 +1,165 @@
# Generated by the gRPC Python protocol compiler plugin. DO NOT EDIT!
"""Client and server classes corresponding to protobuf-defined services."""
import grpc
from . import serve_segments_pb2 as serve__segments__pb2
class ServeSegmentsStub(object):
"""Missing associated documentation comment in .proto file."""
def __init__(self, channel):
"""Constructor.
Args:
channel: A grpc.Channel.
"""
self.GetHours = channel.unary_unary(
'/ServeSegments/GetHours',
request_serializer=serve__segments__pb2.GetHoursRequest.SerializeToString,
response_deserializer=serve__segments__pb2.GetHoursResponse.FromString,
)
self.GetMinutes = channel.unary_unary(
'/ServeSegments/GetMinutes',
request_serializer=serve__segments__pb2.GetMinutesRequest.SerializeToString,
response_deserializer=serve__segments__pb2.GetMinutesResponse.FromString,
)
self.GetSeconds = channel.unary_unary(
'/ServeSegments/GetSeconds',
request_serializer=serve__segments__pb2.GetSecondsRequest.SerializeToString,
response_deserializer=serve__segments__pb2.GetSecondsResponse.FromString,
)
self.GetMilliseconds = channel.unary_unary(
'/ServeSegments/GetMilliseconds',
request_serializer=serve__segments__pb2.GetMillisecondsRequest.SerializeToString,
response_deserializer=serve__segments__pb2.GetMillisecondsResponse.FromString,
)
class ServeSegmentsServicer(object):
"""Missing associated documentation comment in .proto file."""
def GetHours(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 GetMinutes(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 GetSeconds(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 GetMilliseconds(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_ServeSegmentsServicer_to_server(servicer, server):
rpc_method_handlers = {
'GetHours': grpc.unary_unary_rpc_method_handler(
servicer.GetHours,
request_deserializer=serve__segments__pb2.GetHoursRequest.FromString,
response_serializer=serve__segments__pb2.GetHoursResponse.SerializeToString,
),
'GetMinutes': grpc.unary_unary_rpc_method_handler(
servicer.GetMinutes,
request_deserializer=serve__segments__pb2.GetMinutesRequest.FromString,
response_serializer=serve__segments__pb2.GetMinutesResponse.SerializeToString,
),
'GetSeconds': grpc.unary_unary_rpc_method_handler(
servicer.GetSeconds,
request_deserializer=serve__segments__pb2.GetSecondsRequest.FromString,
response_serializer=serve__segments__pb2.GetSecondsResponse.SerializeToString,
),
'GetMilliseconds': grpc.unary_unary_rpc_method_handler(
servicer.GetMilliseconds,
request_deserializer=serve__segments__pb2.GetMillisecondsRequest.FromString,
response_serializer=serve__segments__pb2.GetMillisecondsResponse.SerializeToString,
),
}
generic_handler = grpc.method_handlers_generic_handler(
'ServeSegments', rpc_method_handlers)
server.add_generic_rpc_handlers((generic_handler,))
# This class is part of an EXPERIMENTAL API.
class ServeSegments(object):
"""Missing associated documentation comment in .proto file."""
@staticmethod
def GetHours(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, '/ServeSegments/GetHours',
serve__segments__pb2.GetHoursRequest.SerializeToString,
serve__segments__pb2.GetHoursResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def GetMinutes(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, '/ServeSegments/GetMinutes',
serve__segments__pb2.GetMinutesRequest.SerializeToString,
serve__segments__pb2.GetMinutesResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def GetSeconds(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, '/ServeSegments/GetSeconds',
serve__segments__pb2.GetSecondsRequest.SerializeToString,
serve__segments__pb2.GetSecondsResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)
@staticmethod
def GetMilliseconds(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, '/ServeSegments/GetMilliseconds',
serve__segments__pb2.GetMillisecondsRequest.SerializeToString,
serve__segments__pb2.GetMillisecondsResponse.FromString,
options, channel_credentials,
insecure, call_credentials, compression, wait_for_ready, timeout, metadata)

View File

@ -0,0 +1,20 @@
syntax = "proto3";
option go_package = "example.com/project/protos/serve_segments";
service ServeSegments {
rpc GetHours(GetHoursRequest) returns (GetHoursResponse);
rpc GetMinutes(GetMinutesRequest) returns (GetMinutesResponse);
rpc GetSeconds(GetSecondsRequest) returns (GetSecondsResponse);
rpc GetMilliseconds(GetMillisecondsRequest) returns (GetMillisecondsResponse);
}
message GetHoursRequest { string timezone = 1; }
message GetMinutesRequest { string timezone = 1; }
message GetSecondsRequest { string timezone = 1; }
message GetMillisecondsRequest { string timezone = 1; }
message GetHoursResponse { uint32 hours = 1; }
message GetMinutesResponse { uint32 minutes = 1; }
message GetSecondsResponse { uint32 seconds = 1; }
message GetMillisecondsResponse { uint32 milliseconds = 1; }

View File

@ -1,212 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc v3.21.12
// source: serve_hours.proto
package serve_hours
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type GetHoursRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Timezone string `protobuf:"bytes,1,opt,name=timezone,proto3" json:"timezone,omitempty"`
}
func (x *GetHoursRequest) Reset() {
*x = GetHoursRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_serve_hours_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetHoursRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetHoursRequest) ProtoMessage() {}
func (x *GetHoursRequest) ProtoReflect() protoreflect.Message {
mi := &file_serve_hours_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetHoursRequest.ProtoReflect.Descriptor instead.
func (*GetHoursRequest) Descriptor() ([]byte, []int) {
return file_serve_hours_proto_rawDescGZIP(), []int{0}
}
func (x *GetHoursRequest) GetTimezone() string {
if x != nil {
return x.Timezone
}
return ""
}
type GetHoursResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Hours uint32 `protobuf:"varint,1,opt,name=hours,proto3" json:"hours,omitempty"`
}
func (x *GetHoursResponse) Reset() {
*x = GetHoursResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_serve_hours_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetHoursResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetHoursResponse) ProtoMessage() {}
func (x *GetHoursResponse) ProtoReflect() protoreflect.Message {
mi := &file_serve_hours_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetHoursResponse.ProtoReflect.Descriptor instead.
func (*GetHoursResponse) Descriptor() ([]byte, []int) {
return file_serve_hours_proto_rawDescGZIP(), []int{1}
}
func (x *GetHoursResponse) GetHours() uint32 {
if x != nil {
return x.Hours
}
return 0
}
var File_serve_hours_proto protoreflect.FileDescriptor
var file_serve_hours_proto_rawDesc = []byte{
0x0a, 0x11, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5f, 0x68, 0x6f, 0x75, 0x72, 0x73, 0x2e, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x22, 0x2d, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x75, 0x72, 0x73, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x69, 0x6d, 0x65, 0x7a, 0x6f,
0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x69, 0x6d, 0x65, 0x7a, 0x6f,
0x6e, 0x65, 0x22, 0x28, 0x0a, 0x10, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x75, 0x72, 0x73, 0x52, 0x65,
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x68, 0x6f, 0x75, 0x72, 0x73, 0x18,
0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x68, 0x6f, 0x75, 0x72, 0x73, 0x32, 0x3d, 0x0a, 0x0a,
0x53, 0x65, 0x72, 0x76, 0x65, 0x48, 0x6f, 0x75, 0x72, 0x73, 0x12, 0x2f, 0x0a, 0x08, 0x47, 0x65,
0x74, 0x48, 0x6f, 0x75, 0x72, 0x73, 0x12, 0x10, 0x2e, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x75, 0x72,
0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x47, 0x65, 0x74, 0x48, 0x6f,
0x75, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x28, 0x5a, 0x26, 0x65,
0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x6a, 0x65,
0x63, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5f,
0x68, 0x6f, 0x75, 0x72, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_serve_hours_proto_rawDescOnce sync.Once
file_serve_hours_proto_rawDescData = file_serve_hours_proto_rawDesc
)
func file_serve_hours_proto_rawDescGZIP() []byte {
file_serve_hours_proto_rawDescOnce.Do(func() {
file_serve_hours_proto_rawDescData = protoimpl.X.CompressGZIP(file_serve_hours_proto_rawDescData)
})
return file_serve_hours_proto_rawDescData
}
var file_serve_hours_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_serve_hours_proto_goTypes = []interface{}{
(*GetHoursRequest)(nil), // 0: GetHoursRequest
(*GetHoursResponse)(nil), // 1: GetHoursResponse
}
var file_serve_hours_proto_depIdxs = []int32{
0, // 0: ServeHours.GetHours:input_type -> GetHoursRequest
1, // 1: ServeHours.GetHours:output_type -> GetHoursResponse
1, // [1:2] is the sub-list for method output_type
0, // [0:1] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_serve_hours_proto_init() }
func file_serve_hours_proto_init() {
if File_serve_hours_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_serve_hours_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetHoursRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_serve_hours_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetHoursResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_serve_hours_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_serve_hours_proto_goTypes,
DependencyIndexes: file_serve_hours_proto_depIdxs,
MessageInfos: file_serve_hours_proto_msgTypes,
}.Build()
File_serve_hours_proto = out.File
file_serve_hours_proto_rawDesc = nil
file_serve_hours_proto_goTypes = nil
file_serve_hours_proto_depIdxs = nil
}

View File

@ -1,105 +0,0 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v3.21.12
// source: serve_hours.proto
package serve_hours
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// ServeHoursClient is the client API for ServeHours service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type ServeHoursClient interface {
GetHours(ctx context.Context, in *GetHoursRequest, opts ...grpc.CallOption) (*GetHoursResponse, error)
}
type serveHoursClient struct {
cc grpc.ClientConnInterface
}
func NewServeHoursClient(cc grpc.ClientConnInterface) ServeHoursClient {
return &serveHoursClient{cc}
}
func (c *serveHoursClient) GetHours(ctx context.Context, in *GetHoursRequest, opts ...grpc.CallOption) (*GetHoursResponse, error) {
out := new(GetHoursResponse)
err := c.cc.Invoke(ctx, "/ServeHours/GetHours", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// ServeHoursServer is the server API for ServeHours service.
// All implementations must embed UnimplementedServeHoursServer
// for forward compatibility
type ServeHoursServer interface {
GetHours(context.Context, *GetHoursRequest) (*GetHoursResponse, error)
mustEmbedUnimplementedServeHoursServer()
}
// UnimplementedServeHoursServer must be embedded to have forward compatible implementations.
type UnimplementedServeHoursServer struct {
}
func (UnimplementedServeHoursServer) GetHours(context.Context, *GetHoursRequest) (*GetHoursResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetHours not implemented")
}
func (UnimplementedServeHoursServer) mustEmbedUnimplementedServeHoursServer() {}
// UnsafeServeHoursServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ServeHoursServer will
// result in compilation errors.
type UnsafeServeHoursServer interface {
mustEmbedUnimplementedServeHoursServer()
}
func RegisterServeHoursServer(s grpc.ServiceRegistrar, srv ServeHoursServer) {
s.RegisterService(&ServeHours_ServiceDesc, srv)
}
func _ServeHours_GetHours_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetHoursRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ServeHoursServer).GetHours(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/ServeHours/GetHours",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ServeHoursServer).GetHours(ctx, req.(*GetHoursRequest))
}
return interceptor(ctx, in, info, handler)
}
// ServeHours_ServiceDesc is the grpc.ServiceDesc for ServeHours service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var ServeHours_ServiceDesc = grpc.ServiceDesc{
ServiceName: "ServeHours",
HandlerType: (*ServeHoursServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetHours",
Handler: _ServeHours_GetHours_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "serve_hours.proto",
}

View File

@ -1,30 +0,0 @@
PROTO_DIR=../protos
STUBS_DIR=./stubs
GO_BIN_DIR=/home/eden/go/bin
OUT_DIR=../../dist
OUT_FILENAME=serve_minutes
run:
@go run ./main.go
build:
@go build -ldflags "-s -w" -o $(OUT_DIR)/${OUT_FILENAME} ./main.go
proto:
@PATH="$(PATH):$(GO_BIN_DIR)" \
protoc \
-I$(PROTO_DIR) \
--go_out=$(STUBS_DIR)/serve_minutes \
--go-grpc_out=$(STUBS_DIR)/serve_minutes \
--go_opt=paths=source_relative \
--go-grpc_opt=paths=source_relative \
$(PROTO_DIR)/serve_minutes.proto
@PATH="$(PATH):$(GO_BIN_DIR)" \
protoc \
-I$(PROTO_DIR) \
--go_out=$(STUBS_DIR)/serve_currenttime \
--go-grpc_out=$(STUBS_DIR)/serve_currenttime \
--go_opt=paths=source_relative \
--go-grpc_opt=paths=source_relative \
$(PROTO_DIR)/serve_currenttime.proto

View File

@ -1,13 +0,0 @@
module serve_minutes
go 1.20
require (
github.com/golang/protobuf v1.5.2 // indirect
golang.org/x/net v0.5.0 // indirect
golang.org/x/sys v0.4.0 // indirect
golang.org/x/text v0.6.0 // indirect
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
google.golang.org/grpc v1.53.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
)

View File

@ -1,19 +0,0 @@
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw=
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
golang.org/x/net v0.5.0 h1:GyT4nK/YDHSqa1c4753ouYCDajOYKTja9Xb/OHtgvSw=
golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws=
golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18=
golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k=
golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f h1:BWUVssLB0HVOSY78gIdvk1dTVYtT1y8SBWtPYuTJ/6w=
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f/go.mod h1:RGgjbofJ8xD9Sq1VVhDM1Vok1vRONV+rg+CjzG4SZKM=
google.golang.org/grpc v1.53.0 h1:LAv2ds7cmFV/XTS3XG1NneeENYrXGmorPxsBbptIjNc=
google.golang.org/grpc v1.53.0/go.mod h1:OnIrk0ipVdj4N5d9IUoFUx72/VlD7+jUsHwZgwSMQpw=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.28.1 h1:d0NfwRgPtno5B1Wa6L2DAG+KivqkdutMf1UhdNx175w=
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=

View File

@ -1,94 +0,0 @@
package main
import (
"context"
"fmt"
"log"
"net"
"time"
pb_get_currenttime "serve_minutes/stubs/serve_currenttime"
pb_serve_minutes "serve_minutes/stubs/serve_minutes"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
)
const SERVE_CURRENTTIME_HOST = "localhost"
const SERVE_CURRENTTIME_PORT = 50000
const SERVE_HOURS_HOST = "localhost"
const SERVE_HOURS_PORT = 50001
const SERVE_MINUTES_HOST = "localhost"
const SERVE_MINUTES_PORT = 50002
const SERVE_SECONDS_HOST = "localhost"
const SERVE_SECONDS_PORT = 50003
const SERVE_MILLISECONDS_HOST = "localhost"
const SERVE_MILLISECONDS_PORT = 50004
type grpc_server struct {
pb_serve_minutes.UnimplementedServeMinutesServer
}
type currentTimeResponse struct {
hours uint32
minutes uint32
seconds uint32
milliseconds uint32
formatted_time string
}
func GetCurrentTime(timezone string) currentTimeResponse {
conn, err := grpc.Dial(
fmt.Sprintf("%s:%d", SERVE_CURRENTTIME_HOST, SERVE_CURRENTTIME_PORT),
grpc.WithTransportCredentials(insecure.NewCredentials()),
)
if err != nil {
log.Fatalf("did not connect: %v", err)
}
defer conn.Close()
c := pb_get_currenttime.NewServeCurrentTimeServiceClient(conn)
// Contact the server and print out its response.
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
r, err := c.GetCurrentTime(
ctx,
&pb_get_currenttime.GetCurrentTimeRequest{Timezone: timezone},
)
if err != nil {
log.Fatalf("could not greet: %v", err)
}
result := currentTimeResponse{
hours: r.Hours,
minutes: r.Minutes,
seconds: r.Seconds,
milliseconds: r.Milliseconds,
formatted_time: r.FormattedTime,
}
return result
}
func (s *grpc_server) GetMinutes(ctx context.Context, in *pb_serve_minutes.GetMinutesRequest) (*pb_serve_minutes.GetMinutesResponse, error) {
timezone := in.GetTimezone()
current_time := GetCurrentTime(timezone)
return &pb_serve_minutes.GetMinutesResponse{Minutes: current_time.minutes}, nil
}
func serve() {
lis, err := net.Listen("tcp", fmt.Sprintf("%s:%d", SERVE_MINUTES_HOST, SERVE_MINUTES_PORT))
if err != nil {
log.Fatalf("failed to listen: %v", err)
}
server := grpc.NewServer()
pb_serve_minutes.RegisterServeMinutesServer(server, &grpc_server{})
log.Printf("server listening at %v", lis.Addr())
if err := server.Serve(lis); err != nil {
log.Fatalf("failed to serve: %v", err)
}
}
func main() {
serve()
}

View File

@ -1,259 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc v3.21.12
// source: serve_currenttime.proto
package serve_currenttime
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type GetCurrentTimeRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Timezone string `protobuf:"bytes,1,opt,name=timezone,proto3" json:"timezone,omitempty"`
}
func (x *GetCurrentTimeRequest) Reset() {
*x = GetCurrentTimeRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_serve_currenttime_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetCurrentTimeRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetCurrentTimeRequest) ProtoMessage() {}
func (x *GetCurrentTimeRequest) ProtoReflect() protoreflect.Message {
mi := &file_serve_currenttime_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetCurrentTimeRequest.ProtoReflect.Descriptor instead.
func (*GetCurrentTimeRequest) Descriptor() ([]byte, []int) {
return file_serve_currenttime_proto_rawDescGZIP(), []int{0}
}
func (x *GetCurrentTimeRequest) GetTimezone() string {
if x != nil {
return x.Timezone
}
return ""
}
type GetCurrentTimeResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Hours uint32 `protobuf:"varint,1,opt,name=hours,proto3" json:"hours,omitempty"`
Minutes uint32 `protobuf:"varint,2,opt,name=minutes,proto3" json:"minutes,omitempty"`
Seconds uint32 `protobuf:"varint,3,opt,name=seconds,proto3" json:"seconds,omitempty"`
Milliseconds uint32 `protobuf:"varint,4,opt,name=milliseconds,proto3" json:"milliseconds,omitempty"`
FormattedTime string `protobuf:"bytes,5,opt,name=formatted_time,json=formattedTime,proto3" json:"formatted_time,omitempty"`
}
func (x *GetCurrentTimeResponse) Reset() {
*x = GetCurrentTimeResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_serve_currenttime_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetCurrentTimeResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetCurrentTimeResponse) ProtoMessage() {}
func (x *GetCurrentTimeResponse) ProtoReflect() protoreflect.Message {
mi := &file_serve_currenttime_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetCurrentTimeResponse.ProtoReflect.Descriptor instead.
func (*GetCurrentTimeResponse) Descriptor() ([]byte, []int) {
return file_serve_currenttime_proto_rawDescGZIP(), []int{1}
}
func (x *GetCurrentTimeResponse) GetHours() uint32 {
if x != nil {
return x.Hours
}
return 0
}
func (x *GetCurrentTimeResponse) GetMinutes() uint32 {
if x != nil {
return x.Minutes
}
return 0
}
func (x *GetCurrentTimeResponse) GetSeconds() uint32 {
if x != nil {
return x.Seconds
}
return 0
}
func (x *GetCurrentTimeResponse) GetMilliseconds() uint32 {
if x != nil {
return x.Milliseconds
}
return 0
}
func (x *GetCurrentTimeResponse) GetFormattedTime() string {
if x != nil {
return x.FormattedTime
}
return ""
}
var File_serve_currenttime_proto protoreflect.FileDescriptor
var file_serve_currenttime_proto_rawDesc = []byte{
0x0a, 0x17, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5f, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x74,
0x69, 0x6d, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x11, 0x73, 0x65, 0x72, 0x76, 0x65,
0x5f, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x22, 0x33, 0x0a, 0x15,
0x47, 0x65, 0x74, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x52, 0x65,
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x69, 0x6d, 0x65, 0x7a, 0x6f, 0x6e,
0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x69, 0x6d, 0x65, 0x7a, 0x6f, 0x6e,
0x65, 0x22, 0xad, 0x01, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74,
0x54, 0x69, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, 0x05,
0x68, 0x6f, 0x75, 0x72, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x68, 0x6f, 0x75,
0x72, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x6d, 0x69, 0x6e, 0x75, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20,
0x01, 0x28, 0x0d, 0x52, 0x07, 0x6d, 0x69, 0x6e, 0x75, 0x74, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07,
0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x73,
0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x6d, 0x69, 0x6c, 0x6c, 0x69, 0x73,
0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x6d, 0x69,
0x6c, 0x6c, 0x69, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x66, 0x6f,
0x72, 0x6d, 0x61, 0x74, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0d, 0x66, 0x6f, 0x72, 0x6d, 0x61, 0x74, 0x74, 0x65, 0x64, 0x54, 0x69, 0x6d,
0x65, 0x32, 0x80, 0x01, 0x0a, 0x17, 0x53, 0x65, 0x72, 0x76, 0x65, 0x43, 0x75, 0x72, 0x72, 0x65,
0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x65, 0x0a,
0x0e, 0x47, 0x65, 0x74, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x12,
0x28, 0x2e, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5f, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x74,
0x69, 0x6d, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x54, 0x69,
0x6d, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x73, 0x65, 0x72, 0x76,
0x65, 0x5f, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x47, 0x65,
0x74, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74, 0x54, 0x69, 0x6d, 0x65, 0x52, 0x65, 0x73, 0x70,
0x6f, 0x6e, 0x73, 0x65, 0x42, 0x2e, 0x5a, 0x2c, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e,
0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x73, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5f, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x74,
0x74, 0x69, 0x6d, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_serve_currenttime_proto_rawDescOnce sync.Once
file_serve_currenttime_proto_rawDescData = file_serve_currenttime_proto_rawDesc
)
func file_serve_currenttime_proto_rawDescGZIP() []byte {
file_serve_currenttime_proto_rawDescOnce.Do(func() {
file_serve_currenttime_proto_rawDescData = protoimpl.X.CompressGZIP(file_serve_currenttime_proto_rawDescData)
})
return file_serve_currenttime_proto_rawDescData
}
var file_serve_currenttime_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_serve_currenttime_proto_goTypes = []interface{}{
(*GetCurrentTimeRequest)(nil), // 0: serve_currenttime.GetCurrentTimeRequest
(*GetCurrentTimeResponse)(nil), // 1: serve_currenttime.GetCurrentTimeResponse
}
var file_serve_currenttime_proto_depIdxs = []int32{
0, // 0: serve_currenttime.ServeCurrentTimeService.GetCurrentTime:input_type -> serve_currenttime.GetCurrentTimeRequest
1, // 1: serve_currenttime.ServeCurrentTimeService.GetCurrentTime:output_type -> serve_currenttime.GetCurrentTimeResponse
1, // [1:2] is the sub-list for method output_type
0, // [0:1] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_serve_currenttime_proto_init() }
func file_serve_currenttime_proto_init() {
if File_serve_currenttime_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_serve_currenttime_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetCurrentTimeRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_serve_currenttime_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetCurrentTimeResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_serve_currenttime_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_serve_currenttime_proto_goTypes,
DependencyIndexes: file_serve_currenttime_proto_depIdxs,
MessageInfos: file_serve_currenttime_proto_msgTypes,
}.Build()
File_serve_currenttime_proto = out.File
file_serve_currenttime_proto_rawDesc = nil
file_serve_currenttime_proto_goTypes = nil
file_serve_currenttime_proto_depIdxs = nil
}

View File

@ -1,106 +0,0 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v3.21.12
// source: serve_currenttime.proto
package serve_currenttime
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// ServeCurrentTimeServiceClient is the client API for ServeCurrentTimeService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type ServeCurrentTimeServiceClient interface {
GetCurrentTime(ctx context.Context, in *GetCurrentTimeRequest, opts ...grpc.CallOption) (*GetCurrentTimeResponse, error)
}
type serveCurrentTimeServiceClient struct {
cc grpc.ClientConnInterface
}
func NewServeCurrentTimeServiceClient(cc grpc.ClientConnInterface) ServeCurrentTimeServiceClient {
return &serveCurrentTimeServiceClient{cc}
}
func (c *serveCurrentTimeServiceClient) GetCurrentTime(ctx context.Context, in *GetCurrentTimeRequest, opts ...grpc.CallOption) (*GetCurrentTimeResponse, error) {
out := new(GetCurrentTimeResponse)
err := c.cc.Invoke(ctx, "/serve_currenttime.ServeCurrentTimeService/GetCurrentTime", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// ServeCurrentTimeServiceServer is the server API for ServeCurrentTimeService service.
// All implementations must embed UnimplementedServeCurrentTimeServiceServer
// for forward compatibility
type ServeCurrentTimeServiceServer interface {
GetCurrentTime(context.Context, *GetCurrentTimeRequest) (*GetCurrentTimeResponse, error)
mustEmbedUnimplementedServeCurrentTimeServiceServer()
}
// UnimplementedServeCurrentTimeServiceServer must be embedded to have forward compatible implementations.
type UnimplementedServeCurrentTimeServiceServer struct {
}
func (UnimplementedServeCurrentTimeServiceServer) GetCurrentTime(context.Context, *GetCurrentTimeRequest) (*GetCurrentTimeResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetCurrentTime not implemented")
}
func (UnimplementedServeCurrentTimeServiceServer) mustEmbedUnimplementedServeCurrentTimeServiceServer() {
}
// UnsafeServeCurrentTimeServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ServeCurrentTimeServiceServer will
// result in compilation errors.
type UnsafeServeCurrentTimeServiceServer interface {
mustEmbedUnimplementedServeCurrentTimeServiceServer()
}
func RegisterServeCurrentTimeServiceServer(s grpc.ServiceRegistrar, srv ServeCurrentTimeServiceServer) {
s.RegisterService(&ServeCurrentTimeService_ServiceDesc, srv)
}
func _ServeCurrentTimeService_GetCurrentTime_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetCurrentTimeRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ServeCurrentTimeServiceServer).GetCurrentTime(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/serve_currenttime.ServeCurrentTimeService/GetCurrentTime",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ServeCurrentTimeServiceServer).GetCurrentTime(ctx, req.(*GetCurrentTimeRequest))
}
return interceptor(ctx, in, info, handler)
}
// ServeCurrentTimeService_ServiceDesc is the grpc.ServiceDesc for ServeCurrentTimeService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var ServeCurrentTimeService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "serve_currenttime.ServeCurrentTimeService",
HandlerType: (*ServeCurrentTimeServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetCurrentTime",
Handler: _ServeCurrentTimeService_GetCurrentTime_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "serve_currenttime.proto",
}

View File

@ -1,214 +0,0 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc v3.21.12
// source: serve_minutes.proto
package serve_minutes
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type GetMinutesRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Timezone string `protobuf:"bytes,1,opt,name=timezone,proto3" json:"timezone,omitempty"`
}
func (x *GetMinutesRequest) Reset() {
*x = GetMinutesRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_serve_minutes_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetMinutesRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetMinutesRequest) ProtoMessage() {}
func (x *GetMinutesRequest) ProtoReflect() protoreflect.Message {
mi := &file_serve_minutes_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetMinutesRequest.ProtoReflect.Descriptor instead.
func (*GetMinutesRequest) Descriptor() ([]byte, []int) {
return file_serve_minutes_proto_rawDescGZIP(), []int{0}
}
func (x *GetMinutesRequest) GetTimezone() string {
if x != nil {
return x.Timezone
}
return ""
}
type GetMinutesResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Minutes uint32 `protobuf:"varint,1,opt,name=minutes,proto3" json:"minutes,omitempty"`
}
func (x *GetMinutesResponse) Reset() {
*x = GetMinutesResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_serve_minutes_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetMinutesResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetMinutesResponse) ProtoMessage() {}
func (x *GetMinutesResponse) ProtoReflect() protoreflect.Message {
mi := &file_serve_minutes_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetMinutesResponse.ProtoReflect.Descriptor instead.
func (*GetMinutesResponse) Descriptor() ([]byte, []int) {
return file_serve_minutes_proto_rawDescGZIP(), []int{1}
}
func (x *GetMinutesResponse) GetMinutes() uint32 {
if x != nil {
return x.Minutes
}
return 0
}
var File_serve_minutes_proto protoreflect.FileDescriptor
var file_serve_minutes_proto_rawDesc = []byte{
0x0a, 0x13, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x75, 0x74, 0x65, 0x73, 0x2e,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2f, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x4d, 0x69, 0x6e, 0x75,
0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x69,
0x6d, 0x65, 0x7a, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x69,
0x6d, 0x65, 0x7a, 0x6f, 0x6e, 0x65, 0x22, 0x2e, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4d, 0x69, 0x6e,
0x75, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07,
0x6d, 0x69, 0x6e, 0x75, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07, 0x6d,
0x69, 0x6e, 0x75, 0x74, 0x65, 0x73, 0x32, 0x45, 0x0a, 0x0c, 0x53, 0x65, 0x72, 0x76, 0x65, 0x4d,
0x69, 0x6e, 0x75, 0x74, 0x65, 0x73, 0x12, 0x35, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x4d, 0x69, 0x6e,
0x75, 0x74, 0x65, 0x73, 0x12, 0x12, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x69, 0x6e, 0x75, 0x74, 0x65,
0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x69,
0x6e, 0x75, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x2a, 0x5a,
0x28, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f,
0x6a, 0x65, 0x63, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x73, 0x65, 0x72, 0x76,
0x65, 0x5f, 0x6d, 0x69, 0x6e, 0x75, 0x74, 0x65, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
0x33,
}
var (
file_serve_minutes_proto_rawDescOnce sync.Once
file_serve_minutes_proto_rawDescData = file_serve_minutes_proto_rawDesc
)
func file_serve_minutes_proto_rawDescGZIP() []byte {
file_serve_minutes_proto_rawDescOnce.Do(func() {
file_serve_minutes_proto_rawDescData = protoimpl.X.CompressGZIP(file_serve_minutes_proto_rawDescData)
})
return file_serve_minutes_proto_rawDescData
}
var file_serve_minutes_proto_msgTypes = make([]protoimpl.MessageInfo, 2)
var file_serve_minutes_proto_goTypes = []interface{}{
(*GetMinutesRequest)(nil), // 0: GetMinutesRequest
(*GetMinutesResponse)(nil), // 1: GetMinutesResponse
}
var file_serve_minutes_proto_depIdxs = []int32{
0, // 0: ServeMinutes.GetMinutes:input_type -> GetMinutesRequest
1, // 1: ServeMinutes.GetMinutes:output_type -> GetMinutesResponse
1, // [1:2] is the sub-list for method output_type
0, // [0:1] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_serve_minutes_proto_init() }
func file_serve_minutes_proto_init() {
if File_serve_minutes_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_serve_minutes_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetMinutesRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_serve_minutes_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetMinutesResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_serve_minutes_proto_rawDesc,
NumEnums: 0,
NumMessages: 2,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_serve_minutes_proto_goTypes,
DependencyIndexes: file_serve_minutes_proto_depIdxs,
MessageInfos: file_serve_minutes_proto_msgTypes,
}.Build()
File_serve_minutes_proto = out.File
file_serve_minutes_proto_rawDesc = nil
file_serve_minutes_proto_goTypes = nil
file_serve_minutes_proto_depIdxs = nil
}

View File

@ -1,105 +0,0 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v3.21.12
// source: serve_minutes.proto
package serve_minutes
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// ServeMinutesClient is the client API for ServeMinutes service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type ServeMinutesClient interface {
GetMinutes(ctx context.Context, in *GetMinutesRequest, opts ...grpc.CallOption) (*GetMinutesResponse, error)
}
type serveMinutesClient struct {
cc grpc.ClientConnInterface
}
func NewServeMinutesClient(cc grpc.ClientConnInterface) ServeMinutesClient {
return &serveMinutesClient{cc}
}
func (c *serveMinutesClient) GetMinutes(ctx context.Context, in *GetMinutesRequest, opts ...grpc.CallOption) (*GetMinutesResponse, error) {
out := new(GetMinutesResponse)
err := c.cc.Invoke(ctx, "/ServeMinutes/GetMinutes", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// ServeMinutesServer is the server API for ServeMinutes service.
// All implementations must embed UnimplementedServeMinutesServer
// for forward compatibility
type ServeMinutesServer interface {
GetMinutes(context.Context, *GetMinutesRequest) (*GetMinutesResponse, error)
mustEmbedUnimplementedServeMinutesServer()
}
// UnimplementedServeMinutesServer must be embedded to have forward compatible implementations.
type UnimplementedServeMinutesServer struct {
}
func (UnimplementedServeMinutesServer) GetMinutes(context.Context, *GetMinutesRequest) (*GetMinutesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetMinutes not implemented")
}
func (UnimplementedServeMinutesServer) mustEmbedUnimplementedServeMinutesServer() {}
// UnsafeServeMinutesServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ServeMinutesServer will
// result in compilation errors.
type UnsafeServeMinutesServer interface {
mustEmbedUnimplementedServeMinutesServer()
}
func RegisterServeMinutesServer(s grpc.ServiceRegistrar, srv ServeMinutesServer) {
s.RegisterService(&ServeMinutes_ServiceDesc, srv)
}
func _ServeMinutes_GetMinutes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetMinutesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ServeMinutesServer).GetMinutes(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/ServeMinutes/GetMinutes",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ServeMinutesServer).GetMinutes(ctx, req.(*GetMinutesRequest))
}
return interceptor(ctx, in, info, handler)
}
// ServeMinutes_ServiceDesc is the grpc.ServiceDesc for ServeMinutes service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var ServeMinutes_ServiceDesc = grpc.ServiceDesc{
ServiceName: "ServeMinutes",
HandlerType: (*ServeMinutesServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetMinutes",
Handler: _ServeMinutes_GetMinutes_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "serve_minutes.proto",
}

View File

@ -2,7 +2,7 @@ PROTO_DIR=../protos
STUBS_DIR=./stubs STUBS_DIR=./stubs
GO_BIN_DIR=/home/eden/go/bin GO_BIN_DIR=/home/eden/go/bin
OUT_DIR=../../dist OUT_DIR=../../dist
OUT_FILENAME=serve_hours OUT_FILENAME=serve_segments
run: run:
@go run ./main.go @go run ./main.go
@ -14,11 +14,11 @@ proto:
@PATH="$(PATH):$(GO_BIN_DIR)" \ @PATH="$(PATH):$(GO_BIN_DIR)" \
protoc \ protoc \
-I$(PROTO_DIR) \ -I$(PROTO_DIR) \
--go_out=$(STUBS_DIR)/serve_hours \ --go_out=$(STUBS_DIR)/serve_segments \
--go-grpc_out=$(STUBS_DIR)/serve_hours \ --go-grpc_out=$(STUBS_DIR)/serve_segments \
--go_opt=paths=source_relative \ --go_opt=paths=source_relative \
--go-grpc_opt=paths=source_relative \ --go-grpc_opt=paths=source_relative \
$(PROTO_DIR)/serve_hours.proto $(PROTO_DIR)/serve_segments.proto
@PATH="$(PATH):$(GO_BIN_DIR)" \ @PATH="$(PATH):$(GO_BIN_DIR)" \
protoc \ protoc \

View File

@ -1,4 +1,4 @@
module serve_hours module serve_segments
go 1.20 go 1.20

View File

@ -7,8 +7,8 @@ import (
"net" "net"
"time" "time"
pb_get_currenttime "serve_hours/stubs/serve_currenttime" pb_get_currenttime "serve_segments/stubs/serve_currenttime"
pb_serve_hours "serve_hours/stubs/serve_hours" pb_serve_segments "serve_segments/stubs/serve_segments"
"google.golang.org/grpc" "google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/credentials/insecure"
@ -16,17 +16,11 @@ import (
const SERVE_CURRENTTIME_HOST = "localhost" const SERVE_CURRENTTIME_HOST = "localhost"
const SERVE_CURRENTTIME_PORT = 50000 const SERVE_CURRENTTIME_PORT = 50000
const SERVE_HOURS_HOST = "localhost" const SERVE_SEGMENTS_HOST = "localhost"
const SERVE_HOURS_PORT = 50001 const SERVE_SEGMENTS_PORT = 50001
const SERVE_MINUTES_HOST = "localhost"
const SERVE_MINUTES_PORT = 50002
const SERVE_SECONDS_HOST = "localhost"
const SERVE_SECONDS_PORT = 50003
const SERVE_MILLISECONDS_HOST = "localhost"
const SERVE_MILLISECONDS_PORT = 50004
type grpc_server struct { type grpc_server struct {
pb_serve_hours.UnimplementedServeHoursServer pb_serve_segments.UnimplementedServeSegmentsServer
} }
type currentTimeResponse struct { type currentTimeResponse struct {
@ -69,20 +63,50 @@ func GetCurrentTime(timezone string) currentTimeResponse {
return result return result
} }
func (s *grpc_server) GetHours(ctx context.Context, in *pb_serve_hours.GetHoursRequest) (*pb_serve_hours.GetHoursResponse, error) { func (s *grpc_server) GetHours(
ctx context.Context,
in *pb_serve_segments.GetHoursRequest,
) (*pb_serve_segments.GetHoursResponse, error) {
timezone := in.GetTimezone() timezone := in.GetTimezone()
current_time := GetCurrentTime(timezone) current_time := GetCurrentTime(timezone)
return &pb_serve_hours.GetHoursResponse{Hours: current_time.hours}, nil return &pb_serve_segments.GetHoursResponse{Hours: current_time.hours}, nil
}
func (s *grpc_server) GetMinutes(
ctx context.Context,
in *pb_serve_segments.GetMinutesRequest,
) (*pb_serve_segments.GetMinutesResponse, error) {
timezone := in.GetTimezone()
current_time := GetCurrentTime(timezone)
return &pb_serve_segments.GetMinutesResponse{Minutes: current_time.minutes}, nil
}
func (s *grpc_server) GetSeconds(
ctx context.Context,
in *pb_serve_segments.GetSecondsRequest,
) (*pb_serve_segments.GetSecondsResponse, error) {
timezone := in.GetTimezone()
current_time := GetCurrentTime(timezone)
return &pb_serve_segments.GetSecondsResponse{Seconds: current_time.seconds}, nil
}
func (s *grpc_server) GetMilliseconds(
ctx context.Context,
in *pb_serve_segments.GetMillisecondsRequest,
) (*pb_serve_segments.GetMillisecondsResponse, error) {
timezone := in.GetTimezone()
current_time := GetCurrentTime(timezone)
return &pb_serve_segments.GetMillisecondsResponse{Milliseconds: current_time.milliseconds}, nil
} }
func serve() { func serve() {
lis, err := net.Listen("tcp", fmt.Sprintf("%s:%d", SERVE_HOURS_HOST, SERVE_HOURS_PORT)) lis, err := net.Listen("tcp", fmt.Sprintf("%s:%d", SERVE_SEGMENTS_HOST, SERVE_SEGMENTS_PORT))
if err != nil { if err != nil {
log.Fatalf("failed to listen: %v", err) log.Fatalf("failed to listen: %v", err)
} }
server := grpc.NewServer() server := grpc.NewServer()
pb_serve_hours.RegisterServeHoursServer(server, &grpc_server{}) pb_serve_segments.RegisterServeSegmentsServer(server, &grpc_server{})
log.Printf("server listening at %v", lis.Addr()) log.Printf("server listening at %v", lis.Addr())
if err := server.Serve(lis); err != nil { if err := server.Serve(lis); err != nil {
log.Fatalf("failed to serve: %v", err) log.Fatalf("failed to serve: %v", err)

View File

@ -0,0 +1,610 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.28.1
// protoc v3.21.12
// source: serve_segments.proto
package serve_segments
import (
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
reflect "reflect"
sync "sync"
)
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
type GetHoursRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Timezone string `protobuf:"bytes,1,opt,name=timezone,proto3" json:"timezone,omitempty"`
}
func (x *GetHoursRequest) Reset() {
*x = GetHoursRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_serve_segments_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetHoursRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetHoursRequest) ProtoMessage() {}
func (x *GetHoursRequest) ProtoReflect() protoreflect.Message {
mi := &file_serve_segments_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetHoursRequest.ProtoReflect.Descriptor instead.
func (*GetHoursRequest) Descriptor() ([]byte, []int) {
return file_serve_segments_proto_rawDescGZIP(), []int{0}
}
func (x *GetHoursRequest) GetTimezone() string {
if x != nil {
return x.Timezone
}
return ""
}
type GetMinutesRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Timezone string `protobuf:"bytes,1,opt,name=timezone,proto3" json:"timezone,omitempty"`
}
func (x *GetMinutesRequest) Reset() {
*x = GetMinutesRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_serve_segments_proto_msgTypes[1]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetMinutesRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetMinutesRequest) ProtoMessage() {}
func (x *GetMinutesRequest) ProtoReflect() protoreflect.Message {
mi := &file_serve_segments_proto_msgTypes[1]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetMinutesRequest.ProtoReflect.Descriptor instead.
func (*GetMinutesRequest) Descriptor() ([]byte, []int) {
return file_serve_segments_proto_rawDescGZIP(), []int{1}
}
func (x *GetMinutesRequest) GetTimezone() string {
if x != nil {
return x.Timezone
}
return ""
}
type GetSecondsRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Timezone string `protobuf:"bytes,1,opt,name=timezone,proto3" json:"timezone,omitempty"`
}
func (x *GetSecondsRequest) Reset() {
*x = GetSecondsRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_serve_segments_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetSecondsRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetSecondsRequest) ProtoMessage() {}
func (x *GetSecondsRequest) ProtoReflect() protoreflect.Message {
mi := &file_serve_segments_proto_msgTypes[2]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetSecondsRequest.ProtoReflect.Descriptor instead.
func (*GetSecondsRequest) Descriptor() ([]byte, []int) {
return file_serve_segments_proto_rawDescGZIP(), []int{2}
}
func (x *GetSecondsRequest) GetTimezone() string {
if x != nil {
return x.Timezone
}
return ""
}
type GetMillisecondsRequest struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Timezone string `protobuf:"bytes,1,opt,name=timezone,proto3" json:"timezone,omitempty"`
}
func (x *GetMillisecondsRequest) Reset() {
*x = GetMillisecondsRequest{}
if protoimpl.UnsafeEnabled {
mi := &file_serve_segments_proto_msgTypes[3]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetMillisecondsRequest) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetMillisecondsRequest) ProtoMessage() {}
func (x *GetMillisecondsRequest) ProtoReflect() protoreflect.Message {
mi := &file_serve_segments_proto_msgTypes[3]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetMillisecondsRequest.ProtoReflect.Descriptor instead.
func (*GetMillisecondsRequest) Descriptor() ([]byte, []int) {
return file_serve_segments_proto_rawDescGZIP(), []int{3}
}
func (x *GetMillisecondsRequest) GetTimezone() string {
if x != nil {
return x.Timezone
}
return ""
}
type GetHoursResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Hours uint32 `protobuf:"varint,1,opt,name=hours,proto3" json:"hours,omitempty"`
}
func (x *GetHoursResponse) Reset() {
*x = GetHoursResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_serve_segments_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetHoursResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetHoursResponse) ProtoMessage() {}
func (x *GetHoursResponse) ProtoReflect() protoreflect.Message {
mi := &file_serve_segments_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetHoursResponse.ProtoReflect.Descriptor instead.
func (*GetHoursResponse) Descriptor() ([]byte, []int) {
return file_serve_segments_proto_rawDescGZIP(), []int{4}
}
func (x *GetHoursResponse) GetHours() uint32 {
if x != nil {
return x.Hours
}
return 0
}
type GetMinutesResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Minutes uint32 `protobuf:"varint,1,opt,name=minutes,proto3" json:"minutes,omitempty"`
}
func (x *GetMinutesResponse) Reset() {
*x = GetMinutesResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_serve_segments_proto_msgTypes[5]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetMinutesResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetMinutesResponse) ProtoMessage() {}
func (x *GetMinutesResponse) ProtoReflect() protoreflect.Message {
mi := &file_serve_segments_proto_msgTypes[5]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetMinutesResponse.ProtoReflect.Descriptor instead.
func (*GetMinutesResponse) Descriptor() ([]byte, []int) {
return file_serve_segments_proto_rawDescGZIP(), []int{5}
}
func (x *GetMinutesResponse) GetMinutes() uint32 {
if x != nil {
return x.Minutes
}
return 0
}
type GetSecondsResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Seconds uint32 `protobuf:"varint,1,opt,name=seconds,proto3" json:"seconds,omitempty"`
}
func (x *GetSecondsResponse) Reset() {
*x = GetSecondsResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_serve_segments_proto_msgTypes[6]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetSecondsResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetSecondsResponse) ProtoMessage() {}
func (x *GetSecondsResponse) ProtoReflect() protoreflect.Message {
mi := &file_serve_segments_proto_msgTypes[6]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetSecondsResponse.ProtoReflect.Descriptor instead.
func (*GetSecondsResponse) Descriptor() ([]byte, []int) {
return file_serve_segments_proto_rawDescGZIP(), []int{6}
}
func (x *GetSecondsResponse) GetSeconds() uint32 {
if x != nil {
return x.Seconds
}
return 0
}
type GetMillisecondsResponse struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Milliseconds uint32 `protobuf:"varint,1,opt,name=milliseconds,proto3" json:"milliseconds,omitempty"`
}
func (x *GetMillisecondsResponse) Reset() {
*x = GetMillisecondsResponse{}
if protoimpl.UnsafeEnabled {
mi := &file_serve_segments_proto_msgTypes[7]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *GetMillisecondsResponse) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*GetMillisecondsResponse) ProtoMessage() {}
func (x *GetMillisecondsResponse) ProtoReflect() protoreflect.Message {
mi := &file_serve_segments_proto_msgTypes[7]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
// Deprecated: Use GetMillisecondsResponse.ProtoReflect.Descriptor instead.
func (*GetMillisecondsResponse) Descriptor() ([]byte, []int) {
return file_serve_segments_proto_rawDescGZIP(), []int{7}
}
func (x *GetMillisecondsResponse) GetMilliseconds() uint32 {
if x != nil {
return x.Milliseconds
}
return 0
}
var File_serve_segments_proto protoreflect.FileDescriptor
var file_serve_segments_proto_rawDesc = []byte{
0x0a, 0x14, 0x73, 0x65, 0x72, 0x76, 0x65, 0x5f, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x73,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x2d, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x75,
0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x69, 0x6d,
0x65, 0x7a, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x69, 0x6d,
0x65, 0x7a, 0x6f, 0x6e, 0x65, 0x22, 0x2f, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x4d, 0x69, 0x6e, 0x75,
0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x69,
0x6d, 0x65, 0x7a, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x69,
0x6d, 0x65, 0x7a, 0x6f, 0x6e, 0x65, 0x22, 0x2f, 0x0a, 0x11, 0x47, 0x65, 0x74, 0x53, 0x65, 0x63,
0x6f, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x74,
0x69, 0x6d, 0x65, 0x7a, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74,
0x69, 0x6d, 0x65, 0x7a, 0x6f, 0x6e, 0x65, 0x22, 0x34, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x4d, 0x69,
0x6c, 0x6c, 0x69, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x69, 0x6d, 0x65, 0x7a, 0x6f, 0x6e, 0x65, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x69, 0x6d, 0x65, 0x7a, 0x6f, 0x6e, 0x65, 0x22, 0x28, 0x0a,
0x10, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x75, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
0x65, 0x12, 0x14, 0x0a, 0x05, 0x68, 0x6f, 0x75, 0x72, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d,
0x52, 0x05, 0x68, 0x6f, 0x75, 0x72, 0x73, 0x22, 0x2e, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x4d, 0x69,
0x6e, 0x75, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a,
0x07, 0x6d, 0x69, 0x6e, 0x75, 0x74, 0x65, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07,
0x6d, 0x69, 0x6e, 0x75, 0x74, 0x65, 0x73, 0x22, 0x2e, 0x0a, 0x12, 0x47, 0x65, 0x74, 0x53, 0x65,
0x63, 0x6f, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a,
0x07, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x07,
0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x22, 0x3d, 0x0a, 0x17, 0x47, 0x65, 0x74, 0x4d, 0x69,
0x6c, 0x6c, 0x69, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
0x73, 0x65, 0x12, 0x22, 0x0a, 0x0c, 0x6d, 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x65, 0x63, 0x6f, 0x6e,
0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x0c, 0x6d, 0x69, 0x6c, 0x6c, 0x69, 0x73,
0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x32, 0xf4, 0x01, 0x0a, 0x0d, 0x53, 0x65, 0x72, 0x76, 0x65,
0x53, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x12, 0x2f, 0x0a, 0x08, 0x47, 0x65, 0x74, 0x48,
0x6f, 0x75, 0x72, 0x73, 0x12, 0x10, 0x2e, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x75, 0x72, 0x73, 0x52,
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x11, 0x2e, 0x47, 0x65, 0x74, 0x48, 0x6f, 0x75, 0x72,
0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35, 0x0a, 0x0a, 0x47, 0x65, 0x74,
0x4d, 0x69, 0x6e, 0x75, 0x74, 0x65, 0x73, 0x12, 0x12, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x69, 0x6e,
0x75, 0x74, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x13, 0x2e, 0x47, 0x65,
0x74, 0x4d, 0x69, 0x6e, 0x75, 0x74, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x12, 0x35, 0x0a, 0x0a, 0x47, 0x65, 0x74, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x12,
0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65,
0x73, 0x74, 0x1a, 0x13, 0x2e, 0x47, 0x65, 0x74, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x52,
0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x0f, 0x47, 0x65, 0x74, 0x4d, 0x69,
0x6c, 0x6c, 0x69, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x12, 0x17, 0x2e, 0x47, 0x65, 0x74,
0x4d, 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75,
0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x69, 0x6c, 0x6c, 0x69, 0x73, 0x65,
0x63, 0x6f, 0x6e, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x2b, 0x5a,
0x29, 0x65, 0x78, 0x61, 0x6d, 0x70, 0x6c, 0x65, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x70, 0x72, 0x6f,
0x6a, 0x65, 0x63, 0x74, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x73, 0x2f, 0x73, 0x65, 0x72, 0x76,
0x65, 0x5f, 0x73, 0x65, 0x67, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74,
0x6f, 0x33,
}
var (
file_serve_segments_proto_rawDescOnce sync.Once
file_serve_segments_proto_rawDescData = file_serve_segments_proto_rawDesc
)
func file_serve_segments_proto_rawDescGZIP() []byte {
file_serve_segments_proto_rawDescOnce.Do(func() {
file_serve_segments_proto_rawDescData = protoimpl.X.CompressGZIP(file_serve_segments_proto_rawDescData)
})
return file_serve_segments_proto_rawDescData
}
var file_serve_segments_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_serve_segments_proto_goTypes = []interface{}{
(*GetHoursRequest)(nil), // 0: GetHoursRequest
(*GetMinutesRequest)(nil), // 1: GetMinutesRequest
(*GetSecondsRequest)(nil), // 2: GetSecondsRequest
(*GetMillisecondsRequest)(nil), // 3: GetMillisecondsRequest
(*GetHoursResponse)(nil), // 4: GetHoursResponse
(*GetMinutesResponse)(nil), // 5: GetMinutesResponse
(*GetSecondsResponse)(nil), // 6: GetSecondsResponse
(*GetMillisecondsResponse)(nil), // 7: GetMillisecondsResponse
}
var file_serve_segments_proto_depIdxs = []int32{
0, // 0: ServeSegments.GetHours:input_type -> GetHoursRequest
1, // 1: ServeSegments.GetMinutes:input_type -> GetMinutesRequest
2, // 2: ServeSegments.GetSeconds:input_type -> GetSecondsRequest
3, // 3: ServeSegments.GetMilliseconds:input_type -> GetMillisecondsRequest
4, // 4: ServeSegments.GetHours:output_type -> GetHoursResponse
5, // 5: ServeSegments.GetMinutes:output_type -> GetMinutesResponse
6, // 6: ServeSegments.GetSeconds:output_type -> GetSecondsResponse
7, // 7: ServeSegments.GetMilliseconds:output_type -> GetMillisecondsResponse
4, // [4:8] is the sub-list for method output_type
0, // [0:4] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_serve_segments_proto_init() }
func file_serve_segments_proto_init() {
if File_serve_segments_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_serve_segments_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetHoursRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_serve_segments_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetMinutesRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_serve_segments_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetSecondsRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_serve_segments_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetMillisecondsRequest); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_serve_segments_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetHoursResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_serve_segments_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetMinutesResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_serve_segments_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetSecondsResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
file_serve_segments_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*GetMillisecondsResponse); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_serve_segments_proto_rawDesc,
NumEnums: 0,
NumMessages: 8,
NumExtensions: 0,
NumServices: 1,
},
GoTypes: file_serve_segments_proto_goTypes,
DependencyIndexes: file_serve_segments_proto_depIdxs,
MessageInfos: file_serve_segments_proto_msgTypes,
}.Build()
File_serve_segments_proto = out.File
file_serve_segments_proto_rawDesc = nil
file_serve_segments_proto_goTypes = nil
file_serve_segments_proto_depIdxs = nil
}

View File

@ -0,0 +1,213 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc v3.21.12
// source: serve_segments.proto
package serve_segments
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
// ServeSegmentsClient is the client API for ServeSegments service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type ServeSegmentsClient interface {
GetHours(ctx context.Context, in *GetHoursRequest, opts ...grpc.CallOption) (*GetHoursResponse, error)
GetMinutes(ctx context.Context, in *GetMinutesRequest, opts ...grpc.CallOption) (*GetMinutesResponse, error)
GetSeconds(ctx context.Context, in *GetSecondsRequest, opts ...grpc.CallOption) (*GetSecondsResponse, error)
GetMilliseconds(ctx context.Context, in *GetMillisecondsRequest, opts ...grpc.CallOption) (*GetMillisecondsResponse, error)
}
type serveSegmentsClient struct {
cc grpc.ClientConnInterface
}
func NewServeSegmentsClient(cc grpc.ClientConnInterface) ServeSegmentsClient {
return &serveSegmentsClient{cc}
}
func (c *serveSegmentsClient) GetHours(ctx context.Context, in *GetHoursRequest, opts ...grpc.CallOption) (*GetHoursResponse, error) {
out := new(GetHoursResponse)
err := c.cc.Invoke(ctx, "/ServeSegments/GetHours", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *serveSegmentsClient) GetMinutes(ctx context.Context, in *GetMinutesRequest, opts ...grpc.CallOption) (*GetMinutesResponse, error) {
out := new(GetMinutesResponse)
err := c.cc.Invoke(ctx, "/ServeSegments/GetMinutes", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *serveSegmentsClient) GetSeconds(ctx context.Context, in *GetSecondsRequest, opts ...grpc.CallOption) (*GetSecondsResponse, error) {
out := new(GetSecondsResponse)
err := c.cc.Invoke(ctx, "/ServeSegments/GetSeconds", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *serveSegmentsClient) GetMilliseconds(ctx context.Context, in *GetMillisecondsRequest, opts ...grpc.CallOption) (*GetMillisecondsResponse, error) {
out := new(GetMillisecondsResponse)
err := c.cc.Invoke(ctx, "/ServeSegments/GetMilliseconds", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// ServeSegmentsServer is the server API for ServeSegments service.
// All implementations must embed UnimplementedServeSegmentsServer
// for forward compatibility
type ServeSegmentsServer interface {
GetHours(context.Context, *GetHoursRequest) (*GetHoursResponse, error)
GetMinutes(context.Context, *GetMinutesRequest) (*GetMinutesResponse, error)
GetSeconds(context.Context, *GetSecondsRequest) (*GetSecondsResponse, error)
GetMilliseconds(context.Context, *GetMillisecondsRequest) (*GetMillisecondsResponse, error)
mustEmbedUnimplementedServeSegmentsServer()
}
// UnimplementedServeSegmentsServer must be embedded to have forward compatible implementations.
type UnimplementedServeSegmentsServer struct {
}
func (UnimplementedServeSegmentsServer) GetHours(context.Context, *GetHoursRequest) (*GetHoursResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetHours not implemented")
}
func (UnimplementedServeSegmentsServer) GetMinutes(context.Context, *GetMinutesRequest) (*GetMinutesResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetMinutes not implemented")
}
func (UnimplementedServeSegmentsServer) GetSeconds(context.Context, *GetSecondsRequest) (*GetSecondsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetSeconds not implemented")
}
func (UnimplementedServeSegmentsServer) GetMilliseconds(context.Context, *GetMillisecondsRequest) (*GetMillisecondsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetMilliseconds not implemented")
}
func (UnimplementedServeSegmentsServer) mustEmbedUnimplementedServeSegmentsServer() {}
// UnsafeServeSegmentsServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ServeSegmentsServer will
// result in compilation errors.
type UnsafeServeSegmentsServer interface {
mustEmbedUnimplementedServeSegmentsServer()
}
func RegisterServeSegmentsServer(s grpc.ServiceRegistrar, srv ServeSegmentsServer) {
s.RegisterService(&ServeSegments_ServiceDesc, srv)
}
func _ServeSegments_GetHours_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetHoursRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ServeSegmentsServer).GetHours(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/ServeSegments/GetHours",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ServeSegmentsServer).GetHours(ctx, req.(*GetHoursRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ServeSegments_GetMinutes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetMinutesRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ServeSegmentsServer).GetMinutes(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/ServeSegments/GetMinutes",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ServeSegmentsServer).GetMinutes(ctx, req.(*GetMinutesRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ServeSegments_GetSeconds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetSecondsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ServeSegmentsServer).GetSeconds(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/ServeSegments/GetSeconds",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ServeSegmentsServer).GetSeconds(ctx, req.(*GetSecondsRequest))
}
return interceptor(ctx, in, info, handler)
}
func _ServeSegments_GetMilliseconds_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(GetMillisecondsRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(ServeSegmentsServer).GetMilliseconds(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/ServeSegments/GetMilliseconds",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(ServeSegmentsServer).GetMilliseconds(ctx, req.(*GetMillisecondsRequest))
}
return interceptor(ctx, in, info, handler)
}
// ServeSegments_ServiceDesc is the grpc.ServiceDesc for ServeSegments service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var ServeSegments_ServiceDesc = grpc.ServiceDesc{
ServiceName: "ServeSegments",
HandlerType: (*ServeSegmentsServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "GetHours",
Handler: _ServeSegments_GetHours_Handler,
},
{
MethodName: "GetMinutes",
Handler: _ServeSegments_GetMinutes_Handler,
},
{
MethodName: "GetSeconds",
Handler: _ServeSegments_GetSeconds_Handler,
},
{
MethodName: "GetMilliseconds",
Handler: _ServeSegments_GetMilliseconds_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "serve_segments.proto",
}