2020-08-25 07:45:19 +00:00
|
|
|
package reader
|
|
|
|
|
2020-09-02 02:38:08 +00:00
|
|
|
/*
|
|
|
|
|
2020-10-23 10:01:24 +00:00
|
|
|
#cgo CFLAGS: -I${SRCDIR}/../core/output/include
|
2020-09-02 02:38:08 +00:00
|
|
|
|
2020-10-31 07:11:47 +00:00
|
|
|
#cgo LDFLAGS: -L${SRCDIR}/../core/output/lib -lmilvus_segcore -Wl,-rpath=${SRCDIR}/../core/output/lib
|
2020-09-02 02:38:08 +00:00
|
|
|
|
|
|
|
#include "collection_c.h"
|
|
|
|
#include "segment_c.h"
|
|
|
|
|
|
|
|
*/
|
2020-08-25 07:45:19 +00:00
|
|
|
import "C"
|
2020-09-02 02:38:08 +00:00
|
|
|
|
2020-08-25 07:45:19 +00:00
|
|
|
import (
|
2020-10-15 13:31:50 +00:00
|
|
|
"context"
|
2020-08-25 07:45:19 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type QueryNode struct {
|
2020-10-15 13:31:50 +00:00
|
|
|
ctx context.Context
|
|
|
|
|
2020-11-05 02:52:50 +00:00
|
|
|
QueryNodeID uint64
|
|
|
|
pulsarURL string
|
2020-08-25 07:45:19 +00:00
|
|
|
|
2020-11-09 08:27:11 +00:00
|
|
|
tSafe Timestamp
|
2020-09-07 09:01:46 +00:00
|
|
|
|
2020-11-13 09:20:13 +00:00
|
|
|
container *container
|
2020-08-25 07:45:19 +00:00
|
|
|
|
2020-11-09 08:27:11 +00:00
|
|
|
dataSyncService *dataSyncService
|
|
|
|
metaService *metaService
|
|
|
|
searchService *searchService
|
|
|
|
statsService *statsService
|
2020-11-05 02:52:50 +00:00
|
|
|
}
|
2020-09-07 09:01:46 +00:00
|
|
|
|
2020-11-05 02:52:50 +00:00
|
|
|
func NewQueryNode(ctx context.Context, queryNodeID uint64, pulsarURL string) *QueryNode {
|
|
|
|
segmentsMap := make(map[int64]*Segment)
|
2020-11-09 08:27:11 +00:00
|
|
|
collections := make([]*Collection, 0)
|
2020-09-23 09:38:15 +00:00
|
|
|
|
2020-11-13 09:20:13 +00:00
|
|
|
var container container = &colSegContainer{
|
|
|
|
collections: collections,
|
|
|
|
segments: segmentsMap,
|
|
|
|
}
|
|
|
|
|
2020-09-15 09:41:05 +00:00
|
|
|
return &QueryNode{
|
2020-11-05 02:52:50 +00:00
|
|
|
ctx: ctx,
|
2020-09-15 09:41:05 +00:00
|
|
|
|
2020-11-05 02:52:50 +00:00
|
|
|
QueryNodeID: queryNodeID,
|
|
|
|
pulsarURL: pulsarURL,
|
2020-09-15 09:41:05 +00:00
|
|
|
|
2020-11-09 08:27:11 +00:00
|
|
|
tSafe: 0,
|
2020-09-15 09:41:05 +00:00
|
|
|
|
2020-11-13 09:20:13 +00:00
|
|
|
container: &container,
|
2020-09-15 09:41:05 +00:00
|
|
|
|
2020-11-09 08:27:11 +00:00
|
|
|
dataSyncService: nil,
|
|
|
|
metaService: nil,
|
|
|
|
searchService: nil,
|
|
|
|
statsService: nil,
|
2020-09-15 07:53:10 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-05 02:52:50 +00:00
|
|
|
func (node *QueryNode) Start() {
|
2020-11-09 08:27:11 +00:00
|
|
|
node.dataSyncService = newDataSyncService(node.ctx, node, node.pulsarURL)
|
2020-11-13 09:20:13 +00:00
|
|
|
node.searchService = newSearchService(node.ctx, node, node.pulsarURL)
|
2020-11-09 08:27:11 +00:00
|
|
|
node.metaService = newMetaService(node.ctx, node.container)
|
|
|
|
node.statsService = newStatsService(node.ctx, node.container, node.pulsarURL)
|
2020-09-15 07:53:10 +00:00
|
|
|
|
2020-11-09 08:27:11 +00:00
|
|
|
go node.dataSyncService.start()
|
2020-11-05 02:52:50 +00:00
|
|
|
go node.searchService.start()
|
|
|
|
go node.metaService.start()
|
2020-11-09 08:27:11 +00:00
|
|
|
node.statsService.start()
|
2020-11-05 02:52:50 +00:00
|
|
|
}
|
2020-09-15 07:53:10 +00:00
|
|
|
|
2020-11-05 02:52:50 +00:00
|
|
|
func (node *QueryNode) Close() {
|
|
|
|
// TODO: close services
|
2020-09-14 03:26:35 +00:00
|
|
|
}
|