2020-08-25 15:45:19 +08:00
|
|
|
package reader
|
|
|
|
|
2020-08-29 17:42:41 +08:00
|
|
|
/*
|
|
|
|
|
|
|
|
#cgo CFLAGS: -I../core/include
|
|
|
|
|
|
|
|
#cgo LDFLAGS: -L../core/lib -lmilvus_dog_segment -Wl,-rpath=../core/lib
|
|
|
|
|
2020-09-02 10:38:08 +08:00
|
|
|
#include "collection_c.h"
|
|
|
|
#include "partition_c.h"
|
2020-08-29 17:42:41 +08:00
|
|
|
#include "segment_c.h"
|
|
|
|
|
|
|
|
*/
|
2020-08-25 15:45:19 +08:00
|
|
|
import "C"
|
2020-08-28 17:29:26 +08:00
|
|
|
import (
|
2020-09-01 16:23:39 +08:00
|
|
|
"github.com/czs007/suvlim/pulsar/schema"
|
2020-08-28 17:29:26 +08:00
|
|
|
)
|
|
|
|
|
2020-08-28 18:39:00 +08:00
|
|
|
const SegmentLifetime = 20000
|
2020-08-25 15:45:19 +08:00
|
|
|
|
|
|
|
type Segment struct {
|
2020-09-02 10:38:08 +08:00
|
|
|
SegmentPtr C.CSegmentBase
|
2020-09-01 16:23:39 +08:00
|
|
|
SegmentId uint64
|
2020-08-25 15:45:19 +08:00
|
|
|
SegmentCloseTime uint64
|
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Segment) GetRowCount() int64 {
|
|
|
|
// TODO: C type to go type
|
2020-09-02 10:38:08 +08:00
|
|
|
//return C.GetRowCount(s)
|
|
|
|
return 0
|
2020-08-25 15:45:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Segment) GetStatus() int {
|
|
|
|
// TODO: C type to go type
|
2020-09-02 10:38:08 +08:00
|
|
|
//return C.GetStatus(s)
|
|
|
|
return 0
|
2020-08-25 15:45:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Segment) GetMaxTimestamp() uint64 {
|
|
|
|
// TODO: C type to go type
|
2020-09-02 10:38:08 +08:00
|
|
|
//return C.GetMaxTimestamp(s)
|
|
|
|
return 0
|
2020-08-25 15:45:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Segment) GetMinTimestamp() uint64 {
|
|
|
|
// TODO: C type to go type
|
2020-09-02 10:38:08 +08:00
|
|
|
//return C.GetMinTimestamp(s)
|
|
|
|
return 0
|
2020-08-25 15:45:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Segment) GetDeletedCount() uint64 {
|
|
|
|
// TODO: C type to go type
|
2020-09-02 10:38:08 +08:00
|
|
|
//return C.GetDeletedCount(s)
|
|
|
|
return 0
|
2020-08-25 15:45:19 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
func (s *Segment) Close() {
|
|
|
|
// TODO: C type to go type
|
2020-09-02 10:38:08 +08:00
|
|
|
//C.CloseSegment(s)
|
2020-08-25 15:45:19 +08:00
|
|
|
}
|
2020-08-28 17:29:26 +08:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////
|
2020-09-02 10:38:08 +08:00
|
|
|
func SegmentInsert(segment *Segment, entityIds *[]int64, timestamps *[]uint64, dataChunk [][]*schema.FieldValue) ResultEntityIds {
|
|
|
|
// void* raw_data,
|
|
|
|
// int sizeof_per_row,
|
|
|
|
// signed long int count
|
|
|
|
|
2020-08-28 17:29:26 +08:00
|
|
|
return ResultEntityIds{}
|
|
|
|
}
|
|
|
|
|
|
|
|
func SegmentDelete(segment *Segment, collectionName string, entityIds *[]int64, timestamps *[]uint64) ResultEntityIds {
|
|
|
|
// TODO: wrap cgo
|
|
|
|
return ResultEntityIds{}
|
|
|
|
}
|
|
|
|
|
2020-08-28 18:39:00 +08:00
|
|
|
func SegmentSearch(segment *Segment, collectionName string, queryString string, timestamps *[]uint64, vectorRecord *[]schema.VectorRecord) ResultEntityIds {
|
2020-08-28 17:29:26 +08:00
|
|
|
// TODO: wrap cgo
|
|
|
|
return ResultEntityIds{}
|
|
|
|
}
|