2022-10-28 13:25:34 +08:00
|
|
|
package rootcoord
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/milvus-io/milvus-proto/go-api/commonpb"
|
|
|
|
"github.com/milvus-io/milvus-proto/go-api/milvuspb"
|
|
|
|
)
|
|
|
|
|
|
|
|
// describeCollectionTask describe collection request task
|
|
|
|
type describeCollectionTask struct {
|
|
|
|
baseTask
|
2023-01-04 16:37:35 +08:00
|
|
|
Req *milvuspb.DescribeCollectionRequest
|
|
|
|
Rsp *milvuspb.DescribeCollectionResponse
|
|
|
|
allowUnavailable bool
|
2022-10-28 13:25:34 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (t *describeCollectionTask) Prepare(ctx context.Context) error {
|
|
|
|
if err := CheckMsgType(t.Req.Base.MsgType, commonpb.MsgType_DescribeCollection); err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
|
|
|
// Execute task execution
|
|
|
|
func (t *describeCollectionTask) Execute(ctx context.Context) (err error) {
|
2023-01-04 16:37:35 +08:00
|
|
|
coll, err := t.core.describeCollection(ctx, t.Req, t.allowUnavailable)
|
2022-10-28 13:25:34 +08:00
|
|
|
if err != nil {
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
aliases := t.core.meta.ListAliasesByID(coll.CollectionID)
|
|
|
|
t.Rsp = convertModelToDesc(coll, aliases)
|
|
|
|
return nil
|
|
|
|
}
|