Unistore: undo protobuf version change (#102572)

pull/102576/head
Stephanie Hingtgen 3 months ago committed by GitHub
parent ac90e314a6
commit 1483dee75c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 225
      pkg/storage/unified/resource/resource_grpc.pb.go

@ -1,6 +1,6 @@
// Code generated by protoc-gen-go-grpc. DO NOT EDIT. // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions: // versions:
// - protoc-gen-go-grpc v1.5.1 // - protoc-gen-go-grpc v1.4.0
// - protoc (unknown) // - protoc (unknown)
// source: resource.proto // source: resource.proto
@ -15,8 +15,8 @@ import (
// This is a compile-time assertion to ensure that this generated file // This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against. // is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.64.0 or later. // Requires gRPC-Go v1.62.0 or later.
const _ = grpc.SupportPackageIsVersion9 const _ = grpc.SupportPackageIsVersion8
const ( const (
ResourceStore_Read_FullMethodName = "/resource.ResourceStore/Read" ResourceStore_Read_FullMethodName = "/resource.ResourceStore/Read"
@ -47,7 +47,7 @@ type ResourceStoreClient interface {
// The results *may* include values that should not be returned to the user // The results *may* include values that should not be returned to the user
// This will perform best-effort filtering to increase performace. // This will perform best-effort filtering to increase performace.
// NOTE: storage.Interface is ultimatly responsible for the final filtering // NOTE: storage.Interface is ultimatly responsible for the final filtering
Watch(ctx context.Context, in *WatchRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[WatchEvent], error) Watch(ctx context.Context, in *WatchRequest, opts ...grpc.CallOption) (ResourceStore_WatchClient, error)
} }
type resourceStoreClient struct { type resourceStoreClient struct {
@ -108,13 +108,13 @@ func (c *resourceStoreClient) List(ctx context.Context, in *ListRequest, opts ..
return out, nil return out, nil
} }
func (c *resourceStoreClient) Watch(ctx context.Context, in *WatchRequest, opts ...grpc.CallOption) (grpc.ServerStreamingClient[WatchEvent], error) { func (c *resourceStoreClient) Watch(ctx context.Context, in *WatchRequest, opts ...grpc.CallOption) (ResourceStore_WatchClient, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &ResourceStore_ServiceDesc.Streams[0], ResourceStore_Watch_FullMethodName, cOpts...) stream, err := c.cc.NewStream(ctx, &ResourceStore_ServiceDesc.Streams[0], ResourceStore_Watch_FullMethodName, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
x := &grpc.GenericClientStream[WatchRequest, WatchEvent]{ClientStream: stream} x := &resourceStoreWatchClient{ClientStream: stream}
if err := x.ClientStream.SendMsg(in); err != nil { if err := x.ClientStream.SendMsg(in); err != nil {
return nil, err return nil, err
} }
@ -124,12 +124,26 @@ func (c *resourceStoreClient) Watch(ctx context.Context, in *WatchRequest, opts
return x, nil return x, nil
} }
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. type ResourceStore_WatchClient interface {
type ResourceStore_WatchClient = grpc.ServerStreamingClient[WatchEvent] Recv() (*WatchEvent, error)
grpc.ClientStream
}
type resourceStoreWatchClient struct {
grpc.ClientStream
}
func (x *resourceStoreWatchClient) Recv() (*WatchEvent, error) {
m := new(WatchEvent)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// ResourceStoreServer is the server API for ResourceStore service. // ResourceStoreServer is the server API for ResourceStore service.
// All implementations should embed UnimplementedResourceStoreServer // All implementations should embed UnimplementedResourceStoreServer
// for forward compatibility. // for forward compatibility
// //
// This provides the CRUD+List+Watch support needed for a k8s apiserver // This provides the CRUD+List+Watch support needed for a k8s apiserver
// The semantics and behaviors of this service are constrained by kubernetes // The semantics and behaviors of this service are constrained by kubernetes
@ -147,15 +161,12 @@ type ResourceStoreServer interface {
// The results *may* include values that should not be returned to the user // The results *may* include values that should not be returned to the user
// This will perform best-effort filtering to increase performace. // This will perform best-effort filtering to increase performace.
// NOTE: storage.Interface is ultimatly responsible for the final filtering // NOTE: storage.Interface is ultimatly responsible for the final filtering
Watch(*WatchRequest, grpc.ServerStreamingServer[WatchEvent]) error Watch(*WatchRequest, ResourceStore_WatchServer) error
} }
// UnimplementedResourceStoreServer should be embedded to have // UnimplementedResourceStoreServer should be embedded to have forward compatible implementations.
// forward compatible implementations. type UnimplementedResourceStoreServer struct {
// }
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedResourceStoreServer struct{}
func (UnimplementedResourceStoreServer) Read(context.Context, *ReadRequest) (*ReadResponse, error) { func (UnimplementedResourceStoreServer) Read(context.Context, *ReadRequest) (*ReadResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Read not implemented") return nil, status.Errorf(codes.Unimplemented, "method Read not implemented")
@ -172,10 +183,9 @@ func (UnimplementedResourceStoreServer) Delete(context.Context, *DeleteRequest)
func (UnimplementedResourceStoreServer) List(context.Context, *ListRequest) (*ListResponse, error) { func (UnimplementedResourceStoreServer) List(context.Context, *ListRequest) (*ListResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method List not implemented") return nil, status.Errorf(codes.Unimplemented, "method List not implemented")
} }
func (UnimplementedResourceStoreServer) Watch(*WatchRequest, grpc.ServerStreamingServer[WatchEvent]) error { func (UnimplementedResourceStoreServer) Watch(*WatchRequest, ResourceStore_WatchServer) error {
return status.Errorf(codes.Unimplemented, "method Watch not implemented") return status.Errorf(codes.Unimplemented, "method Watch not implemented")
} }
func (UnimplementedResourceStoreServer) testEmbeddedByValue() {}
// UnsafeResourceStoreServer may be embedded to opt out of forward compatibility for this service. // UnsafeResourceStoreServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ResourceStoreServer will // Use of this interface is not recommended, as added methods to ResourceStoreServer will
@ -185,13 +195,6 @@ type UnsafeResourceStoreServer interface {
} }
func RegisterResourceStoreServer(s grpc.ServiceRegistrar, srv ResourceStoreServer) { func RegisterResourceStoreServer(s grpc.ServiceRegistrar, srv ResourceStoreServer) {
// If the following call pancis, it indicates UnimplementedResourceStoreServer 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(&ResourceStore_ServiceDesc, srv) s.RegisterService(&ResourceStore_ServiceDesc, srv)
} }
@ -290,11 +293,21 @@ func _ResourceStore_Watch_Handler(srv interface{}, stream grpc.ServerStream) err
if err := stream.RecvMsg(m); err != nil { if err := stream.RecvMsg(m); err != nil {
return err return err
} }
return srv.(ResourceStoreServer).Watch(m, &grpc.GenericServerStream[WatchRequest, WatchEvent]{ServerStream: stream}) return srv.(ResourceStoreServer).Watch(m, &resourceStoreWatchServer{ServerStream: stream})
}
type ResourceStore_WatchServer interface {
Send(*WatchEvent) error
grpc.ServerStream
}
type resourceStoreWatchServer struct {
grpc.ServerStream
} }
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. func (x *resourceStoreWatchServer) Send(m *WatchEvent) error {
type ResourceStore_WatchServer = grpc.ServerStreamingServer[WatchEvent] return x.ServerStream.SendMsg(m)
}
// ResourceStore_ServiceDesc is the grpc.ServiceDesc for ResourceStore service. // ResourceStore_ServiceDesc is the grpc.ServiceDesc for ResourceStore service.
// It's only intended for direct use with grpc.RegisterService, // It's only intended for direct use with grpc.RegisterService,
@ -345,7 +358,7 @@ type BulkStoreClient interface {
// Write multiple resources to the same Namespace/Group/Resource // Write multiple resources to the same Namespace/Group/Resource
// Events will not be sent until the stream is complete // Events will not be sent until the stream is complete
// Only the *create* permissions is checked // Only the *create* permissions is checked
BulkProcess(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[BulkRequest, BulkResponse], error) BulkProcess(ctx context.Context, opts ...grpc.CallOption) (BulkStore_BulkProcessClient, error)
} }
type bulkStoreClient struct { type bulkStoreClient struct {
@ -356,40 +369,58 @@ func NewBulkStoreClient(cc grpc.ClientConnInterface) BulkStoreClient {
return &bulkStoreClient{cc} return &bulkStoreClient{cc}
} }
func (c *bulkStoreClient) BulkProcess(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStreamingClient[BulkRequest, BulkResponse], error) { func (c *bulkStoreClient) BulkProcess(ctx context.Context, opts ...grpc.CallOption) (BulkStore_BulkProcessClient, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
stream, err := c.cc.NewStream(ctx, &BulkStore_ServiceDesc.Streams[0], BulkStore_BulkProcess_FullMethodName, cOpts...) stream, err := c.cc.NewStream(ctx, &BulkStore_ServiceDesc.Streams[0], BulkStore_BulkProcess_FullMethodName, cOpts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
x := &grpc.GenericClientStream[BulkRequest, BulkResponse]{ClientStream: stream} x := &bulkStoreBulkProcessClient{ClientStream: stream}
return x, nil return x, nil
} }
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. type BulkStore_BulkProcessClient interface {
type BulkStore_BulkProcessClient = grpc.ClientStreamingClient[BulkRequest, BulkResponse] Send(*BulkRequest) error
CloseAndRecv() (*BulkResponse, error)
grpc.ClientStream
}
type bulkStoreBulkProcessClient struct {
grpc.ClientStream
}
func (x *bulkStoreBulkProcessClient) Send(m *BulkRequest) error {
return x.ClientStream.SendMsg(m)
}
func (x *bulkStoreBulkProcessClient) CloseAndRecv() (*BulkResponse, error) {
if err := x.ClientStream.CloseSend(); err != nil {
return nil, err
}
m := new(BulkResponse)
if err := x.ClientStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// BulkStoreServer is the server API for BulkStore service. // BulkStoreServer is the server API for BulkStore service.
// All implementations should embed UnimplementedBulkStoreServer // All implementations should embed UnimplementedBulkStoreServer
// for forward compatibility. // for forward compatibility
type BulkStoreServer interface { type BulkStoreServer interface {
// Write multiple resources to the same Namespace/Group/Resource // Write multiple resources to the same Namespace/Group/Resource
// Events will not be sent until the stream is complete // Events will not be sent until the stream is complete
// Only the *create* permissions is checked // Only the *create* permissions is checked
BulkProcess(grpc.ClientStreamingServer[BulkRequest, BulkResponse]) error BulkProcess(BulkStore_BulkProcessServer) error
} }
// UnimplementedBulkStoreServer should be embedded to have // UnimplementedBulkStoreServer should be embedded to have forward compatible implementations.
// forward compatible implementations. type UnimplementedBulkStoreServer struct {
// }
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedBulkStoreServer struct{}
func (UnimplementedBulkStoreServer) BulkProcess(grpc.ClientStreamingServer[BulkRequest, BulkResponse]) error { func (UnimplementedBulkStoreServer) BulkProcess(BulkStore_BulkProcessServer) error {
return status.Errorf(codes.Unimplemented, "method BulkProcess not implemented") return status.Errorf(codes.Unimplemented, "method BulkProcess not implemented")
} }
func (UnimplementedBulkStoreServer) testEmbeddedByValue() {}
// UnsafeBulkStoreServer may be embedded to opt out of forward compatibility for this service. // UnsafeBulkStoreServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to BulkStoreServer will // Use of this interface is not recommended, as added methods to BulkStoreServer will
@ -399,22 +430,34 @@ type UnsafeBulkStoreServer interface {
} }
func RegisterBulkStoreServer(s grpc.ServiceRegistrar, srv BulkStoreServer) { func RegisterBulkStoreServer(s grpc.ServiceRegistrar, srv BulkStoreServer) {
// If the following call pancis, it indicates UnimplementedBulkStoreServer 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(&BulkStore_ServiceDesc, srv) s.RegisterService(&BulkStore_ServiceDesc, srv)
} }
func _BulkStore_BulkProcess_Handler(srv interface{}, stream grpc.ServerStream) error { func _BulkStore_BulkProcess_Handler(srv interface{}, stream grpc.ServerStream) error {
return srv.(BulkStoreServer).BulkProcess(&grpc.GenericServerStream[BulkRequest, BulkResponse]{ServerStream: stream}) return srv.(BulkStoreServer).BulkProcess(&bulkStoreBulkProcessServer{ServerStream: stream})
} }
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. type BulkStore_BulkProcessServer interface {
type BulkStore_BulkProcessServer = grpc.ClientStreamingServer[BulkRequest, BulkResponse] SendAndClose(*BulkResponse) error
Recv() (*BulkRequest, error)
grpc.ServerStream
}
type bulkStoreBulkProcessServer struct {
grpc.ServerStream
}
func (x *bulkStoreBulkProcessServer) SendAndClose(m *BulkResponse) error {
return x.ServerStream.SendMsg(m)
}
func (x *bulkStoreBulkProcessServer) Recv() (*BulkRequest, error) {
m := new(BulkRequest)
if err := x.ServerStream.RecvMsg(m); err != nil {
return nil, err
}
return m, nil
}
// BulkStore_ServiceDesc is the grpc.ServiceDesc for BulkStore service. // BulkStore_ServiceDesc is the grpc.ServiceDesc for BulkStore service.
// It's only intended for direct use with grpc.RegisterService, // It's only intended for direct use with grpc.RegisterService,
@ -480,7 +523,7 @@ func (c *resourceIndexClient) GetStats(ctx context.Context, in *ResourceStatsReq
// ResourceIndexServer is the server API for ResourceIndex service. // ResourceIndexServer is the server API for ResourceIndex service.
// All implementations should embed UnimplementedResourceIndexServer // All implementations should embed UnimplementedResourceIndexServer
// for forward compatibility. // for forward compatibility
// //
// Unlike the ResourceStore, this service can be exposed to clients directly // Unlike the ResourceStore, this service can be exposed to clients directly
// It should be implemented with efficient indexes and does not need read-after-write semantics // It should be implemented with efficient indexes and does not need read-after-write semantics
@ -490,12 +533,9 @@ type ResourceIndexServer interface {
GetStats(context.Context, *ResourceStatsRequest) (*ResourceStatsResponse, error) GetStats(context.Context, *ResourceStatsRequest) (*ResourceStatsResponse, error)
} }
// UnimplementedResourceIndexServer should be embedded to have // UnimplementedResourceIndexServer should be embedded to have forward compatible implementations.
// forward compatible implementations. type UnimplementedResourceIndexServer struct {
// }
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedResourceIndexServer struct{}
func (UnimplementedResourceIndexServer) Search(context.Context, *ResourceSearchRequest) (*ResourceSearchResponse, error) { func (UnimplementedResourceIndexServer) Search(context.Context, *ResourceSearchRequest) (*ResourceSearchResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method Search not implemented") return nil, status.Errorf(codes.Unimplemented, "method Search not implemented")
@ -503,7 +543,6 @@ func (UnimplementedResourceIndexServer) Search(context.Context, *ResourceSearchR
func (UnimplementedResourceIndexServer) GetStats(context.Context, *ResourceStatsRequest) (*ResourceStatsResponse, error) { func (UnimplementedResourceIndexServer) GetStats(context.Context, *ResourceStatsRequest) (*ResourceStatsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetStats not implemented") return nil, status.Errorf(codes.Unimplemented, "method GetStats not implemented")
} }
func (UnimplementedResourceIndexServer) testEmbeddedByValue() {}
// UnsafeResourceIndexServer may be embedded to opt out of forward compatibility for this service. // UnsafeResourceIndexServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ResourceIndexServer will // Use of this interface is not recommended, as added methods to ResourceIndexServer will
@ -513,13 +552,6 @@ type UnsafeResourceIndexServer interface {
} }
func RegisterResourceIndexServer(s grpc.ServiceRegistrar, srv ResourceIndexServer) { func RegisterResourceIndexServer(s grpc.ServiceRegistrar, srv ResourceIndexServer) {
// If the following call pancis, it indicates UnimplementedResourceIndexServer 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(&ResourceIndex_ServiceDesc, srv) s.RegisterService(&ResourceIndex_ServiceDesc, srv)
} }
@ -627,7 +659,7 @@ func (c *managedObjectIndexClient) ListManagedObjects(ctx context.Context, in *L
// ManagedObjectIndexServer is the server API for ManagedObjectIndex service. // ManagedObjectIndexServer is the server API for ManagedObjectIndex service.
// All implementations should embed UnimplementedManagedObjectIndexServer // All implementations should embed UnimplementedManagedObjectIndexServer
// for forward compatibility. // for forward compatibility
// //
// Query managed objects // Query managed objects
// Results access control is based on access to the repository *not* the items // Results access control is based on access to the repository *not* the items
@ -638,12 +670,9 @@ type ManagedObjectIndexServer interface {
ListManagedObjects(context.Context, *ListManagedObjectsRequest) (*ListManagedObjectsResponse, error) ListManagedObjects(context.Context, *ListManagedObjectsRequest) (*ListManagedObjectsResponse, error)
} }
// UnimplementedManagedObjectIndexServer should be embedded to have // UnimplementedManagedObjectIndexServer should be embedded to have forward compatible implementations.
// forward compatible implementations. type UnimplementedManagedObjectIndexServer struct {
// }
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedManagedObjectIndexServer struct{}
func (UnimplementedManagedObjectIndexServer) CountManagedObjects(context.Context, *CountManagedObjectsRequest) (*CountManagedObjectsResponse, error) { func (UnimplementedManagedObjectIndexServer) CountManagedObjects(context.Context, *CountManagedObjectsRequest) (*CountManagedObjectsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method CountManagedObjects not implemented") return nil, status.Errorf(codes.Unimplemented, "method CountManagedObjects not implemented")
@ -651,7 +680,6 @@ func (UnimplementedManagedObjectIndexServer) CountManagedObjects(context.Context
func (UnimplementedManagedObjectIndexServer) ListManagedObjects(context.Context, *ListManagedObjectsRequest) (*ListManagedObjectsResponse, error) { func (UnimplementedManagedObjectIndexServer) ListManagedObjects(context.Context, *ListManagedObjectsRequest) (*ListManagedObjectsResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListManagedObjects not implemented") return nil, status.Errorf(codes.Unimplemented, "method ListManagedObjects not implemented")
} }
func (UnimplementedManagedObjectIndexServer) testEmbeddedByValue() {}
// UnsafeManagedObjectIndexServer may be embedded to opt out of forward compatibility for this service. // UnsafeManagedObjectIndexServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to ManagedObjectIndexServer will // Use of this interface is not recommended, as added methods to ManagedObjectIndexServer will
@ -661,13 +689,6 @@ type UnsafeManagedObjectIndexServer interface {
} }
func RegisterManagedObjectIndexServer(s grpc.ServiceRegistrar, srv ManagedObjectIndexServer) { func RegisterManagedObjectIndexServer(s grpc.ServiceRegistrar, srv ManagedObjectIndexServer) {
// If the following call pancis, it indicates UnimplementedManagedObjectIndexServer 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(&ManagedObjectIndex_ServiceDesc, srv) s.RegisterService(&ManagedObjectIndex_ServiceDesc, srv)
} }
@ -773,7 +794,7 @@ func (c *blobStoreClient) GetBlob(ctx context.Context, in *GetBlobRequest, opts
// BlobStoreServer is the server API for BlobStore service. // BlobStoreServer is the server API for BlobStore service.
// All implementations should embed UnimplementedBlobStoreServer // All implementations should embed UnimplementedBlobStoreServer
// for forward compatibility. // for forward compatibility
type BlobStoreServer interface { type BlobStoreServer interface {
// Upload a blob that will be saved in a resource // Upload a blob that will be saved in a resource
PutBlob(context.Context, *PutBlobRequest) (*PutBlobResponse, error) PutBlob(context.Context, *PutBlobRequest) (*PutBlobResponse, error)
@ -782,12 +803,9 @@ type BlobStoreServer interface {
GetBlob(context.Context, *GetBlobRequest) (*GetBlobResponse, error) GetBlob(context.Context, *GetBlobRequest) (*GetBlobResponse, error)
} }
// UnimplementedBlobStoreServer should be embedded to have // UnimplementedBlobStoreServer should be embedded to have forward compatible implementations.
// forward compatible implementations. type UnimplementedBlobStoreServer struct {
// }
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedBlobStoreServer struct{}
func (UnimplementedBlobStoreServer) PutBlob(context.Context, *PutBlobRequest) (*PutBlobResponse, error) { func (UnimplementedBlobStoreServer) PutBlob(context.Context, *PutBlobRequest) (*PutBlobResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method PutBlob not implemented") return nil, status.Errorf(codes.Unimplemented, "method PutBlob not implemented")
@ -795,7 +813,6 @@ func (UnimplementedBlobStoreServer) PutBlob(context.Context, *PutBlobRequest) (*
func (UnimplementedBlobStoreServer) GetBlob(context.Context, *GetBlobRequest) (*GetBlobResponse, error) { func (UnimplementedBlobStoreServer) GetBlob(context.Context, *GetBlobRequest) (*GetBlobResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method GetBlob not implemented") return nil, status.Errorf(codes.Unimplemented, "method GetBlob not implemented")
} }
func (UnimplementedBlobStoreServer) testEmbeddedByValue() {}
// UnsafeBlobStoreServer may be embedded to opt out of forward compatibility for this service. // UnsafeBlobStoreServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to BlobStoreServer will // Use of this interface is not recommended, as added methods to BlobStoreServer will
@ -805,13 +822,6 @@ type UnsafeBlobStoreServer interface {
} }
func RegisterBlobStoreServer(s grpc.ServiceRegistrar, srv BlobStoreServer) { func RegisterBlobStoreServer(s grpc.ServiceRegistrar, srv BlobStoreServer) {
// If the following call pancis, it indicates UnimplementedBlobStoreServer 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(&BlobStore_ServiceDesc, srv) s.RegisterService(&BlobStore_ServiceDesc, srv)
} }
@ -906,7 +916,7 @@ func (c *diagnosticsClient) IsHealthy(ctx context.Context, in *HealthCheckReques
// DiagnosticsServer is the server API for Diagnostics service. // DiagnosticsServer is the server API for Diagnostics service.
// All implementations should embed UnimplementedDiagnosticsServer // All implementations should embed UnimplementedDiagnosticsServer
// for forward compatibility. // for forward compatibility
// //
// Clients can use this service directly // Clients can use this service directly
// NOTE: This is read only, and no read afer write guarantees // NOTE: This is read only, and no read afer write guarantees
@ -915,17 +925,13 @@ type DiagnosticsServer interface {
IsHealthy(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) IsHealthy(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error)
} }
// UnimplementedDiagnosticsServer should be embedded to have // UnimplementedDiagnosticsServer should be embedded to have forward compatible implementations.
// forward compatible implementations. type UnimplementedDiagnosticsServer struct {
// }
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedDiagnosticsServer struct{}
func (UnimplementedDiagnosticsServer) IsHealthy(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) { func (UnimplementedDiagnosticsServer) IsHealthy(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method IsHealthy not implemented") return nil, status.Errorf(codes.Unimplemented, "method IsHealthy not implemented")
} }
func (UnimplementedDiagnosticsServer) testEmbeddedByValue() {}
// UnsafeDiagnosticsServer may be embedded to opt out of forward compatibility for this service. // UnsafeDiagnosticsServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to DiagnosticsServer will // Use of this interface is not recommended, as added methods to DiagnosticsServer will
@ -935,13 +941,6 @@ type UnsafeDiagnosticsServer interface {
} }
func RegisterDiagnosticsServer(s grpc.ServiceRegistrar, srv DiagnosticsServer) { func RegisterDiagnosticsServer(s grpc.ServiceRegistrar, srv DiagnosticsServer) {
// If the following call pancis, it indicates UnimplementedDiagnosticsServer 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(&Diagnostics_ServiceDesc, srv) s.RegisterService(&Diagnostics_ServiceDesc, srv)
} }

Loading…
Cancel
Save