diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cf4f498e..27e655ed 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -43,11 +43,12 @@ jobs: - name: Go protbuf generation run: | make go - if git status --porcelain=v1; then + if git status --porcelain=v1 | wc -l; then echo "go_proto_conflicts=true" >> $GITHUB_ENV else echo "go_proto_conflicts=false" >> $GITHUB_ENV fi + git status --porcelain=v1 - name: Check protobuf generation if: ${{ env.go_proto_conflicts == 'true' }} run: | diff --git a/go/greptime/v1/database_grpc.pb.go b/go/greptime/v1/database_grpc.pb.go new file mode 100644 index 00000000..54fd95cf --- /dev/null +++ b/go/greptime/v1/database_grpc.pb.go @@ -0,0 +1,176 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.2.0 +// - protoc v3.21.6 +// source: greptime/v1/database.proto + +package v1 + +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 + +// GreptimeDatabaseClient is the client API for GreptimeDatabase 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 GreptimeDatabaseClient interface { + Handle(ctx context.Context, in *GreptimeRequest, opts ...grpc.CallOption) (*GreptimeResponse, error) + HandleRequests(ctx context.Context, opts ...grpc.CallOption) (GreptimeDatabase_HandleRequestsClient, error) +} + +type greptimeDatabaseClient struct { + cc grpc.ClientConnInterface +} + +func NewGreptimeDatabaseClient(cc grpc.ClientConnInterface) GreptimeDatabaseClient { + return &greptimeDatabaseClient{cc} +} + +func (c *greptimeDatabaseClient) Handle(ctx context.Context, in *GreptimeRequest, opts ...grpc.CallOption) (*GreptimeResponse, error) { + out := new(GreptimeResponse) + err := c.cc.Invoke(ctx, "/greptime.v1.GreptimeDatabase/Handle", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *greptimeDatabaseClient) HandleRequests(ctx context.Context, opts ...grpc.CallOption) (GreptimeDatabase_HandleRequestsClient, error) { + stream, err := c.cc.NewStream(ctx, &GreptimeDatabase_ServiceDesc.Streams[0], "/greptime.v1.GreptimeDatabase/HandleRequests", opts...) + if err != nil { + return nil, err + } + x := &greptimeDatabaseHandleRequestsClient{stream} + return x, nil +} + +type GreptimeDatabase_HandleRequestsClient interface { + Send(*GreptimeRequest) error + CloseAndRecv() (*GreptimeResponse, error) + grpc.ClientStream +} + +type greptimeDatabaseHandleRequestsClient struct { + grpc.ClientStream +} + +func (x *greptimeDatabaseHandleRequestsClient) Send(m *GreptimeRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *greptimeDatabaseHandleRequestsClient) CloseAndRecv() (*GreptimeResponse, error) { + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + m := new(GreptimeResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// GreptimeDatabaseServer is the server API for GreptimeDatabase service. +// All implementations must embed UnimplementedGreptimeDatabaseServer +// for forward compatibility +type GreptimeDatabaseServer interface { + Handle(context.Context, *GreptimeRequest) (*GreptimeResponse, error) + HandleRequests(GreptimeDatabase_HandleRequestsServer) error + mustEmbedUnimplementedGreptimeDatabaseServer() +} + +// UnimplementedGreptimeDatabaseServer must be embedded to have forward compatible implementations. +type UnimplementedGreptimeDatabaseServer struct { +} + +func (UnimplementedGreptimeDatabaseServer) Handle(context.Context, *GreptimeRequest) (*GreptimeResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Handle not implemented") +} +func (UnimplementedGreptimeDatabaseServer) HandleRequests(GreptimeDatabase_HandleRequestsServer) error { + return status.Errorf(codes.Unimplemented, "method HandleRequests not implemented") +} +func (UnimplementedGreptimeDatabaseServer) mustEmbedUnimplementedGreptimeDatabaseServer() {} + +// UnsafeGreptimeDatabaseServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to GreptimeDatabaseServer will +// result in compilation errors. +type UnsafeGreptimeDatabaseServer interface { + mustEmbedUnimplementedGreptimeDatabaseServer() +} + +func RegisterGreptimeDatabaseServer(s grpc.ServiceRegistrar, srv GreptimeDatabaseServer) { + s.RegisterService(&GreptimeDatabase_ServiceDesc, srv) +} + +func _GreptimeDatabase_Handle_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GreptimeRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(GreptimeDatabaseServer).Handle(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/greptime.v1.GreptimeDatabase/Handle", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(GreptimeDatabaseServer).Handle(ctx, req.(*GreptimeRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _GreptimeDatabase_HandleRequests_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(GreptimeDatabaseServer).HandleRequests(&greptimeDatabaseHandleRequestsServer{stream}) +} + +type GreptimeDatabase_HandleRequestsServer interface { + SendAndClose(*GreptimeResponse) error + Recv() (*GreptimeRequest, error) + grpc.ServerStream +} + +type greptimeDatabaseHandleRequestsServer struct { + grpc.ServerStream +} + +func (x *greptimeDatabaseHandleRequestsServer) SendAndClose(m *GreptimeResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *greptimeDatabaseHandleRequestsServer) Recv() (*GreptimeRequest, error) { + m := new(GreptimeRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// GreptimeDatabase_ServiceDesc is the grpc.ServiceDesc for GreptimeDatabase service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var GreptimeDatabase_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "greptime.v1.GreptimeDatabase", + HandlerType: (*GreptimeDatabaseServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "Handle", + Handler: _GreptimeDatabase_Handle_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "HandleRequests", + Handler: _GreptimeDatabase_HandleRequests_Handler, + ClientStreams: true, + }, + }, + Metadata: "greptime/v1/database.proto", +}