milvus/reader/partition.go
bigsheeper 41d638abb5 Add message client and refactor segment go, construct raw data for segment insertion
Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
2020-09-08 10:39:09 +08:00

37 lines
762 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
OpenedSegments []*Segment
ClosedSegments []*Segment
}
func (p *Partition) NewSegment(segmentId int64) *Segment {
segmentPtr := C.NewSegment(p.PartitionPtr, C.ulong(segmentId))
var newSegment = &Segment{SegmentPtr: segmentPtr, SegmentId: segmentId}
p.OpenedSegments = append(p.OpenedSegments, newSegment)
return newSegment
}
func (p *Partition) DeleteSegment(segment *Segment) {
cPtr := segment.SegmentPtr
C.DeleteSegment(cPtr)
// TODO: remove from p.Segments
}