197 lines
7.5 KiB
Go
197 lines
7.5 KiB
Go
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
|
// versions:
|
|
// - protoc-gen-go-grpc v1.4.0
|
|
// - protoc (unknown)
|
|
// source: search.proto
|
|
|
|
package resourcepb
|
|
|
|
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.62.0 or later.
|
|
const _ = grpc.SupportPackageIsVersion8
|
|
|
|
const (
|
|
ResourceIndex_Search_FullMethodName = "/resource.ResourceIndex/Search"
|
|
ResourceIndex_GetStats_FullMethodName = "/resource.ResourceIndex/GetStats"
|
|
ResourceIndex_RebuildIndexes_FullMethodName = "/resource.ResourceIndex/RebuildIndexes"
|
|
)
|
|
|
|
// 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.
|
|
//
|
|
// 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 {
|
|
// Query for documents
|
|
Search(ctx context.Context, in *ResourceSearchRequest, opts ...grpc.CallOption) (*ResourceSearchResponse, error)
|
|
// Get the resource stats
|
|
GetStats(ctx context.Context, in *ResourceStatsRequest, opts ...grpc.CallOption) (*ResourceStatsResponse, error)
|
|
// Rebuild the search index
|
|
RebuildIndexes(ctx context.Context, in *RebuildIndexesRequest, opts ...grpc.CallOption) (*RebuildIndexesResponse, error)
|
|
}
|
|
|
|
type resourceIndexClient struct {
|
|
cc grpc.ClientConnInterface
|
|
}
|
|
|
|
func NewResourceIndexClient(cc grpc.ClientConnInterface) ResourceIndexClient {
|
|
return &resourceIndexClient{cc}
|
|
}
|
|
|
|
func (c *resourceIndexClient) Search(ctx context.Context, in *ResourceSearchRequest, opts ...grpc.CallOption) (*ResourceSearchResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(ResourceSearchResponse)
|
|
err := c.cc.Invoke(ctx, ResourceIndex_Search_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *resourceIndexClient) GetStats(ctx context.Context, in *ResourceStatsRequest, opts ...grpc.CallOption) (*ResourceStatsResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(ResourceStatsResponse)
|
|
err := c.cc.Invoke(ctx, ResourceIndex_GetStats_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
func (c *resourceIndexClient) RebuildIndexes(ctx context.Context, in *RebuildIndexesRequest, opts ...grpc.CallOption) (*RebuildIndexesResponse, error) {
|
|
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
|
|
out := new(RebuildIndexesResponse)
|
|
err := c.cc.Invoke(ctx, ResourceIndex_RebuildIndexes_FullMethodName, in, out, cOpts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return out, nil
|
|
}
|
|
|
|
// ResourceIndexServer is the server API for ResourceIndex service.
|
|
// All implementations should embed UnimplementedResourceIndexServer
|
|
// for forward compatibility
|
|
//
|
|
// 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 {
|
|
// Query for documents
|
|
Search(context.Context, *ResourceSearchRequest) (*ResourceSearchResponse, error)
|
|
// Get the resource stats
|
|
GetStats(context.Context, *ResourceStatsRequest) (*ResourceStatsResponse, error)
|
|
// Rebuild the search index
|
|
RebuildIndexes(context.Context, *RebuildIndexesRequest) (*RebuildIndexesResponse, error)
|
|
}
|
|
|
|
// UnimplementedResourceIndexServer should be embedded to have forward compatible implementations.
|
|
type UnimplementedResourceIndexServer struct {
|
|
}
|
|
|
|
func (UnimplementedResourceIndexServer) Search(context.Context, *ResourceSearchRequest) (*ResourceSearchResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method Search not implemented")
|
|
}
|
|
func (UnimplementedResourceIndexServer) GetStats(context.Context, *ResourceStatsRequest) (*ResourceStatsResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method GetStats not implemented")
|
|
}
|
|
func (UnimplementedResourceIndexServer) RebuildIndexes(context.Context, *RebuildIndexesRequest) (*RebuildIndexesResponse, error) {
|
|
return nil, status.Errorf(codes.Unimplemented, "method RebuildIndexes not implemented")
|
|
}
|
|
|
|
// 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 UnsafeResourceIndexServer interface {
|
|
mustEmbedUnimplementedResourceIndexServer()
|
|
}
|
|
|
|
func RegisterResourceIndexServer(s grpc.ServiceRegistrar, srv ResourceIndexServer) {
|
|
s.RegisterService(&ResourceIndex_ServiceDesc, srv)
|
|
}
|
|
|
|
func _ResourceIndex_Search_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(ResourceSearchRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(ResourceIndexServer).Search(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: ResourceIndex_Search_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(ResourceIndexServer).Search(ctx, req.(*ResourceSearchRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _ResourceIndex_GetStats_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(ResourceStatsRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(ResourceIndexServer).GetStats(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: ResourceIndex_GetStats_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(ResourceIndexServer).GetStats(ctx, req.(*ResourceStatsRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
func _ResourceIndex_RebuildIndexes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
|
in := new(RebuildIndexesRequest)
|
|
if err := dec(in); err != nil {
|
|
return nil, err
|
|
}
|
|
if interceptor == nil {
|
|
return srv.(ResourceIndexServer).RebuildIndexes(ctx, in)
|
|
}
|
|
info := &grpc.UnaryServerInfo{
|
|
Server: srv,
|
|
FullMethod: ResourceIndex_RebuildIndexes_FullMethodName,
|
|
}
|
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
|
return srv.(ResourceIndexServer).RebuildIndexes(ctx, req.(*RebuildIndexesRequest))
|
|
}
|
|
return interceptor(ctx, in, info, handler)
|
|
}
|
|
|
|
// 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 ResourceIndex_ServiceDesc = grpc.ServiceDesc{
|
|
ServiceName: "resource.ResourceIndex",
|
|
HandlerType: (*ResourceIndexServer)(nil),
|
|
Methods: []grpc.MethodDesc{
|
|
{
|
|
MethodName: "Search",
|
|
Handler: _ResourceIndex_Search_Handler,
|
|
},
|
|
{
|
|
MethodName: "GetStats",
|
|
Handler: _ResourceIndex_GetStats_Handler,
|
|
},
|
|
{
|
|
MethodName: "RebuildIndexes",
|
|
Handler: _ResourceIndex_RebuildIndexes_Handler,
|
|
},
|
|
},
|
|
Streams: []grpc.StreamDesc{},
|
|
Metadata: "search.proto",
|
|
}
|