milvus/internal/writenode/write_node.go
FluorineDog eb8717188e Enable load index
Signed-off-by: FluorineDog <guilin.gou@zilliz.com>
2020-12-28 17:55:48 +08:00

53 lines
1019 B
Go

package writenode
import (
"context"
)
type WriteNode struct {
ctx context.Context
WriteNodeID uint64
dataSyncService *dataSyncService
flushSyncService *flushSyncService
}
func NewWriteNode(ctx context.Context, writeNodeID uint64) *WriteNode {
node := &WriteNode{
ctx: ctx,
WriteNodeID: writeNodeID,
dataSyncService: nil,
flushSyncService: nil,
}
return node
}
func Init() {
Params.Init()
}
func (node *WriteNode) Start() error {
// TODO GOOSE Init Size??
chanSize := 100
ddChan := make(chan *ddlFlushSyncMsg, chanSize)
insertChan := make(chan *insertFlushSyncMsg, chanSize)
node.flushSyncService = newFlushSyncService(node.ctx, ddChan, insertChan)
node.dataSyncService = newDataSyncService(node.ctx, ddChan, insertChan)
go node.dataSyncService.start()
go node.flushSyncService.start()
return nil
}
func (node *WriteNode) Close() {
<-node.ctx.Done()
// close services
if node.dataSyncService != nil {
(*node.dataSyncService).close()
}
}