mirror of
https://gitee.com/milvus-io/milvus.git
synced 2024-12-04 04:49:08 +08:00
ddddd65d10
Signed-off-by: sunby <bingyi.sun@zilliz.com>
40 lines
704 B
Go
40 lines
704 B
Go
package datanode
|
|
|
|
import (
|
|
"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.New("invalid schema")
|
|
}
|
|
|
|
var newCollection = &Collection{
|
|
schema: schema,
|
|
id: collectionID,
|
|
}
|
|
return newCollection, nil
|
|
}
|