milvus/internal/rootcoord/drop_alias_task.go
SimFG d7f38a803d
Separate some proto files (#19218)
Signed-off-by: SimFG <bang.fu@zilliz.com>

Signed-off-by: SimFG <bang.fu@zilliz.com>
2022-09-16 16:56:49 +08:00

30 lines
684 B
Go

package rootcoord
import (
"context"
"github.com/milvus-io/milvus/api/commonpb"
"github.com/milvus-io/milvus/api/milvuspb"
)
type dropAliasTask struct {
baseTaskV2
Req *milvuspb.DropAliasRequest
}
func (t *dropAliasTask) Prepare(ctx context.Context) error {
if err := CheckMsgType(t.Req.GetBase().GetMsgType(), commonpb.MsgType_DropAlias); err != nil {
return err
}
return nil
}
func (t *dropAliasTask) Execute(ctx context.Context) error {
// drop alias is atomic enough.
if err := t.core.ExpireMetaCache(ctx, []string{t.Req.GetAlias()}, InvalidCollectionID, t.GetTs()); err != nil {
return err
}
return t.core.meta.DropAlias(ctx, t.Req.GetAlias(), t.GetTs())
}