From 6cb121c40b77b4849c951fb59bd155115a0aabbd Mon Sep 17 00:00:00 2001 From: Niladri Halder Date: Tue, 21 Nov 2023 14:59:26 +0530 Subject: [PATCH] fix(proto): add GRPC interfaces (#102) Signed-off-by: Niladri Halder --- Makefile | 1 + pkg/proto/cstorvolume_grpc.pb.go | 161 +++++++++++++++++++++++++++++++ 2 files changed, 162 insertions(+) create mode 100644 pkg/proto/cstorvolume_grpc.pb.go diff --git a/Makefile b/Makefile index af2f9686..d6d31dee 100644 --- a/Makefile +++ b/Makefile @@ -60,6 +60,7 @@ protobuf: @protoc -I $(PWD)/pkg/apis/openebs.io/v1alpha1/ \ -I ${GOPATH}/src \ --go_out=$(PWD)/pkg/proto \ + --go-grpc_out=$(PWD)/pkg/proto \ $(PWD)/pkg/apis/cstor/v1/cstorvolume.proto # deps ensures fresh go.mod and go.sum. diff --git a/pkg/proto/cstorvolume_grpc.pb.go b/pkg/proto/cstorvolume_grpc.pb.go new file mode 100644 index 00000000..cd0b96a0 --- /dev/null +++ b/pkg/proto/cstorvolume_grpc.pb.go @@ -0,0 +1,161 @@ +// +//Copyright 2020 The OpenEBS Authors +// +//Licensed under the Apache License, Version 2.0 (the "License"); +//you may not use this file except in compliance with the License. +//You may obtain a copy of the License at +// +//http://www.apache.org/licenses/LICENSE-2.0 +// +//Unless required by applicable law or agreed to in writing, software +//distributed under the License is distributed on an "AS IS" BASIS, +//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +//See the License for the specific language governing permissions and +//limitations under the License. + +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc v4.23.4 +// source: github.com/openebs/api/pkg/apis/cstor/v1/cstorvolume.proto + +package proto + +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 + +const ( + RunSnapCommand_RunVolumeSnapCreateCommand_FullMethodName = "/v1alpha1.RunSnapCommand/RunVolumeSnapCreateCommand" + RunSnapCommand_RunVolumeSnapDeleteCommand_FullMethodName = "/v1alpha1.RunSnapCommand/RunVolumeSnapDeleteCommand" +) + +// RunSnapCommandClient is the client API for RunSnapCommand 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 RunSnapCommandClient interface { + RunVolumeSnapCreateCommand(ctx context.Context, in *VolumeSnapCreateRequest, opts ...grpc.CallOption) (*VolumeSnapCreateResponse, error) + RunVolumeSnapDeleteCommand(ctx context.Context, in *VolumeSnapDeleteRequest, opts ...grpc.CallOption) (*VolumeSnapDeleteResponse, error) +} + +type runSnapCommandClient struct { + cc grpc.ClientConnInterface +} + +func NewRunSnapCommandClient(cc grpc.ClientConnInterface) RunSnapCommandClient { + return &runSnapCommandClient{cc} +} + +func (c *runSnapCommandClient) RunVolumeSnapCreateCommand(ctx context.Context, in *VolumeSnapCreateRequest, opts ...grpc.CallOption) (*VolumeSnapCreateResponse, error) { + out := new(VolumeSnapCreateResponse) + err := c.cc.Invoke(ctx, RunSnapCommand_RunVolumeSnapCreateCommand_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *runSnapCommandClient) RunVolumeSnapDeleteCommand(ctx context.Context, in *VolumeSnapDeleteRequest, opts ...grpc.CallOption) (*VolumeSnapDeleteResponse, error) { + out := new(VolumeSnapDeleteResponse) + err := c.cc.Invoke(ctx, RunSnapCommand_RunVolumeSnapDeleteCommand_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// RunSnapCommandServer is the server API for RunSnapCommand service. +// All implementations must embed UnimplementedRunSnapCommandServer +// for forward compatibility +type RunSnapCommandServer interface { + RunVolumeSnapCreateCommand(context.Context, *VolumeSnapCreateRequest) (*VolumeSnapCreateResponse, error) + RunVolumeSnapDeleteCommand(context.Context, *VolumeSnapDeleteRequest) (*VolumeSnapDeleteResponse, error) + mustEmbedUnimplementedRunSnapCommandServer() +} + +// UnimplementedRunSnapCommandServer must be embedded to have forward compatible implementations. +type UnimplementedRunSnapCommandServer struct { +} + +func (UnimplementedRunSnapCommandServer) RunVolumeSnapCreateCommand(context.Context, *VolumeSnapCreateRequest) (*VolumeSnapCreateResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RunVolumeSnapCreateCommand not implemented") +} +func (UnimplementedRunSnapCommandServer) RunVolumeSnapDeleteCommand(context.Context, *VolumeSnapDeleteRequest) (*VolumeSnapDeleteResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RunVolumeSnapDeleteCommand not implemented") +} +func (UnimplementedRunSnapCommandServer) mustEmbedUnimplementedRunSnapCommandServer() {} + +// UnsafeRunSnapCommandServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to RunSnapCommandServer will +// result in compilation errors. +type UnsafeRunSnapCommandServer interface { + mustEmbedUnimplementedRunSnapCommandServer() +} + +func RegisterRunSnapCommandServer(s grpc.ServiceRegistrar, srv RunSnapCommandServer) { + s.RegisterService(&RunSnapCommand_ServiceDesc, srv) +} + +func _RunSnapCommand_RunVolumeSnapCreateCommand_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(VolumeSnapCreateRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RunSnapCommandServer).RunVolumeSnapCreateCommand(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RunSnapCommand_RunVolumeSnapCreateCommand_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RunSnapCommandServer).RunVolumeSnapCreateCommand(ctx, req.(*VolumeSnapCreateRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _RunSnapCommand_RunVolumeSnapDeleteCommand_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(VolumeSnapDeleteRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(RunSnapCommandServer).RunVolumeSnapDeleteCommand(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: RunSnapCommand_RunVolumeSnapDeleteCommand_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(RunSnapCommandServer).RunVolumeSnapDeleteCommand(ctx, req.(*VolumeSnapDeleteRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// RunSnapCommand_ServiceDesc is the grpc.ServiceDesc for RunSnapCommand service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var RunSnapCommand_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "v1alpha1.RunSnapCommand", + HandlerType: (*RunSnapCommandServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "RunVolumeSnapCreateCommand", + Handler: _RunSnapCommand_RunVolumeSnapCreateCommand_Handler, + }, + { + MethodName: "RunVolumeSnapDeleteCommand", + Handler: _RunSnapCommand_RunVolumeSnapDeleteCommand_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "github.com/openebs/api/pkg/apis/cstor/v1/cstorvolume.proto", +}