milvus/reader/partition.go
bigsheeper 39addf0a55 Update cgo interfaces and add query node id
Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
2020-09-02 10:38:08 +08:00

36 lines
718 B
Go

package reader
/*
#cgo CFLAGS: -I../core/include
#cgo LDFLAGS: -L../core/lib -lmilvus_dog_segment -Wl,-rpath=../core/lib
#include "collection_c.h"
#include "partition_c.h"
#include "segment_c.h"
*/
import "C"
type Partition struct {
PartitionPtr C.CPartition
PartitionName string
Segments []*Segment
}
func (p *Partition) NewSegment(segmentId uint64) *Segment {
segmentPtr := C.NewSegment(p.PartitionPtr, C.ulong(segmentId))
var newSegment = &Segment{SegmentPtr: segmentPtr, SegmentId: segmentId}
p.Segments = append(p.Segments, newSegment)
return newSegment
}
func (p *Partition) DeleteSegment(segment *Segment) {
cPtr := segment.SegmentPtr
C.DeleteSegment(cPtr)
// TODO: remove from p.Segments
}