mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-11-29 18:38:44 +08:00
enhance: [GoSDK] Expose indexing progress in DescribeIndex result (#35066)
See also #31293 Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
This commit is contained in:
parent
a8a4779749
commit
cabb200498
@ -13,6 +13,7 @@ require (
|
||||
github.com/stretchr/testify v1.8.4
|
||||
github.com/tidwall/gjson v1.17.1
|
||||
go.uber.org/atomic v1.10.0
|
||||
golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2
|
||||
google.golang.org/grpc v1.57.1
|
||||
google.golang.org/protobuf v1.33.0
|
||||
)
|
||||
@ -107,7 +108,6 @@ require (
|
||||
go.uber.org/multierr v1.7.0 // indirect
|
||||
go.uber.org/zap v1.20.0 // indirect
|
||||
golang.org/x/crypto v0.22.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20230224173230-c95f2b4c22f2 // indirect
|
||||
golang.org/x/net v0.24.0 // indirect
|
||||
golang.org/x/sync v0.1.0 // indirect
|
||||
golang.org/x/sys v0.20.0 // indirect
|
||||
|
@ -126,9 +126,17 @@ func (c *Client) ListIndexes(ctx context.Context, opt ListIndexOption, callOptio
|
||||
return indexes, err
|
||||
}
|
||||
|
||||
func (c *Client) DescribeIndex(ctx context.Context, opt DescribeIndexOption, callOptions ...grpc.CallOption) (index.Index, error) {
|
||||
type IndexDescription struct {
|
||||
index.Index
|
||||
State index.IndexState
|
||||
PendingIndexRows int64
|
||||
TotalRows int64
|
||||
IndexedRows int64
|
||||
}
|
||||
|
||||
func (c *Client) DescribeIndex(ctx context.Context, opt DescribeIndexOption, callOptions ...grpc.CallOption) (IndexDescription, error) {
|
||||
req := opt.Request()
|
||||
var idx index.Index
|
||||
var idx IndexDescription
|
||||
|
||||
err := c.callService(func(milvusService milvuspb.MilvusServiceClient) error {
|
||||
resp, err := milvusService.DescribeIndex(ctx, req, callOptions...)
|
||||
@ -141,7 +149,13 @@ func (c *Client) DescribeIndex(ctx context.Context, opt DescribeIndexOption, cal
|
||||
}
|
||||
for _, idxDef := range resp.GetIndexDescriptions() {
|
||||
if idxDef.GetIndexName() == req.GetIndexName() {
|
||||
idx = index.NewGenericIndex(idxDef.GetIndexName(), entity.KvPairsMap(idxDef.GetParams()))
|
||||
idx = IndexDescription{
|
||||
Index: index.NewGenericIndex(idxDef.GetIndexName(), entity.KvPairsMap(idxDef.GetParams())),
|
||||
State: index.IndexState(idxDef.GetState()),
|
||||
PendingIndexRows: idxDef.GetPendingIndexRows(),
|
||||
IndexedRows: idxDef.GetIndexedRows(),
|
||||
TotalRows: idxDef.GetTotalRows(),
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user