mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-04 21:09:06 +08:00
a5e2d6b6fb
Signed-off-by: longjiquan <jiquan.long@zilliz.com> Co-authored-by: xaxys <tpnnghd@163.com> Signed-off-by: longjiquan <jiquan.long@zilliz.com> Co-authored-by: xaxys <tpnnghd@163.com>
47 lines
989 B
Go
47 lines
989 B
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
|
|
}
|
|
|
|
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,
|
|
}
|
|
}
|
|
|
|
func (a Alias) Equal(other Alias) bool {
|
|
return a.Name == other.Name &&
|
|
a.CollectionID == other.CollectionID
|
|
}
|
|
|
|
func MarshalAliasModel(alias *Alias) *pb.AliasInfo {
|
|
return &pb.AliasInfo{
|
|
AliasName: alias.Name,
|
|
CollectionId: alias.CollectionID,
|
|
CreatedTime: alias.CreatedTime,
|
|
State: alias.State,
|
|
}
|
|
}
|
|
|
|
func UnmarshalAliasModel(info *pb.AliasInfo) *Alias {
|
|
return &Alias{
|
|
Name: info.GetAliasName(),
|
|
CollectionID: info.GetCollectionId(),
|
|
CreatedTime: info.GetCreatedTime(),
|
|
State: info.GetState(),
|
|
}
|
|
}
|