milvus/internal/datanode/collection.go
XuanYang-cn a64c4efde9 Refactor collectionReplica in datanode
Signed-off-by: XuanYang-cn <xuan.yang@zilliz.com>
2021-02-04 20:31:23 +08:00

39 lines
756 B
Go

package datanode
import (
"github.com/zilliztech/milvus-distributed/internal/errors"
"github.com/zilliztech/milvus-distributed/internal/proto/schemapb"
)
type Collection struct {
schema *schemapb.CollectionSchema
id UniqueID
}
func (c *Collection) GetName() string {
if c.schema == nil {
return ""
}
return c.schema.Name
}
func (c *Collection) GetID() UniqueID {
return c.id
}
func (c *Collection) GetSchema() *schemapb.CollectionSchema {
return c.schema
}
func newCollection(collectionID UniqueID, schema *schemapb.CollectionSchema) (*Collection, error) {
if schema == nil {
return nil, errors.Errorf("Invalid schema")
}
var newCollection = &Collection{
schema: schema,
id: collectionID,
}
return newCollection, nil
}