Skip to content

Commit

Permalink
refactor index manager service
Browse files Browse the repository at this point in the history
Signed-off-by: kpango <[email protected]>
  • Loading branch information
kpango committed Jul 24, 2023
1 parent 6f5fb18 commit 752da2b
Show file tree
Hide file tree
Showing 187 changed files with 2,682 additions and 1,078 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4750,7 +4750,7 @@
- :white_check_mark: add internal/config/ngt test ([#554](https://github.com/vdaas/vald/pull/554))
- :white_check_mark: internal/cache/cacher test ([#553](https://github.com/vdaas/vald/pull/553))
- :white_check_mark: Add test case for `internal/file` ([#550](https://github.com/vdaas/vald/pull/550))
- :white_check_mark: add internal/singleflight test ([#542](https://github.com/vdaas/vald/pull/542))
- :white_check_mark: add internal/sync/singleflight test ([#542](https://github.com/vdaas/vald/pull/542))
- not to force rebuild gotests ([#548](https://github.com/vdaas/vald/pull/548))
- :pencil: Add use case document ([#482](https://github.com/vdaas/vald/pull/482))
- :white_check_mark: add internal/log/mock/retry test ([#549](https://github.com/vdaas/vald/pull/549))
Expand Down Expand Up @@ -5272,7 +5272,7 @@
- internal gRPC client for Vald
- Cassandra NewConvictionPolicy
- dicoverer now returns clone object
- new internal/singleflight package
- new internal/sync/singleflight package
- new internal/net package
- coding guideline

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ clean:
license:
GOPRIVATE=$(GOPRIVATE) \
MAINTAINER=$(MAINTAINER) \
go run -mod=readonly hack/license/gen/main.go ./
go run -mod=readonly hack/license/gen/main.go $(ROOTDIR)

.PHONY: init
## initialize development environment
Expand Down
2 changes: 1 addition & 1 deletion Makefile.d/test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ gotests/patch:
@$(call green, "apply patches to go test files...")
find $(ROOTDIR)/internal/k8s/* -name '*_test.go' | xargs sed -i -E "s%k8s.io/apimachinery/pkg/api/errors%github.com/vdaas/vald/internal/errors%g"
find $(ROOTDIR)/* -name '*_test.go' | xargs sed -i -E "s%cockroachdb/errors%vdaas/vald/internal/errors%g"
find $(ROOTDIR)/* -name '*_test.go' | xargs sed -i -E "s%golang.org/x/sync/errgroup%github.com/vdaas/vald/internal/errgroup%g"
find $(ROOTDIR)/* -name '*_test.go' | xargs sed -i -E "s%golang.org/x/sync/errgroup%github.com/vdaas/vald/internal/sync/errgroup%g"
find $(ROOTDIR)/* -name '*_test.go' | xargs sed -i -E "s%pkg/errors%vdaas/vald/internal/errors%g"
find $(ROOTDIR)/* -name '*_test.go' | xargs sed -i -E "s%go-errors/errors%vdaas/vald/internal/errors%g"
find $(ROOTDIR)/* -name '*_test.go' | xargs sed -i -E "s%go.uber.org/goleak%github.com/vdaas/vald/internal/test/goleak%g"
Expand Down
29 changes: 25 additions & 4 deletions apis/docs/v1/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
- [Info.IPs](#payload-v1-Info-IPs)
- [Info.Index](#payload-v1-Info-Index)
- [Info.Index.Count](#payload-v1-Info-Index-Count)
- [Info.Index.Detail](#payload-v1-Info-Index-Detail)
- [Info.Index.Detail.CountsEntry](#payload-v1-Info-Index-Detail-CountsEntry)
- [Info.Index.UUID](#payload-v1-Info-Index-UUID)
- [Info.Index.UUID.Committed](#payload-v1-Info-Index-UUID-Committed)
- [Info.Index.UUID.Uncommitted](#payload-v1-Info-Index-UUID-Uncommitted)
Expand Down Expand Up @@ -87,7 +89,6 @@
- [Upsert.MultiRequest](#payload-v1-Upsert-MultiRequest)
- [Upsert.ObjectRequest](#payload-v1-Upsert-ObjectRequest)
- [Upsert.Request](#payload-v1-Upsert-Request)

- [Search.AggregationAlgorithm](#payload-v1-Search-AggregationAlgorithm)

- [apis/proto/v1/vald/filter.proto](#apis_proto_v1_vald_filter-proto)
Expand Down Expand Up @@ -203,9 +204,10 @@ Represent the ingress filter service.

Represent the index manager service.

| Method Name | Request Type | Response Type | Description |
| ----------- | -------------------------------------- | ------------------------------------------------------------ | ----------------------------------------------- |
| IndexInfo | [.payload.v1.Empty](#payload-v1-Empty) | [.payload.v1.Info.Index.Count](#payload-v1-Info-Index-Count) | Represent the RPC to get the index information. |
| Method Name | Request Type | Response Type | Description |
| ----------- | -------------------------------------- | -------------------------------------------------------------- | --------------------------------------------------------------- |
| IndexInfo | [.payload.v1.Empty](#payload-v1-Empty) | [.payload.v1.Info.Index.Count](#payload-v1-Info-Index-Count) | Represent the RPC to get the index information. |
| IndexDetail | [.payload.v1.Empty](#payload-v1-Empty) | [.payload.v1.Info.Index.Detail](#payload-v1-Info-Index-Detail) | Represent the RPC to get the index information for each agents. |

<a name="apis_proto_v1_payload_payload-proto"></a>

Expand Down Expand Up @@ -327,6 +329,25 @@ Represent the index count message.
| indexing | [bool](#bool) | | The indexing index count. |
| saving | [bool](#bool) | | The saving index count. |

<a name="payload-v1-Info-Index-Detail"></a>

### Info.Index.Detail

Represent the index count for each Agents message.

| Field | Type | Label | Description |
| ------ | -------------------------------------------------------------------------- | -------- | --------------------------- |
| counts | [Info.Index.Detail.CountsEntry](#payload-v1-Info-Index-Detail-CountsEntry) | repeated | count infos for each agents |

<a name="payload-v1-Info-Index-Detail-CountsEntry"></a>

### Info.Index.Detail.CountsEntry

| Field | Type | Label | Description |
| ----- | ------------------------------------------------ | ----- | ----------- |
| key | [string](#string) | | |
| value | [Info.Index.Count](#payload-v1-Info-Index-Count) | | |

<a name="payload-v1-Info-Index-UUID"></a>

### Info.Index.UUID
Expand Down
4 changes: 2 additions & 2 deletions apis/grpc/v1/agent/core/agent.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions apis/grpc/v1/agent/sidecar/sidecar.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions apis/grpc/v1/discoverer/discoverer.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions apis/grpc/v1/filter/egress/egress_filter.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions apis/grpc/v1/filter/ingress/ingress_filter.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 30 additions & 21 deletions apis/grpc/v1/manager/index/index_manager.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions apis/grpc/v1/manager/index/index_manager_vtproto.pb.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ const _ = grpc.SupportPackageIsVersion7
type IndexClient interface {
// Represent the RPC to get the index information.
IndexInfo(ctx context.Context, in *payload.Empty, opts ...grpc.CallOption) (*payload.Info_Index_Count, error)
// Represent the RPC to get the index information for each agents.
IndexDetail(ctx context.Context, in *payload.Empty, opts ...grpc.CallOption) (*payload.Info_Index_Detail, error)
}

type indexClient struct {
Expand All @@ -63,12 +65,23 @@ func (c *indexClient) IndexInfo(ctx context.Context, in *payload.Empty, opts ...
return out, nil
}

func (c *indexClient) IndexDetail(ctx context.Context, in *payload.Empty, opts ...grpc.CallOption) (*payload.Info_Index_Detail, error) {
out := new(payload.Info_Index_Detail)
err := c.cc.Invoke(ctx, "/manager.index.v1.Index/IndexDetail", in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}

// IndexServer is the server API for Index service.
// All implementations must embed UnimplementedIndexServer
// for forward compatibility
type IndexServer interface {
// Represent the RPC to get the index information.
IndexInfo(context.Context, *payload.Empty) (*payload.Info_Index_Count, error)
// Represent the RPC to get the index information for each agents.
IndexDetail(context.Context, *payload.Empty) (*payload.Info_Index_Detail, error)
mustEmbedUnimplementedIndexServer()
}

Expand All @@ -79,6 +92,9 @@ type UnimplementedIndexServer struct {
func (UnimplementedIndexServer) IndexInfo(context.Context, *payload.Empty) (*payload.Info_Index_Count, error) {
return nil, status.Errorf(codes.Unimplemented, "method IndexInfo not implemented")
}
func (UnimplementedIndexServer) IndexDetail(context.Context, *payload.Empty) (*payload.Info_Index_Detail, error) {
return nil, status.Errorf(codes.Unimplemented, "method IndexDetail not implemented")
}
func (UnimplementedIndexServer) mustEmbedUnimplementedIndexServer() {}

// UnsafeIndexServer may be embedded to opt out of forward compatibility for this service.
Expand Down Expand Up @@ -110,6 +126,24 @@ func _Index_IndexInfo_Handler(srv interface{}, ctx context.Context, dec func(int
return interceptor(ctx, in, info, handler)
}

func _Index_IndexDetail_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(payload.Empty)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(IndexServer).IndexDetail(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: "/manager.index.v1.Index/IndexDetail",
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(IndexServer).IndexDetail(ctx, req.(*payload.Empty))
}
return interceptor(ctx, in, info, handler)
}

// Index_ServiceDesc is the grpc.ServiceDesc for Index service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
Expand All @@ -121,6 +155,10 @@ var Index_ServiceDesc = grpc.ServiceDesc{
MethodName: "IndexInfo",
Handler: _Index_IndexInfo_Handler,
},
{
MethodName: "IndexDetail",
Handler: _Index_IndexDetail_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "apis/proto/v1/manager/index/index_manager.proto",
Expand Down
Loading

0 comments on commit 752da2b

Please sign in to comment.