indexnode

package
v0.0.0-...-34e0b2d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2024 License: Apache-2.0 Imports: 54 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Params is a GlobalParamTable singleton of indexnode

View Source
var TaskStateNames = map[TaskState]string{
	0: "Normal",
	1: "Abandon",
	2: "Retry",
	3: "Failed",
}

Functions

func NewChunkMgrFactory

func NewChunkMgrFactory() *chunkMgrFactory

func NewMockChunkManager

func NewMockChunkManager() *mockChunkmgr

func NewMockIndexNodeComponent

func NewMockIndexNodeComponent(ctx context.Context) (types.IndexNodeComponent, error)

Types

type Blob

type Blob = storage.Blob

type IndexNode

type IndexNode struct {
	// contains filtered or unexported fields
}

IndexNode is a component that executes the task of building indexes.

func NewIndexNode

func NewIndexNode(ctx context.Context, factory dependency.Factory) *IndexNode

NewIndexNode creates a new IndexNode component.

func (*IndexNode) CloseSegcore

func (i *IndexNode) CloseSegcore()

func (*IndexNode) CreateJob

func (i *IndexNode) CreateJob(ctx context.Context, req *indexpb.CreateJobRequest) (*commonpb.Status, error)

func (*IndexNode) CreateJobV2

func (i *IndexNode) CreateJobV2(ctx context.Context, req *indexpb.CreateJobV2Request) (*commonpb.Status, error)

func (*IndexNode) DropJobs

func (i *IndexNode) DropJobs(ctx context.Context, req *indexpb.DropJobsRequest) (*commonpb.Status, error)

func (*IndexNode) DropJobsV2

func (i *IndexNode) DropJobsV2(ctx context.Context, req *indexpb.DropJobsV2Request) (*commonpb.Status, error)

func (*IndexNode) GetAddress

func (i *IndexNode) GetAddress() string

func (*IndexNode) GetComponentStates

GetComponentStates gets the component states of IndexNode.

func (*IndexNode) GetJobStats

GetJobStats should be GetSlots

func (*IndexNode) GetMetrics

GetMetrics gets the metrics info of IndexNode. TODO(dragondriver): cache the Metrics and set a retention to the cache

func (*IndexNode) GetNodeID

func (i *IndexNode) GetNodeID() int64

func (*IndexNode) GetStatisticsChannel

GetStatisticsChannel gets the statistics channel of IndexNode.

func (*IndexNode) GetTimeTickChannel

GetTimeTickChannel gets the time tick channel of IndexNode.

func (*IndexNode) Init

func (i *IndexNode) Init() error

Init initializes the IndexNode component.

func (*IndexNode) QueryJobs

func (*IndexNode) QueryJobsV2

func (*IndexNode) Register

func (i *IndexNode) Register() error

Register register index node at etcd.

func (*IndexNode) SetAddress

func (i *IndexNode) SetAddress(address string)

func (*IndexNode) SetEtcdClient

func (i *IndexNode) SetEtcdClient(client *clientv3.Client)

SetEtcdClient assigns parameter client to its member etcdCli

func (*IndexNode) ShowConfigurations

ShowConfigurations returns the configurations of indexNode matching req.Pattern

func (*IndexNode) Start

func (i *IndexNode) Start() error

Start starts the IndexNode component.

func (*IndexNode) Stop

func (i *IndexNode) Stop() error

Stop closes the server.

func (*IndexNode) UpdateStateCode

func (i *IndexNode) UpdateStateCode(code commonpb.StateCode)

UpdateStateCode updates the component state of IndexNode.

type IndexTaskQueue

type IndexTaskQueue struct {
	// contains filtered or unexported fields
}

BaseTaskQueue is a basic instance of TaskQueue.

func NewIndexBuildTaskQueue

func NewIndexBuildTaskQueue(sched *TaskScheduler) *IndexTaskQueue

NewIndexBuildTaskQueue creates a new IndexBuildTaskQueue.

func (*IndexTaskQueue) AddActiveTask

func (queue *IndexTaskQueue) AddActiveTask(t task)

AddActiveTask adds a task to activeTasks.

func (*IndexTaskQueue) Enqueue

func (queue *IndexTaskQueue) Enqueue(t task) error

Enqueue adds a task to TaskQueue.

func (*IndexTaskQueue) GetTaskNum

func (queue *IndexTaskQueue) GetTaskNum() (int, int)

func (*IndexTaskQueue) PopActiveTask

func (queue *IndexTaskQueue) PopActiveTask(tName string) task

PopActiveTask pops a task from activateTask and the task will be executed.

func (*IndexTaskQueue) PopUnissuedTask

func (queue *IndexTaskQueue) PopUnissuedTask() task

PopUnissuedTask pops a task from tasks queue.

type Mock

type Mock struct {
	types.IndexNode

	CallInit                 func() error
	CallStart                func() error
	CallStop                 func() error
	CallGetComponentStates   func(ctx context.Context) (*milvuspb.ComponentStates, error)
	CallGetStatisticsChannel func(ctx context.Context) (*milvuspb.StringResponse, error)
	CallRegister             func() error

	CallSetAddress      func(address string)
	CallSetEtcdClient   func(etcdClient *clientv3.Client)
	CallUpdateStateCode func(stateCode commonpb.StateCode)

	CallCreateJob   func(ctx context.Context, req *indexpb.CreateJobRequest) (*commonpb.Status, error)
	CallQueryJobs   func(ctx context.Context, in *indexpb.QueryJobsRequest) (*indexpb.QueryJobsResponse, error)
	CallDropJobs    func(ctx context.Context, in *indexpb.DropJobsRequest) (*commonpb.Status, error)
	CallGetJobStats func(ctx context.Context, in *indexpb.GetJobStatsRequest) (*indexpb.GetJobStatsResponse, error)
	CallCreateJobV2 func(ctx context.Context, req *indexpb.CreateJobV2Request) (*commonpb.Status, error)
	CallQueryJobV2  func(ctx context.Context, req *indexpb.QueryJobsV2Request) (*indexpb.QueryJobsV2Response, error)
	CallDropJobV2   func(ctx context.Context, req *indexpb.DropJobsV2Request) (*commonpb.Status, error)

	CallGetMetrics         func(ctx context.Context, req *milvuspb.GetMetricsRequest) (*milvuspb.GetMetricsResponse, error)
	CallShowConfigurations func(ctx context.Context, req *internalpb.ShowConfigurationsRequest) (*internalpb.ShowConfigurationsResponse, error)
}

Mock is an alternative to IndexNode, it will return specific results based on specific parameters.

func NewIndexNodeMock

func NewIndexNodeMock() *Mock

func (*Mock) CreateJob

func (m *Mock) CreateJob(ctx context.Context, req *indexpb.CreateJobRequest) (*commonpb.Status, error)

func (*Mock) CreateJobV2

func (m *Mock) CreateJobV2(ctx context.Context, req *indexpb.CreateJobV2Request) (*commonpb.Status, error)

func (*Mock) DropJobs

func (m *Mock) DropJobs(ctx context.Context, req *indexpb.DropJobsRequest) (*commonpb.Status, error)

func (*Mock) DropJobsV2

func (m *Mock) DropJobsV2(ctx context.Context, req *indexpb.DropJobsV2Request) (*commonpb.Status, error)

func (*Mock) GetAddress

func (m *Mock) GetAddress() string

func (*Mock) GetComponentStates

func (m *Mock) GetComponentStates(ctx context.Context, req *milvuspb.GetComponentStatesRequest) (*milvuspb.ComponentStates, error)

func (*Mock) GetJobStats

func (*Mock) GetMetrics

func (*Mock) GetStatisticsChannel

func (m *Mock) GetStatisticsChannel(ctx context.Context, req *internalpb.GetStatisticsChannelRequest) (*milvuspb.StringResponse, error)

func (*Mock) Init

func (m *Mock) Init() error

func (*Mock) QueryJobs

func (*Mock) QueryJobsV2

func (*Mock) Register

func (m *Mock) Register() error

func (*Mock) SetAddress

func (m *Mock) SetAddress(address string)

func (*Mock) SetEtcdClient

func (m *Mock) SetEtcdClient(etcdClient *clientv3.Client)

func (*Mock) ShowConfigurations

ShowConfigurations returns the configurations of Mock indexNode matching req.Pattern

func (*Mock) Start

func (m *Mock) Start() error

func (*Mock) Stop

func (m *Mock) Stop() error

func (*Mock) UpdateStateCode

func (m *Mock) UpdateStateCode(stateCode commonpb.StateCode)

type StorageFactory

type StorageFactory interface {
	NewChunkManager(ctx context.Context, config *indexpb.StorageConfig) (storage.ChunkManager, error)
}

type TaskQueue

type TaskQueue interface {
	PopUnissuedTask() task
	AddActiveTask(t task)
	PopActiveTask(tName string) task
	Enqueue(t task) error
	GetTaskNum() (int, int)
	// contains filtered or unexported methods
}

TaskQueue is a queue used to store tasks.

type TaskScheduler

type TaskScheduler struct {
	TaskQueue TaskQueue
	// contains filtered or unexported fields
}

TaskScheduler is a scheduler of indexing tasks.

func NewTaskScheduler

func NewTaskScheduler(ctx context.Context) *TaskScheduler

NewTaskScheduler creates a new task scheduler of indexing tasks.

func (*TaskScheduler) Close

func (sched *TaskScheduler) Close()

Close closes the task scheduler of indexing tasks.

func (*TaskScheduler) Start

func (sched *TaskScheduler) Start() error

Start stats the task scheduler of indexing tasks.

type TaskState

type TaskState int32
const (
	TaskStateNormal  TaskState = 0
	TaskStateAbandon TaskState = 1
	TaskStateRetry   TaskState = 2
	TaskStateFailed  TaskState = 3
)

func (TaskState) String

func (x TaskState) String() string

type UniqueID

type UniqueID = typeutil.UniqueID

TODO add comments UniqueID is an alias of int64, is used as a unique identifier for the request.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL