From dd4b168a0239877d8d6da56d8cb66dc632274c9d Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Tue, 30 Jul 2024 15:20:40 +0200 Subject: [PATCH] internal: generate Go protobuf files with protoc-gen-go-grpc v1.5.0 Signed-off-by: Niels de Vos --- .../proto/encryptionkeyrotation_grpc.pb.go | 25 +++++++++++++------ internal/proto/networkfence_grpc.pb.go | 25 +++++++++++++------ internal/proto/reclaimspace_grpc.pb.go | 25 +++++++++++++------ internal/proto/replication_grpc.pb.go | 25 +++++++++++++------ 4 files changed, 72 insertions(+), 28 deletions(-) diff --git a/internal/proto/encryptionkeyrotation_grpc.pb.go b/internal/proto/encryptionkeyrotation_grpc.pb.go index e5df1a850..c425b9625 100644 --- a/internal/proto/encryptionkeyrotation_grpc.pb.go +++ b/internal/proto/encryptionkeyrotation_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc v3.20.2 // source: encryptionkeyrotation.proto @@ -15,8 +15,8 @@ import ( // 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.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( EncryptionKeyRotation_EncryptionKeyRotate_FullMethodName = "/proto.EncryptionKeyRotation/EncryptionKeyRotate" @@ -52,7 +52,7 @@ func (c *encryptionKeyRotationClient) EncryptionKeyRotate(ctx context.Context, i // EncryptionKeyRotationServer is the server API for EncryptionKeyRotation service. // All implementations must embed UnimplementedEncryptionKeyRotationServer -// for forward compatibility +// for forward compatibility. // // EncryptionKeyRotation holds the RPC method for running // key rotation operation on the pv. @@ -61,14 +61,18 @@ type EncryptionKeyRotationServer interface { mustEmbedUnimplementedEncryptionKeyRotationServer() } -// UnimplementedEncryptionKeyRotationServer must be embedded to have forward compatible implementations. -type UnimplementedEncryptionKeyRotationServer struct { -} +// UnimplementedEncryptionKeyRotationServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedEncryptionKeyRotationServer struct{} func (UnimplementedEncryptionKeyRotationServer) EncryptionKeyRotate(context.Context, *EncryptionKeyRotateRequest) (*EncryptionKeyRotateResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method EncryptionKeyRotate not implemented") } func (UnimplementedEncryptionKeyRotationServer) mustEmbedUnimplementedEncryptionKeyRotationServer() {} +func (UnimplementedEncryptionKeyRotationServer) testEmbeddedByValue() {} // UnsafeEncryptionKeyRotationServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to EncryptionKeyRotationServer will @@ -78,6 +82,13 @@ type UnsafeEncryptionKeyRotationServer interface { } func RegisterEncryptionKeyRotationServer(s grpc.ServiceRegistrar, srv EncryptionKeyRotationServer) { + // If the following call pancis, it indicates UnimplementedEncryptionKeyRotationServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&EncryptionKeyRotation_ServiceDesc, srv) } diff --git a/internal/proto/networkfence_grpc.pb.go b/internal/proto/networkfence_grpc.pb.go index c63811361..aab5649ea 100644 --- a/internal/proto/networkfence_grpc.pb.go +++ b/internal/proto/networkfence_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc v3.20.2 // source: networkfence.proto @@ -15,8 +15,8 @@ import ( // 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.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( NetworkFence_FenceClusterNetwork_FullMethodName = "/proto.NetworkFence/FenceClusterNetwork" @@ -66,7 +66,7 @@ func (c *networkFenceClient) UnFenceClusterNetwork(ctx context.Context, in *Netw // NetworkFenceServer is the server API for NetworkFence service. // All implementations must embed UnimplementedNetworkFenceServer -// for forward compatibility +// for forward compatibility. // // NetworkFence holds the RPC method for allowing the communication between // the CSIAddons controller and the sidecar for fencing operations. @@ -78,9 +78,12 @@ type NetworkFenceServer interface { mustEmbedUnimplementedNetworkFenceServer() } -// UnimplementedNetworkFenceServer must be embedded to have forward compatible implementations. -type UnimplementedNetworkFenceServer struct { -} +// UnimplementedNetworkFenceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedNetworkFenceServer struct{} func (UnimplementedNetworkFenceServer) FenceClusterNetwork(context.Context, *NetworkFenceRequest) (*NetworkFenceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method FenceClusterNetwork not implemented") @@ -89,6 +92,7 @@ func (UnimplementedNetworkFenceServer) UnFenceClusterNetwork(context.Context, *N return nil, status.Errorf(codes.Unimplemented, "method UnFenceClusterNetwork not implemented") } func (UnimplementedNetworkFenceServer) mustEmbedUnimplementedNetworkFenceServer() {} +func (UnimplementedNetworkFenceServer) testEmbeddedByValue() {} // UnsafeNetworkFenceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to NetworkFenceServer will @@ -98,6 +102,13 @@ type UnsafeNetworkFenceServer interface { } func RegisterNetworkFenceServer(s grpc.ServiceRegistrar, srv NetworkFenceServer) { + // If the following call pancis, it indicates UnimplementedNetworkFenceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&NetworkFence_ServiceDesc, srv) } diff --git a/internal/proto/reclaimspace_grpc.pb.go b/internal/proto/reclaimspace_grpc.pb.go index f50667dfb..4c6865cf9 100644 --- a/internal/proto/reclaimspace_grpc.pb.go +++ b/internal/proto/reclaimspace_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc v3.20.2 // source: reclaimspace.proto @@ -15,8 +15,8 @@ import ( // 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.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( ReclaimSpace_ControllerReclaimSpace_FullMethodName = "/proto.ReclaimSpace/ControllerReclaimSpace" @@ -68,7 +68,7 @@ func (c *reclaimSpaceClient) NodeReclaimSpace(ctx context.Context, in *ReclaimSp // ReclaimSpaceServer is the server API for ReclaimSpace service. // All implementations must embed UnimplementedReclaimSpaceServer -// for forward compatibility +// for forward compatibility. // // ReclaimSpace holds the RPC method for allowing the // communication between the CSIAddons controller and the sidecar. @@ -82,9 +82,12 @@ type ReclaimSpaceServer interface { mustEmbedUnimplementedReclaimSpaceServer() } -// UnimplementedReclaimSpaceServer must be embedded to have forward compatible implementations. -type UnimplementedReclaimSpaceServer struct { -} +// UnimplementedReclaimSpaceServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedReclaimSpaceServer struct{} func (UnimplementedReclaimSpaceServer) ControllerReclaimSpace(context.Context, *ReclaimSpaceRequest) (*ReclaimSpaceResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ControllerReclaimSpace not implemented") @@ -93,6 +96,7 @@ func (UnimplementedReclaimSpaceServer) NodeReclaimSpace(context.Context, *Reclai return nil, status.Errorf(codes.Unimplemented, "method NodeReclaimSpace not implemented") } func (UnimplementedReclaimSpaceServer) mustEmbedUnimplementedReclaimSpaceServer() {} +func (UnimplementedReclaimSpaceServer) testEmbeddedByValue() {} // UnsafeReclaimSpaceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ReclaimSpaceServer will @@ -102,6 +106,13 @@ type UnsafeReclaimSpaceServer interface { } func RegisterReclaimSpaceServer(s grpc.ServiceRegistrar, srv ReclaimSpaceServer) { + // If the following call pancis, it indicates UnimplementedReclaimSpaceServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&ReclaimSpace_ServiceDesc, srv) } diff --git a/internal/proto/replication_grpc.pb.go b/internal/proto/replication_grpc.pb.go index a60c8e71d..3db33cfb2 100644 --- a/internal/proto/replication_grpc.pb.go +++ b/internal/proto/replication_grpc.pb.go @@ -1,6 +1,6 @@ // Code generated by protoc-gen-go-grpc. DO NOT EDIT. // versions: -// - protoc-gen-go-grpc v1.4.0 +// - protoc-gen-go-grpc v1.5.0 // - protoc v3.20.2 // source: replication.proto @@ -15,8 +15,8 @@ import ( // 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.62.0 or later. -const _ = grpc.SupportPackageIsVersion8 +// Requires gRPC-Go v1.64.0 or later. +const _ = grpc.SupportPackageIsVersion9 const ( Replication_EnableVolumeReplication_FullMethodName = "/proto.Replication/EnableVolumeReplication" @@ -118,7 +118,7 @@ func (c *replicationClient) GetVolumeReplicationInfo(ctx context.Context, in *Ge // ReplicationServer is the server API for Replication service. // All implementations must embed UnimplementedReplicationServer -// for forward compatibility +// for forward compatibility. // // Replication holds the RPC method for allowing the communication between // the CSIAddons controller and the sidecar for replication operation. @@ -138,9 +138,12 @@ type ReplicationServer interface { mustEmbedUnimplementedReplicationServer() } -// UnimplementedReplicationServer must be embedded to have forward compatible implementations. -type UnimplementedReplicationServer struct { -} +// UnimplementedReplicationServer must be embedded to have +// forward compatible implementations. +// +// NOTE: this should be embedded by value instead of pointer to avoid a nil +// pointer dereference when methods are called. +type UnimplementedReplicationServer struct{} func (UnimplementedReplicationServer) EnableVolumeReplication(context.Context, *EnableVolumeReplicationRequest) (*EnableVolumeReplicationResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method EnableVolumeReplication not implemented") @@ -161,6 +164,7 @@ func (UnimplementedReplicationServer) GetVolumeReplicationInfo(context.Context, return nil, status.Errorf(codes.Unimplemented, "method GetVolumeReplicationInfo not implemented") } func (UnimplementedReplicationServer) mustEmbedUnimplementedReplicationServer() {} +func (UnimplementedReplicationServer) testEmbeddedByValue() {} // UnsafeReplicationServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ReplicationServer will @@ -170,6 +174,13 @@ type UnsafeReplicationServer interface { } func RegisterReplicationServer(s grpc.ServiceRegistrar, srv ReplicationServer) { + // If the following call pancis, it indicates UnimplementedReplicationServer was + // embedded by pointer and is nil. This will cause panics if an + // unimplemented method is ever invoked, so we test this at initialization + // time to prevent it from happening at runtime later due to I/O. + if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { + t.testEmbeddedByValue() + } s.RegisterService(&Replication_ServiceDesc, srv) }