From ddae2b49698fddfd7fd2efb713da7089077ea069 Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Tue, 2 Jul 2024 07:23:53 -0700 Subject: [PATCH] rename search service to index service --- pkg/registry/apis/dashboard/legacy/types.go | 2 +- pkg/storage/unified/apistore/history.go | 4 +- .../unified/resource/client_wrapper.go | 4 +- pkg/storage/unified/resource/noop.go | 6 +- pkg/storage/unified/resource/resource.pb.go | 59 +++++----- pkg/storage/unified/resource/resource.proto | 6 +- .../unified/resource/resource_grpc.pb.go | 102 +++++++++--------- pkg/storage/unified/resource/server.go | 6 +- 8 files changed, 94 insertions(+), 95 deletions(-) diff --git a/pkg/registry/apis/dashboard/legacy/types.go b/pkg/registry/apis/dashboard/legacy/types.go index a8778d1cd4e..84c8eb96c0a 100644 --- a/pkg/registry/apis/dashboard/legacy/types.go +++ b/pkg/registry/apis/dashboard/legacy/types.go @@ -26,7 +26,7 @@ type DashboardQuery struct { type DashboardAccess interface { resource.AppendingStore resource.BlobStore - resource.ResourceSearchServer + resource.ResourceIndexServer GetDashboard(ctx context.Context, orgId int64, uid string) (*dashboardsV0.Dashboard, int64, error) SaveDashboard(ctx context.Context, orgId int64, dash *dashboardsV0.Dashboard) (*dashboardsV0.Dashboard, bool, error) diff --git a/pkg/storage/unified/apistore/history.go b/pkg/storage/unified/apistore/history.go index ee97760c173..9116645656f 100644 --- a/pkg/storage/unified/apistore/history.go +++ b/pkg/storage/unified/apistore/history.go @@ -21,7 +21,7 @@ type HistoryConnector interface { rest.StorageMetadata } -func NewHistoryConnector(search resource.ResourceSearchServer, gr schema.GroupResource) HistoryConnector { +func NewHistoryConnector(search resource.ResourceIndexServer, gr schema.GroupResource) HistoryConnector { return &historyREST{ search: search, gr: gr, @@ -29,7 +29,7 @@ func NewHistoryConnector(search resource.ResourceSearchServer, gr schema.GroupRe } type historyREST struct { - search resource.ResourceSearchServer // should be a client! + search resource.ResourceIndexServer // should be a client! gr schema.GroupResource } diff --git a/pkg/storage/unified/resource/client_wrapper.go b/pkg/storage/unified/resource/client_wrapper.go index ea71dee90a4..e4ecf52d06d 100644 --- a/pkg/storage/unified/resource/client_wrapper.go +++ b/pkg/storage/unified/resource/client_wrapper.go @@ -25,7 +25,7 @@ func NewLocalResourceStoreClient(server ResourceStoreServer) ResourceStoreClient return NewResourceStoreClient(grpchan.InterceptClientConn(channel, grpcUtils.UnaryClientInterceptor, grpcUtils.StreamClientInterceptor)) } -func NewLocalResourceSearchClient(server ResourceStoreServer) ResourceSearchClient { +func NewLocalResourceSearchClient(server ResourceStoreServer) ResourceIndexClient { channel := &inprocgrpc.Channel{} auth := &grpcUtils.Authenticator{} @@ -38,7 +38,7 @@ func NewLocalResourceSearchClient(server ResourceStoreServer) ResourceSearchClie ), server, ) - return NewResourceSearchClient(grpchan.InterceptClientConn(channel, grpcUtils.UnaryClientInterceptor, grpcUtils.StreamClientInterceptor)) + return NewResourceIndexClient(grpchan.InterceptClientConn(channel, grpcUtils.UnaryClientInterceptor, grpcUtils.StreamClientInterceptor)) } func NewResourceStoreClientGRPC(channel *grpc.ClientConn) ResourceStoreClient { diff --git a/pkg/storage/unified/resource/noop.go b/pkg/storage/unified/resource/noop.go index ee204fd791a..b24c4ef0259 100644 --- a/pkg/storage/unified/resource/noop.go +++ b/pkg/storage/unified/resource/noop.go @@ -7,9 +7,9 @@ import ( ) var ( - _ ResourceSearchServer = &noopService{} - _ DiagnosticsServer = &noopService{} - _ LifecycleHooks = &noopService{} + _ ResourceIndexServer = &noopService{} + _ DiagnosticsServer = &noopService{} + _ LifecycleHooks = &noopService{} ) // noopService is a helper implementation to simplify tests diff --git a/pkg/storage/unified/resource/resource.pb.go b/pkg/storage/unified/resource/resource.pb.go index 4cdd83b432f..61a80b61b2e 100644 --- a/pkg/storage/unified/resource/resource.pb.go +++ b/pkg/storage/unified/resource/resource.pb.go @@ -1202,7 +1202,6 @@ type ListOptions struct { unknownFields protoimpl.UnknownFields // Namespace+Group+Resource+etc - // This must *not* include the resource version Key *ResourceKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` // (best effort) Match label // Allowed to send more results than actually match because the filter will be appled @@ -2742,29 +2741,29 @@ var file_resource_proto_rawDesc = []byte{ 0x74, 0x42, 0x6c, 0x6f, 0x62, 0x12, 0x18, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, 0x6f, 0x62, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x47, 0x65, 0x74, 0x42, 0x6c, - 0x6f, 0x62, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xc4, 0x01, 0x0a, 0x0e, 0x52, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x35, 0x0a, - 0x04, 0x52, 0x65, 0x61, 0x64, 0x12, 0x15, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, - 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x72, - 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x07, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x12, - 0x18, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x48, 0x69, 0x73, 0x74, 0x6f, - 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x72, 0x65, 0x73, 0x6f, - 0x75, 0x72, 0x63, 0x65, 0x2e, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x06, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x17, - 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, - 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, - 0x63, 0x65, 0x2e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x32, 0x57, 0x0a, 0x0b, 0x44, 0x69, 0x61, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x73, - 0x12, 0x48, 0x0a, 0x09, 0x49, 0x73, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x12, 0x1c, 0x2e, - 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, - 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x72, 0x65, - 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, - 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x39, 0x5a, 0x37, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x61, 0x66, 0x61, 0x6e, 0x61, - 0x2f, 0x67, 0x72, 0x61, 0x66, 0x61, 0x6e, 0x61, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x74, 0x6f, - 0x72, 0x61, 0x67, 0x65, 0x2f, 0x75, 0x6e, 0x69, 0x66, 0x69, 0x65, 0x64, 0x2f, 0x72, 0x65, 0x73, - 0x6f, 0x75, 0x72, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x6f, 0x62, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xc3, 0x01, 0x0a, 0x0d, 0x52, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x35, 0x0a, 0x04, + 0x52, 0x65, 0x61, 0x64, 0x12, 0x15, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, + 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x16, 0x2e, 0x72, 0x65, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x52, 0x65, 0x61, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x3e, 0x0a, 0x07, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x12, 0x18, + 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, + 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x19, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, + 0x72, 0x63, 0x65, 0x2e, 0x48, 0x69, 0x73, 0x74, 0x6f, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x3b, 0x0a, 0x06, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x12, 0x17, 0x2e, + 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x72, 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, + 0x65, 0x2e, 0x4f, 0x72, 0x69, 0x67, 0x69, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x32, 0x57, 0x0a, 0x0b, 0x44, 0x69, 0x61, 0x67, 0x6e, 0x6f, 0x73, 0x74, 0x69, 0x63, 0x73, 0x12, + 0x48, 0x0a, 0x09, 0x49, 0x73, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x79, 0x12, 0x1c, 0x2e, 0x72, + 0x65, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, + 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x72, 0x65, 0x73, + 0x6f, 0x75, 0x72, 0x63, 0x65, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, + 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x42, 0x39, 0x5a, 0x37, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x67, 0x72, 0x61, 0x66, 0x61, 0x6e, 0x61, 0x2f, + 0x67, 0x72, 0x61, 0x66, 0x61, 0x6e, 0x61, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x74, 0x6f, 0x72, + 0x61, 0x67, 0x65, 0x2f, 0x75, 0x6e, 0x69, 0x66, 0x69, 0x65, 0x64, 0x2f, 0x72, 0x65, 0x73, 0x6f, + 0x75, 0x72, 0x63, 0x65, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2857,9 +2856,9 @@ var file_resource_proto_depIdxs = []int32{ 22, // 34: resource.ResourceStore.Watch:input_type -> resource.WatchRequest 31, // 35: resource.ResourceStore.PutBlob:input_type -> resource.PutBlobRequest 33, // 36: resource.ResourceStore.GetBlob:input_type -> resource.GetBlobRequest - 15, // 37: resource.ResourceSearch.Read:input_type -> resource.ReadRequest - 24, // 38: resource.ResourceSearch.History:input_type -> resource.HistoryRequest - 26, // 39: resource.ResourceSearch.Origin:input_type -> resource.OriginRequest + 15, // 37: resource.ResourceIndex.Read:input_type -> resource.ReadRequest + 24, // 38: resource.ResourceIndex.History:input_type -> resource.HistoryRequest + 26, // 39: resource.ResourceIndex.Origin:input_type -> resource.OriginRequest 29, // 40: resource.Diagnostics.IsHealthy:input_type -> resource.HealthCheckRequest 16, // 41: resource.ResourceStore.Read:output_type -> resource.ReadResponse 10, // 42: resource.ResourceStore.Create:output_type -> resource.CreateResponse @@ -2869,9 +2868,9 @@ var file_resource_proto_depIdxs = []int32{ 23, // 46: resource.ResourceStore.Watch:output_type -> resource.WatchEvent 32, // 47: resource.ResourceStore.PutBlob:output_type -> resource.PutBlobResponse 34, // 48: resource.ResourceStore.GetBlob:output_type -> resource.GetBlobResponse - 16, // 49: resource.ResourceSearch.Read:output_type -> resource.ReadResponse - 25, // 50: resource.ResourceSearch.History:output_type -> resource.HistoryResponse - 28, // 51: resource.ResourceSearch.Origin:output_type -> resource.OriginResponse + 16, // 49: resource.ResourceIndex.Read:output_type -> resource.ReadResponse + 25, // 50: resource.ResourceIndex.History:output_type -> resource.HistoryResponse + 28, // 51: resource.ResourceIndex.Origin:output_type -> resource.OriginResponse 30, // 52: resource.Diagnostics.IsHealthy:output_type -> resource.HealthCheckResponse 41, // [41:53] is the sub-list for method output_type 29, // [29:41] is the sub-list for method input_type diff --git a/pkg/storage/unified/resource/resource.proto b/pkg/storage/unified/resource/resource.proto index 086078d8802..f7f81cfb4a4 100644 --- a/pkg/storage/unified/resource/resource.proto +++ b/pkg/storage/unified/resource/resource.proto @@ -458,9 +458,9 @@ service ResourceStore { // >> cleanup will be managed via garbage collection or direct access to the underlying storage } -// Clients can use this service directly -// NOTE: This is read only, and no read afer write guarantees -service ResourceSearch { +// 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 +service ResourceIndex { // TODO: rpc Search(...) ... eventually a typed response rpc Read(ReadRequest) returns (ReadResponse); // Duplicated -- for client read only usage diff --git a/pkg/storage/unified/resource/resource_grpc.pb.go b/pkg/storage/unified/resource/resource_grpc.pb.go index 2f01e3355ad..a8dba906d9a 100644 --- a/pkg/storage/unified/resource/resource_grpc.pb.go +++ b/pkg/storage/unified/resource/resource_grpc.pb.go @@ -418,18 +418,18 @@ var ResourceStore_ServiceDesc = grpc.ServiceDesc{ } const ( - ResourceSearch_Read_FullMethodName = "/resource.ResourceSearch/Read" - ResourceSearch_History_FullMethodName = "/resource.ResourceSearch/History" - ResourceSearch_Origin_FullMethodName = "/resource.ResourceSearch/Origin" + ResourceIndex_Read_FullMethodName = "/resource.ResourceIndex/Read" + ResourceIndex_History_FullMethodName = "/resource.ResourceIndex/History" + ResourceIndex_Origin_FullMethodName = "/resource.ResourceIndex/Origin" ) -// ResourceSearchClient is the client API for ResourceSearch service. +// ResourceIndexClient is the client API for ResourceIndex 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. // -// Clients can use this service directly -// NOTE: This is read only, and no read afer write guarantees -type ResourceSearchClient interface { +// 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 +type ResourceIndexClient interface { Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (*ReadResponse, error) // Show resource history (and trash) History(ctx context.Context, in *HistoryRequest, opts ...grpc.CallOption) (*HistoryResponse, error) @@ -437,51 +437,51 @@ type ResourceSearchClient interface { Origin(ctx context.Context, in *OriginRequest, opts ...grpc.CallOption) (*OriginResponse, error) } -type resourceSearchClient struct { +type resourceIndexClient struct { cc grpc.ClientConnInterface } -func NewResourceSearchClient(cc grpc.ClientConnInterface) ResourceSearchClient { - return &resourceSearchClient{cc} +func NewResourceIndexClient(cc grpc.ClientConnInterface) ResourceIndexClient { + return &resourceIndexClient{cc} } -func (c *resourceSearchClient) Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (*ReadResponse, error) { +func (c *resourceIndexClient) Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (*ReadResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(ReadResponse) - err := c.cc.Invoke(ctx, ResourceSearch_Read_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, ResourceIndex_Read_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *resourceSearchClient) History(ctx context.Context, in *HistoryRequest, opts ...grpc.CallOption) (*HistoryResponse, error) { +func (c *resourceIndexClient) History(ctx context.Context, in *HistoryRequest, opts ...grpc.CallOption) (*HistoryResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(HistoryResponse) - err := c.cc.Invoke(ctx, ResourceSearch_History_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, ResourceIndex_History_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -func (c *resourceSearchClient) Origin(ctx context.Context, in *OriginRequest, opts ...grpc.CallOption) (*OriginResponse, error) { +func (c *resourceIndexClient) Origin(ctx context.Context, in *OriginRequest, opts ...grpc.CallOption) (*OriginResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(OriginResponse) - err := c.cc.Invoke(ctx, ResourceSearch_Origin_FullMethodName, in, out, cOpts...) + err := c.cc.Invoke(ctx, ResourceIndex_Origin_FullMethodName, in, out, cOpts...) if err != nil { return nil, err } return out, nil } -// ResourceSearchServer is the server API for ResourceSearch service. -// All implementations should embed UnimplementedResourceSearchServer +// ResourceIndexServer is the server API for ResourceIndex service. +// All implementations should embed UnimplementedResourceIndexServer // for forward compatibility // -// Clients can use this service directly -// NOTE: This is read only, and no read afer write guarantees -type ResourceSearchServer interface { +// 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 +type ResourceIndexServer interface { Read(context.Context, *ReadRequest) (*ReadResponse, error) // Show resource history (and trash) History(context.Context, *HistoryRequest) (*HistoryResponse, error) @@ -489,103 +489,103 @@ type ResourceSearchServer interface { Origin(context.Context, *OriginRequest) (*OriginResponse, error) } -// UnimplementedResourceSearchServer should be embedded to have forward compatible implementations. -type UnimplementedResourceSearchServer struct { +// UnimplementedResourceIndexServer should be embedded to have forward compatible implementations. +type UnimplementedResourceIndexServer struct { } -func (UnimplementedResourceSearchServer) Read(context.Context, *ReadRequest) (*ReadResponse, error) { +func (UnimplementedResourceIndexServer) Read(context.Context, *ReadRequest) (*ReadResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Read not implemented") } -func (UnimplementedResourceSearchServer) History(context.Context, *HistoryRequest) (*HistoryResponse, error) { +func (UnimplementedResourceIndexServer) History(context.Context, *HistoryRequest) (*HistoryResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method History not implemented") } -func (UnimplementedResourceSearchServer) Origin(context.Context, *OriginRequest) (*OriginResponse, error) { +func (UnimplementedResourceIndexServer) Origin(context.Context, *OriginRequest) (*OriginResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Origin not implemented") } -// UnsafeResourceSearchServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to ResourceSearchServer will +// 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 // result in compilation errors. -type UnsafeResourceSearchServer interface { - mustEmbedUnimplementedResourceSearchServer() +type UnsafeResourceIndexServer interface { + mustEmbedUnimplementedResourceIndexServer() } -func RegisterResourceSearchServer(s grpc.ServiceRegistrar, srv ResourceSearchServer) { - s.RegisterService(&ResourceSearch_ServiceDesc, srv) +func RegisterResourceIndexServer(s grpc.ServiceRegistrar, srv ResourceIndexServer) { + s.RegisterService(&ResourceIndex_ServiceDesc, srv) } -func _ResourceSearch_Read_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _ResourceIndex_Read_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(ReadRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ResourceSearchServer).Read(ctx, in) + return srv.(ResourceIndexServer).Read(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ResourceSearch_Read_FullMethodName, + FullMethod: ResourceIndex_Read_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ResourceSearchServer).Read(ctx, req.(*ReadRequest)) + return srv.(ResourceIndexServer).Read(ctx, req.(*ReadRequest)) } return interceptor(ctx, in, info, handler) } -func _ResourceSearch_History_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _ResourceIndex_History_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(HistoryRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ResourceSearchServer).History(ctx, in) + return srv.(ResourceIndexServer).History(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ResourceSearch_History_FullMethodName, + FullMethod: ResourceIndex_History_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ResourceSearchServer).History(ctx, req.(*HistoryRequest)) + return srv.(ResourceIndexServer).History(ctx, req.(*HistoryRequest)) } return interceptor(ctx, in, info, handler) } -func _ResourceSearch_Origin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { +func _ResourceIndex_Origin_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(OriginRequest) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(ResourceSearchServer).Origin(ctx, in) + return srv.(ResourceIndexServer).Origin(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: ResourceSearch_Origin_FullMethodName, + FullMethod: ResourceIndex_Origin_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(ResourceSearchServer).Origin(ctx, req.(*OriginRequest)) + return srv.(ResourceIndexServer).Origin(ctx, req.(*OriginRequest)) } return interceptor(ctx, in, info, handler) } -// ResourceSearch_ServiceDesc is the grpc.ServiceDesc for ResourceSearch service. +// ResourceIndex_ServiceDesc is the grpc.ServiceDesc for ResourceIndex service. // It's only intended for direct use with grpc.RegisterService, // and not to be introspected or modified (even as a copy) -var ResourceSearch_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "resource.ResourceSearch", - HandlerType: (*ResourceSearchServer)(nil), +var ResourceIndex_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "resource.ResourceIndex", + HandlerType: (*ResourceIndexServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Read", - Handler: _ResourceSearch_Read_Handler, + Handler: _ResourceIndex_Read_Handler, }, { MethodName: "History", - Handler: _ResourceSearch_History_Handler, + Handler: _ResourceIndex_History_Handler, }, { MethodName: "Origin", - Handler: _ResourceSearch_Origin_Handler, + Handler: _ResourceIndex_Origin_Handler, }, }, Streams: []grpc.StreamDesc{}, diff --git a/pkg/storage/unified/resource/server.go b/pkg/storage/unified/resource/server.go index c57d4cbcab1..01ff6dbfa2a 100644 --- a/pkg/storage/unified/resource/server.go +++ b/pkg/storage/unified/resource/server.go @@ -36,7 +36,7 @@ var ( // ResourceServer implements all services type ResourceServer interface { ResourceStoreServer - ResourceSearchServer + ResourceIndexServer DiagnosticsServer LifecycleHooks } @@ -95,7 +95,7 @@ type ResourceServerOptions struct { Blob BlobStore // Real storage backend - Search ResourceSearchServer + Search ResourceIndexServer // Diagnostics Diagnostics DiagnosticsServer @@ -178,7 +178,7 @@ type server struct { log *slog.Logger nextEventID func() int64 store AppendingStore - search ResourceSearchServer + search ResourceIndexServer blob BlobStore diagnostics DiagnosticsServer access WriteAccessHooks