Serve seconds
This commit is contained in:
@ -1,8 +1,18 @@
|
||||
import logging
|
||||
import time
|
||||
from typing import Optional
|
||||
import grpc
|
||||
from models import GetCurrentTimeResponse
|
||||
from stubs import serve_hours_pb2
|
||||
from stubs import serve_hours_pb2_grpc
|
||||
from stubs import (
|
||||
serve_hours_pb2,
|
||||
serve_hours_pb2_grpc,
|
||||
serve_minutes_pb2,
|
||||
serve_minutes_pb2_grpc,
|
||||
serve_seconds_pb2,
|
||||
serve_seconds_pb2_grpc,
|
||||
serve_milliseconds_pb2,
|
||||
serve_milliseconds_pb2_grpc,
|
||||
)
|
||||
from stubs import serve_currenttime_pb2
|
||||
from stubs import serve_currenttime_pb2_grpc
|
||||
|
||||
@ -20,12 +30,60 @@ SERVE_MILLISECONDS_PORT = 50004
|
||||
TIMEZONE = "Europe/Zagreb"
|
||||
|
||||
|
||||
def get_hours() -> int:
|
||||
with grpc.insecure_channel(f"{SERVE_HOURS_HOST}:{SERVE_HOURS_PORT}") as channel:
|
||||
stub = serve_hours_pb2_grpc.ServeHoursStub(channel)
|
||||
response = stub.GetHours(serve_hours_pb2.GetHoursRequest(timezone=TIMEZONE))
|
||||
print("GetHours() response: ", response)
|
||||
return response.hours
|
||||
def get_hours() -> Optional[int]:
|
||||
try:
|
||||
with grpc.insecure_channel(f"{SERVE_HOURS_HOST}:{SERVE_HOURS_PORT}") as channel:
|
||||
stub = serve_hours_pb2_grpc.ServeHoursStub(channel)
|
||||
response = stub.GetHours(serve_hours_pb2.GetHoursRequest(timezone=TIMEZONE))
|
||||
return response.hours
|
||||
except Exception as ex:
|
||||
logging.error(ex)
|
||||
return None
|
||||
|
||||
|
||||
def get_minutes() -> Optional[int]:
|
||||
try:
|
||||
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
|
||||
except Exception as ex:
|
||||
logging.error(ex)
|
||||
return None
|
||||
|
||||
|
||||
def get_seconds() -> Optional[int]:
|
||||
try:
|
||||
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
|
||||
except Exception as ex:
|
||||
logging.error(ex)
|
||||
return None
|
||||
|
||||
|
||||
def get_milliseconds() -> Optional[int]:
|
||||
try:
|
||||
with grpc.insecure_channel(
|
||||
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
|
||||
except Exception as ex:
|
||||
logging.error(ex)
|
||||
return None
|
||||
|
||||
|
||||
def get_currenttime() -> GetCurrentTimeResponse:
|
||||
@ -40,11 +98,17 @@ def get_currenttime() -> GetCurrentTimeResponse:
|
||||
|
||||
|
||||
def run():
|
||||
hours = get_hours()
|
||||
print(">>>>>>>>>>>>> Hours:", hours)
|
||||
t = time.perf_counter()
|
||||
|
||||
currenttime = get_currenttime()
|
||||
print(">>>>>>>>>>>>> CurrentTime:", currenttime)
|
||||
hours = get_hours()
|
||||
minutes = get_minutes()
|
||||
seconds = get_seconds()
|
||||
milliseconds = get_milliseconds()
|
||||
|
||||
t = time.perf_counter() - t
|
||||
|
||||
# print(f"RESULT: {hours}:{minutes}:{seconds}:{milliseconds}")
|
||||
print(f"T: {t}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
syntax = "proto3";
|
||||
package serve_currenttime;
|
||||
option go_package = "example.com/project/protos/serve_currenttime";
|
||||
|
||||
service ServeCurrentTimeService {
|
||||
rpc GetCurrentTime(GetCurrentTimeRequest) returns (GetCurrentTimeResponse);
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package = "example.com/project/protos/serve_milliseconds";
|
||||
|
||||
service ServeMilliseconds {
|
||||
rpc GetMilliseconds(GetMillisecondsRequest) returns (GetMillisecondsResponse);
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package = "example.com/project/protos/serve_minutes";
|
||||
|
||||
service ServeMinutes {
|
||||
rpc GetMinutes(GetMinutesRequest) returns (GetMinutesResponse);
|
||||
}
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
syntax = "proto3";
|
||||
|
||||
option go_package = "example.com/project/protos/serve_seconds";
|
||||
|
||||
service ServeSeconds {
|
||||
rpc GetSeconds(GetSecondsRequest) returns (GetSecondsResponse);
|
||||
}
|
||||
|
||||
@ -1,17 +1,17 @@
|
||||
const grpc = require("@grpc/grpc-js");
|
||||
const PROTO_PATH = "../protos/serve_currenttime.proto";
|
||||
const protoLoader = require("@grpc/proto-loader");
|
||||
var utc = require("dayjs/plugin/utc");
|
||||
import { loadPackageDefinition, Server, ServerCredentials } from "@grpc/grpc-js";
|
||||
import { loadSync } from "@grpc/proto-loader";
|
||||
import utc from "dayjs/plugin/utc.js";
|
||||
import timezone from "dayjs/plugin/timezone.js";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
const timezone = require("dayjs/plugin/timezone");
|
||||
const dayjs = require("dayjs");
|
||||
dayjs.extend(utc);
|
||||
dayjs.extend(timezone);
|
||||
|
||||
const SERVE_CURRENTTIME_HOST = "localhost";
|
||||
const SERVE_CURRENTTIME_PORT = 50000;
|
||||
const PROTO_PATH = "../protos/serve_currenttime.proto";
|
||||
|
||||
const options = {
|
||||
const PROTO_PACKAGE_OPTIONS = {
|
||||
keepCase: true,
|
||||
longs: String,
|
||||
enums: String,
|
||||
@ -19,8 +19,9 @@ const options = {
|
||||
oneofs: true,
|
||||
};
|
||||
|
||||
function getCurrentTime(request, callback) {
|
||||
const timezone = request.timezone;
|
||||
function getCurrentTime(call, callback) {
|
||||
const timezone = call.request.timezone;
|
||||
console.log("Received timezone:", timezone);
|
||||
const now = dayjs().tz(timezone);
|
||||
|
||||
callback(null, {
|
||||
@ -33,22 +34,18 @@ function getCurrentTime(request, callback) {
|
||||
}
|
||||
|
||||
function main() {
|
||||
var packageDefinition = protoLoader.loadSync(PROTO_PATH, options);
|
||||
const serveCurrentTimeProto = grpc.loadPackageDefinition(packageDefinition).serve_currenttime;
|
||||
const server = new grpc.Server();
|
||||
var packageDefinition = loadSync(PROTO_PATH, PROTO_PACKAGE_OPTIONS);
|
||||
const serveCurrentTimeProto = loadPackageDefinition(packageDefinition).serve_currenttime;
|
||||
const server = new Server();
|
||||
|
||||
server.addService(serveCurrentTimeProto.ServeCurrentTimeService.service, {
|
||||
getCurrentTime: getCurrentTime,
|
||||
});
|
||||
|
||||
server.bindAsync(
|
||||
`${SERVE_CURRENTTIME_HOST}:${SERVE_CURRENTTIME_PORT}`,
|
||||
grpc.ServerCredentials.createInsecure(),
|
||||
() => {
|
||||
console.log(`Starting server on ${SERVE_CURRENTTIME_HOST}:${SERVE_CURRENTTIME_PORT}`);
|
||||
server.start();
|
||||
}
|
||||
);
|
||||
server.bindAsync(`${SERVE_CURRENTTIME_HOST}:${SERVE_CURRENTTIME_PORT}`, ServerCredentials.createInsecure(), () => {
|
||||
console.log(`Starting server on ${SERVE_CURRENTTIME_HOST}:${SERVE_CURRENTTIME_PORT}`);
|
||||
server.start();
|
||||
});
|
||||
}
|
||||
|
||||
main();
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
{
|
||||
"name": "grpc-examples",
|
||||
"version": "0.1.0",
|
||||
"type": "module",
|
||||
"dependencies": {
|
||||
"@grpc/grpc-js": "^1.8.12",
|
||||
"@grpc/proto-loader": "^0.7.5",
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
PROTO_DIR=../protos
|
||||
STUBS_DIR=./stubs
|
||||
PROTO_FILENAME=serve_hours.proto
|
||||
GO_BIN_DIR=/home/eden/go/bin
|
||||
OUT_DIR=../../dist
|
||||
OUT_FILENAME=serve_hours
|
||||
@ -15,8 +14,17 @@ proto:
|
||||
@PATH="$(PATH):$(GO_BIN_DIR)" \
|
||||
protoc \
|
||||
-I$(PROTO_DIR) \
|
||||
--go_out=$(STUBS_DIR) \
|
||||
--go_out=$(STUBS_DIR)/serve_hours \
|
||||
--go-grpc_out=$(STUBS_DIR)/serve_hours \
|
||||
--go_opt=paths=source_relative \
|
||||
--go-grpc_out=$(STUBS_DIR) \
|
||||
--go-grpc_opt=paths=source_relative \
|
||||
$(PROTO_DIR)/$(PROTO_FILENAME)
|
||||
$(PROTO_DIR)/serve_hours.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
|
||||
|
||||
@ -5,12 +5,17 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net"
|
||||
"time"
|
||||
|
||||
pb "serve_hours/stubs"
|
||||
pb_get_currenttime "serve_hours/stubs/serve_currenttime"
|
||||
pb_serve_hours "serve_hours/stubs/serve_hours"
|
||||
|
||||
"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"
|
||||
@ -21,12 +26,53 @@ const SERVE_MILLISECONDS_HOST = "localhost"
|
||||
const SERVE_MILLISECONDS_PORT = 50004
|
||||
|
||||
type grpc_server struct {
|
||||
pb.UnimplementedServeHoursServer
|
||||
pb_serve_hours.UnimplementedServeHoursServer
|
||||
}
|
||||
|
||||
func (s *grpc_server) GetHours(ctx context.Context, in *pb.GetHoursRequest) (*pb.GetHoursResponse, error) {
|
||||
log.Printf("Received timezone: %v", in.GetTimezone())
|
||||
return &pb.GetHoursResponse{Hours: 123}, nil
|
||||
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) GetHours(ctx context.Context, in *pb_serve_hours.GetHoursRequest) (*pb_serve_hours.GetHoursResponse, error) {
|
||||
timezone := in.GetTimezone()
|
||||
current_time := GetCurrentTime(timezone)
|
||||
return &pb_serve_hours.GetHoursResponse{Hours: current_time.hours}, nil
|
||||
}
|
||||
|
||||
func serve() {
|
||||
@ -34,10 +80,11 @@ func serve() {
|
||||
if err != nil {
|
||||
log.Fatalf("failed to listen: %v", err)
|
||||
}
|
||||
s := grpc.NewServer()
|
||||
pb.RegisterServeHoursServer(s, &grpc_server{})
|
||||
|
||||
server := grpc.NewServer()
|
||||
pb_serve_hours.RegisterServeHoursServer(server, &grpc_server{})
|
||||
log.Printf("server listening at %v", lis.Addr())
|
||||
if err := s.Serve(lis); err != nil {
|
||||
if err := server.Serve(lis); err != nil {
|
||||
log.Fatalf("failed to serve: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
259
src/serve_hours/stubs/serve_currenttime/serve_currenttime.pb.go
Normal file
259
src/serve_hours/stubs/serve_currenttime/serve_currenttime.pb.go
Normal file
@ -0,0 +1,259 @@
|
||||
// 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
|
||||
}
|
||||
@ -0,0 +1,106 @@
|
||||
// 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",
|
||||
}
|
||||
30
src/serve_minutes/Makefile
Normal file
30
src/serve_minutes/Makefile
Normal file
@ -0,0 +1,30 @@
|
||||
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
|
||||
13
src/serve_minutes/go.mod
Normal file
13
src/serve_minutes/go.mod
Normal file
@ -0,0 +1,13 @@
|
||||
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
|
||||
)
|
||||
19
src/serve_minutes/go.sum
Normal file
19
src/serve_minutes/go.sum
Normal file
@ -0,0 +1,19 @@
|
||||
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=
|
||||
94
src/serve_minutes/main.go
Normal file
94
src/serve_minutes/main.go
Normal file
@ -0,0 +1,94 @@
|
||||
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()
|
||||
}
|
||||
@ -0,0 +1,259 @@
|
||||
// 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
|
||||
}
|
||||
@ -0,0 +1,106 @@
|
||||
// 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",
|
||||
}
|
||||
214
src/serve_minutes/stubs/serve_minutes/serve_minutes.pb.go
Normal file
214
src/serve_minutes/stubs/serve_minutes/serve_minutes.pb.go
Normal file
@ -0,0 +1,214 @@
|
||||
// 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
|
||||
}
|
||||
105
src/serve_minutes/stubs/serve_minutes/serve_minutes_grpc.pb.go
Normal file
105
src/serve_minutes/stubs/serve_minutes/serve_minutes_grpc.pb.go
Normal file
@ -0,0 +1,105 @@
|
||||
// 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",
|
||||
}
|
||||
Reference in New Issue
Block a user