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 Sep 14, 2023
1 parent 9a08508 commit 537ca39
Show file tree
Hide file tree
Showing 22 changed files with 1,054 additions and 261 deletions.
28 changes: 25 additions & 3 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 @@ -224,9 +226,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 @@ -348,6 +351,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
47 changes: 28 additions & 19 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 537ca39

Please sign in to comment.