mirror of https://github.com/milvus-io/milvus.git
44 lines
896 B
Go
44 lines
896 B
Go
package reader
|
|
|
|
/*
|
|
|
|
#cgo CFLAGS: -I${SRCDIR}/../../core/include
|
|
|
|
#cgo LDFLAGS: -L${SRCDIR}/../../core/lib -lmilvus_dog_segment -Wl,-rpath=${SRCDIR}/../../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 int64) *Segment {
|
|
/*
|
|
CSegmentBase
|
|
NewSegment(CPartition partition, unsigned long segment_id);
|
|
*/
|
|
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) {
|
|
/*
|
|
void
|
|
DeleteSegment(CSegmentBase segment);
|
|
*/
|
|
cPtr := segment.SegmentPtr
|
|
C.DeleteSegment(cPtr)
|
|
|
|
// TODO: remove from p.Segments
|
|
}
|