diff --git a/databroker/databroker.go b/databroker/databroker.go index 46d3de975..39c459425 100644 --- a/databroker/databroker.go +++ b/databroker/databroker.go @@ -16,9 +16,6 @@ import ( // A dataBrokerServer implements the data broker service interface. type dataBrokerServer struct { - databrokerpb.UnimplementedDataBrokerServiceServer - registrypb.UnimplementedRegistryServer - server *databroker.Server sharedKey *atomicutil.Value[[]byte] } diff --git a/internal/databroker/server.go b/internal/databroker/server.go index 0ebfabd92..a9dac9e23 100644 --- a/internal/databroker/server.go +++ b/internal/databroker/server.go @@ -26,8 +26,6 @@ import ( // Server implements the databroker service using an in memory database. type Server struct { - databroker.UnimplementedDataBrokerServiceServer - cfg *serverConfig mu sync.RWMutex diff --git a/internal/registry/inmemory/inmemory.go b/internal/registry/inmemory/inmemory.go index 6cb20e4ee..0edb97cac 100644 --- a/internal/registry/inmemory/inmemory.go +++ b/internal/registry/inmemory/inmemory.go @@ -17,8 +17,6 @@ import ( ) type inMemoryServer struct { - pb.UnimplementedRegistryServer - ttl time.Duration // onchange is used to broadcast changes to listeners onchange *signal.Signal diff --git a/pkg/grpc/cli/api_grpc.pb.go b/pkg/grpc/cli/api_grpc.pb.go index 77c9baa0d..ab199aca5 100644 --- a/pkg/grpc/cli/api_grpc.pb.go +++ b/pkg/grpc/cli/api_grpc.pb.go @@ -96,7 +96,7 @@ func (c *configClient) Import(ctx context.Context, in *ImportRequest, opts ...gr } // ConfigServer is the server API for Config service. -// All implementations must embed UnimplementedConfigServer +// All implementations should embed UnimplementedConfigServer // for forward compatibility. type ConfigServer interface { List(context.Context, *Selector) (*ListRecordsResponse, error) @@ -104,10 +104,9 @@ type ConfigServer interface { Upsert(context.Context, *Record) (*Record, error) Export(context.Context, *ExportRequest) (*ConfigData, error) Import(context.Context, *ImportRequest) (*ImportResponse, error) - mustEmbedUnimplementedConfigServer() } -// UnimplementedConfigServer must be embedded to have +// UnimplementedConfigServer should be embedded to have // forward compatible implementations. // // NOTE: this should be embedded by value instead of pointer to avoid a nil @@ -129,8 +128,7 @@ func (UnimplementedConfigServer) Export(context.Context, *ExportRequest) (*Confi func (UnimplementedConfigServer) Import(context.Context, *ImportRequest) (*ImportResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Import not implemented") } -func (UnimplementedConfigServer) mustEmbedUnimplementedConfigServer() {} -func (UnimplementedConfigServer) testEmbeddedByValue() {} +func (UnimplementedConfigServer) testEmbeddedByValue() {} // UnsafeConfigServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ConfigServer will @@ -329,7 +327,7 @@ func (c *listenerClient) StatusUpdates(ctx context.Context, in *Selector, opts . type Listener_StatusUpdatesClient = grpc.ServerStreamingClient[ConnectionStatusUpdates] // ListenerServer is the server API for Listener service. -// All implementations must embed UnimplementedListenerServer +// All implementations should embed UnimplementedListenerServer // for forward compatibility. // // Listener service controls listeners @@ -340,10 +338,9 @@ type ListenerServer interface { // a client has to subscribe and continuously // listen to the broadcasted updates StatusUpdates(*Selector, grpc.ServerStreamingServer[ConnectionStatusUpdates]) error - mustEmbedUnimplementedListenerServer() } -// UnimplementedListenerServer must be embedded to have +// UnimplementedListenerServer should be embedded to have // forward compatible implementations. // // NOTE: this should be embedded by value instead of pointer to avoid a nil @@ -356,8 +353,7 @@ func (UnimplementedListenerServer) Update(context.Context, *ListenerUpdateReques func (UnimplementedListenerServer) StatusUpdates(*Selector, grpc.ServerStreamingServer[ConnectionStatusUpdates]) error { return status.Errorf(codes.Unimplemented, "method StatusUpdates not implemented") } -func (UnimplementedListenerServer) mustEmbedUnimplementedListenerServer() {} -func (UnimplementedListenerServer) testEmbeddedByValue() {} +func (UnimplementedListenerServer) testEmbeddedByValue() {} // UnsafeListenerServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to ListenerServer will diff --git a/pkg/grpc/databroker/databroker_grpc.pb.go b/pkg/grpc/databroker/databroker_grpc.pb.go index 1f8b76aad..9e9c21f23 100644 --- a/pkg/grpc/databroker/databroker_grpc.pb.go +++ b/pkg/grpc/databroker/databroker_grpc.pb.go @@ -200,7 +200,7 @@ func (c *dataBrokerServiceClient) SyncLatest(ctx context.Context, in *SyncLatest type DataBrokerService_SyncLatestClient = grpc.ServerStreamingClient[SyncLatestResponse] // DataBrokerServiceServer is the server API for DataBrokerService service. -// All implementations must embed UnimplementedDataBrokerServiceServer +// All implementations should embed UnimplementedDataBrokerServiceServer // for forward compatibility. // // The DataBrokerService stores key-value data. @@ -227,10 +227,9 @@ type DataBrokerServiceServer interface { Sync(*SyncRequest, grpc.ServerStreamingServer[SyncResponse]) error // SyncLatest streams the latest version of every record. SyncLatest(*SyncLatestRequest, grpc.ServerStreamingServer[SyncLatestResponse]) error - mustEmbedUnimplementedDataBrokerServiceServer() } -// UnimplementedDataBrokerServiceServer must be embedded to have +// UnimplementedDataBrokerServiceServer should be embedded to have // forward compatible implementations. // // NOTE: this should be embedded by value instead of pointer to avoid a nil @@ -270,8 +269,7 @@ func (UnimplementedDataBrokerServiceServer) Sync(*SyncRequest, grpc.ServerStream func (UnimplementedDataBrokerServiceServer) SyncLatest(*SyncLatestRequest, grpc.ServerStreamingServer[SyncLatestResponse]) error { return status.Errorf(codes.Unimplemented, "method SyncLatest not implemented") } -func (UnimplementedDataBrokerServiceServer) mustEmbedUnimplementedDataBrokerServiceServer() {} -func (UnimplementedDataBrokerServiceServer) testEmbeddedByValue() {} +func (UnimplementedDataBrokerServiceServer) testEmbeddedByValue() {} // UnsafeDataBrokerServiceServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to DataBrokerServiceServer will diff --git a/pkg/grpc/protoc.bash b/pkg/grpc/protoc.bash index 6f7adde3d..c7354ab26 100755 --- a/pkg/grpc/protoc.bash +++ b/pkg/grpc/protoc.bash @@ -92,6 +92,7 @@ for _d in "${_sub_directories[@]}"; do --go_opt="paths=source_relative" \ --go-grpc_out="./$_d" \ --go-grpc_opt="paths=source_relative" \ + --go-grpc_opt="require_unimplemented_servers=false" \ "${_imports[@]}" \ "./$_d/"*.proto done diff --git a/pkg/grpc/registry/registry_grpc.pb.go b/pkg/grpc/registry/registry_grpc.pb.go index 905bdc4df..34e64480a 100644 --- a/pkg/grpc/registry/registry_grpc.pb.go +++ b/pkg/grpc/registry/registry_grpc.pb.go @@ -89,7 +89,7 @@ func (c *registryClient) Watch(ctx context.Context, in *ListRequest, opts ...grp type Registry_WatchClient = grpc.ServerStreamingClient[ServiceList] // RegistryServer is the server API for Registry service. -// All implementations must embed UnimplementedRegistryServer +// All implementations should embed UnimplementedRegistryServer // for forward compatibility. // // Registry is invoked by services to inform @@ -103,10 +103,9 @@ type RegistryServer interface { // for the simplicity of consumer its delivered as full snapshots // and is only sent when change is detected Watch(*ListRequest, grpc.ServerStreamingServer[ServiceList]) error - mustEmbedUnimplementedRegistryServer() } -// UnimplementedRegistryServer must be embedded to have +// UnimplementedRegistryServer should be embedded to have // forward compatible implementations. // // NOTE: this should be embedded by value instead of pointer to avoid a nil @@ -122,8 +121,7 @@ func (UnimplementedRegistryServer) List(context.Context, *ListRequest) (*Service func (UnimplementedRegistryServer) Watch(*ListRequest, grpc.ServerStreamingServer[ServiceList]) error { return status.Errorf(codes.Unimplemented, "method Watch not implemented") } -func (UnimplementedRegistryServer) mustEmbedUnimplementedRegistryServer() {} -func (UnimplementedRegistryServer) testEmbeddedByValue() {} +func (UnimplementedRegistryServer) testEmbeddedByValue() {} // UnsafeRegistryServer may be embedded to opt out of forward compatibility for this service. // Use of this interface is not recommended, as added methods to RegistryServer will