jaime 18df2ba6fd
[Cherry-Pick] Support Database (#24769)
Support Database(#23742)
Fix db nonexists error for FlushAll (#24222)
Fix check collection limits fails (#24235)
backward compatibility with empty DB name (#24317)
Fix GetFlushAllState with DB (#24347)
Remove db from global meta cache after drop database (#24474)
Fix db name is empty for describe collection response (#24603)
Add RBAC for Database API (#24653)
Fix miss load the same name collection during recover stage (#24941)

RBAC supports Database validation (#23609)
Fix to list grant with db return empty (#23922)
Optimize PrivilegeAll permission check (#23972)
Add the default db value for the rbac request (#24307)

Signed-off-by: jaime <yun.zhang@zilliz.com>
Co-authored-by: SimFG <bang.fu@zilliz.com>
Co-authored-by: longjiquan <jiquan.long@zilliz.com>
2023-06-25 17:20:43 +08:00

52 lines
1.1 KiB
Go

package model
import pb "github.com/milvus-io/milvus/internal/proto/etcdpb"
type Alias struct {
Name string
CollectionID int64
CreatedTime uint64
State pb.AliasState
DbID int64
}
func (a Alias) Available() bool {
return a.State == pb.AliasState_AliasCreated
}
func (a Alias) Clone() *Alias {
return &Alias{
Name: a.Name,
CollectionID: a.CollectionID,
CreatedTime: a.CreatedTime,
State: a.State,
DbID: a.DbID,
}
}
func (a Alias) Equal(other Alias) bool {
return a.Name == other.Name &&
a.CollectionID == other.CollectionID &&
a.DbID == other.DbID
}
func MarshalAliasModel(alias *Alias) *pb.AliasInfo {
return &pb.AliasInfo{
AliasName: alias.Name,
CollectionId: alias.CollectionID,
CreatedTime: alias.CreatedTime,
State: alias.State,
DbId: alias.DbID,
}
}
func UnmarshalAliasModel(info *pb.AliasInfo) *Alias {
return &Alias{
Name: info.GetAliasName(),
CollectionID: info.GetCollectionId(),
CreatedTime: info.GetCreatedTime(),
State: info.GetState(),
DbID: info.GetDbId(),
}
}