2020-08-25 15:45:19 +08:00
|
|
|
package reader
|
|
|
|
|
2020-09-01 16:23:39 +08:00
|
|
|
/*
|
|
|
|
|
2020-09-18 15:44:09 +08:00
|
|
|
#cgo CFLAGS: -I${SRCDIR}/../../core/include
|
2020-09-01 16:23:39 +08:00
|
|
|
|
2020-09-18 15:44:09 +08:00
|
|
|
#cgo LDFLAGS: -L${SRCDIR}/../../core/lib -lmilvus_dog_segment -Wl,-rpath=${SRCDIR}/../../core/lib
|
2020-09-01 16:23:39 +08:00
|
|
|
|
2020-09-02 10:38:08 +08:00
|
|
|
#include "collection_c.h"
|
2020-09-01 16:23:39 +08:00
|
|
|
#include "partition_c.h"
|
2020-09-02 10:38:08 +08:00
|
|
|
#include "segment_c.h"
|
2020-09-01 16:23:39 +08:00
|
|
|
|
|
|
|
*/
|
2020-08-25 15:45:19 +08:00
|
|
|
import "C"
|
|
|
|
|
|
|
|
type Collection struct {
|
2020-09-21 10:32:20 +08:00
|
|
|
CollectionPtr C.CCollection
|
2020-08-25 15:45:19 +08:00
|
|
|
CollectionName string
|
2020-09-21 10:32:20 +08:00
|
|
|
CollectionID uint64
|
|
|
|
Partitions []*Partition
|
2020-08-25 15:45:19 +08:00
|
|
|
}
|
|
|
|
|
2020-09-01 16:23:39 +08:00
|
|
|
func (c *Collection) NewPartition(partitionName string) *Partition {
|
2020-08-31 15:54:44 +08:00
|
|
|
cName := C.CString(partitionName)
|
2020-09-01 16:23:39 +08:00
|
|
|
partitionPtr := C.NewPartition(c.CollectionPtr, cName)
|
2020-08-25 15:45:19 +08:00
|
|
|
|
2020-08-31 15:54:44 +08:00
|
|
|
var newPartition = &Partition{PartitionPtr: partitionPtr, PartitionName: partitionName}
|
|
|
|
c.Partitions = append(c.Partitions, newPartition)
|
2020-09-01 16:23:39 +08:00
|
|
|
return newPartition
|
2020-08-25 15:45:19 +08:00
|
|
|
}
|
|
|
|
|
2020-09-01 16:23:39 +08:00
|
|
|
func (c *Collection) DeletePartition(partition *Partition) {
|
|
|
|
cPtr := partition.PartitionPtr
|
|
|
|
C.DeletePartition(cPtr)
|
2020-08-25 15:45:19 +08:00
|
|
|
|
2020-08-31 15:54:44 +08:00
|
|
|
// TODO: remove from c.Partitions
|
2020-08-25 15:45:19 +08:00
|
|
|
}
|