milvus/internal/rootcoord/drop_alias_task.go

30 lines
700 B
Go
Raw Normal View History

package rootcoord
import (
"context"
"github.com/milvus-io/milvus-proto/go-api/commonpb"
"github.com/milvus-io/milvus-proto/go-api/milvuspb"
)
type dropAliasTask struct {
baseTask
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())
}