context

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IntermediateMetricContext added in v0.2.4

type IntermediateMetricContext struct {
	MetricContext
	// contains filtered or unexported fields
}

IntermediateMetricContext represents intermediate metric data search context.

func NewIntermediateMetricContext added in v0.2.4

func NewIntermediateMetricContext(ctx context.Context,
	transportMgr rpc.TransportManager, stateMgr broker.StateManager,
	req *protoCommonV1.TaskRequest, curNode models.StatelessNode,
	physicalPlan *models.PhysicalPlan, statement *stmt.Query, receivers []string,
) *IntermediateMetricContext

NewIntermediateMetricContext creates intermediate metric data search context.

func (*IntermediateMetricContext) Complete added in v0.2.4

func (ctx *IntermediateMetricContext) Complete(err error)

Complete completes the task with error(if execute failure).

func (*IntermediateMetricContext) Context added in v0.2.4

func (ctx *IntermediateMetricContext) Context() context.Context

Context returns the context.

func (*IntermediateMetricContext) GetRequests added in v0.2.4

func (ctx *IntermediateMetricContext) GetRequests() map[string]*protoCommonV1.TaskRequest

GetRequests returns the request list which send to target node.

func (*IntermediateMetricContext) MakePlan added in v0.2.4

func (ctx *IntermediateMetricContext) MakePlan() error

MakePlan makes the metric data physical plan.

func (*IntermediateMetricContext) SendRequest added in v0.2.4

func (ctx *IntermediateMetricContext) SendRequest(targetNodeID string, req *protoCommonV1.TaskRequest) error

SendRequest sends the task request to target node.

func (*IntermediateMetricContext) SetTracker added in v0.2.4

func (ctx *IntermediateMetricContext) SetTracker(stageTracker *tracker.StageTracker)

SetTracker sets stage tracker.

func (*IntermediateMetricContext) WaitResponse added in v0.2.4

func (ctx *IntermediateMetricContext) WaitResponse() (any, error)

WaitResponse waits the task completed, then returns the result set.

type LeafExecuteContext

type LeafExecuteContext struct {
	TaskCtx           *flow.TaskContext
	Tracker           *trackerpkg.StageTracker
	LeafNode          *models.Target
	Receivers         []string
	StorageExecuteCtx *flow.StorageExecuteContext
	Database          tsdb.Database

	ServerFactory rpc.TaskServerFactory
	Req           *protoCommonV1.TaskRequest

	GroupingCtx *LeafGroupingContext
	ReduceCtx   *LeafReduceContext
	// contains filtered or unexported fields
}

LeafExecuteContext represents leaf node execution context.

func NewLeafExecuteContext

func NewLeafExecuteContext(taskCtx *flow.TaskContext,
	tracker *trackerpkg.StageTracker,
	queryStmt *stmt.Query,
	req *protoCommonV1.TaskRequest,
	serverFactory rpc.TaskServerFactory,
	leafNode *models.Target,
	receivers []string,
	database tsdb.Database,
) *LeafExecuteContext

NewLeafExecuteContext creates a LeafExecuteContext instance.

func (*LeafExecuteContext) SendResponse

func (ctx *LeafExecuteContext) SendResponse(err error)

SendResponse sends lead node execute response, if with err sends error msg, else sends result set.

type LeafGroupingContext

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

LeafGroupingContext represents collect grouping tags context under lead node.

func NewLeafGroupingContext

func NewLeafGroupingContext(leafExecuteCtx *LeafExecuteContext) *LeafGroupingContext

NewLeafGroupingContext creates a LeafGroupingContext instance.

func (*LeafGroupingContext) CompleteGroupingTask

func (ctx *LeafGroupingContext) CompleteGroupingTask()

CompleteGroupingTask completes a grouping task, if all grouping tasks are completed, do collect grouping tag values.

func (*LeafGroupingContext) ForkGroupingTask

func (ctx *LeafGroupingContext) ForkGroupingTask()

ForkGroupingTask forks a grouping task.

type LeafMetadataContext

type LeafMetadataContext struct {
	Request  *stmt.MetricMetadata
	Database tsdb.Database
	ShardIDs []models.ShardID

	StorageExecuteCtx *flow.StorageExecuteContext

	ResultSet []string
	TagKeyID  tag.KeyID // for tag values suggest

	Limit int
}

LeafMetadataContext represents leaf node execution metadata query context.

func NewLeafMetadataContext

func NewLeafMetadataContext(request *stmt.MetricMetadata, database tsdb.Database, shardIDs []models.ShardID) *LeafMetadataContext

NewLeafMetadataContext creates a LeafMetadataContext instance.

func (*LeafMetadataContext) AddValue

func (ctx *LeafMetadataContext) AddValue(val string)

AddValue adds value into result set.

type LeafReduceContext

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

LeafReduceContext represents reduce the result after down sampling aggregate.

func NewLeafReduceContext

func NewLeafReduceContext(storageExecuteCtx *flow.StorageExecuteContext, leafGroupingCtx *LeafGroupingContext) *LeafReduceContext

NewLeafReduceContext creates a LeafReduceContext instance.

func (*LeafReduceContext) BuildResultSet

func (ctx *LeafReduceContext) BuildResultSet(leafNode *models.Target, receivers []string) [][]byte

BuildResultSet returns the result set from reduce aggregator based on receivers.

func (*LeafReduceContext) Reduce

func (ctx *LeafReduceContext) Reduce(it series.GroupedIterator)

Reduce reduces the down sampling aggregator's result.

type MetadataContext added in v0.2.4

type MetadataContext struct {
	Deps *MetadataDeps
	// contains filtered or unexported fields
}

MetadataContext represents metric metadata search context.

func NewMetadataContext added in v0.2.4

func NewMetadataContext(deps *MetadataDeps) *MetadataContext

NewMetadataContext creates metric metadata search context.

func (*MetadataContext) Complete added in v0.2.4

func (ctx *MetadataContext) Complete(err error)

Complete completes the task with error(if execute failure).

func (*MetadataContext) Context added in v0.2.4

func (ctx *MetadataContext) Context() context.Context

Context returns the context.

func (*MetadataContext) GetRequests added in v0.2.4

func (ctx *MetadataContext) GetRequests() map[string]*protoCommonV1.TaskRequest

GetRequests returns the request list which send to target node.

func (*MetadataContext) HandleResponse added in v0.2.4

func (ctx *MetadataContext) HandleResponse(resp *protoCommonV1.TaskResponse, fromNode string)

HandleResponse handles metric metadata task response.

func (*MetadataContext) MakePlan added in v0.2.4

func (ctx *MetadataContext) MakePlan() error

MakePlan makes the metric metadata physical plan.

func (*MetadataContext) SendRequest added in v0.2.4

func (ctx *MetadataContext) SendRequest(targetNodeID string, req *protoCommonV1.TaskRequest) error

SendRequest sends the task request to target node.

func (*MetadataContext) SetTracker added in v0.2.4

func (ctx *MetadataContext) SetTracker(stageTracker *tracker.StageTracker)

SetTracker sets stage tracker.

func (*MetadataContext) WaitResponse added in v0.2.4

func (ctx *MetadataContext) WaitResponse() (any, error)

WaitResponse waits metric metadata search task completed and returns metric data.

type MetadataDeps added in v0.2.4

type MetadataDeps struct {
	Ctx     context.Context
	Request *models.Request

	Database     string
	Statement    *stmt.MetricMetadata
	CurrentNode  models.StatelessNode
	Choose       flow.NodeChoose
	TransportMgr rpc.TransportManager
}

MetadataDeps represents metric metadata search dependency.

type MetricContext added in v0.2.4

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

MetricContext represents metric data search context.

func (*MetricContext) Complete added in v0.2.4

func (ctx *MetricContext) Complete(err error)

Complete completes the task with error(if execute failure).

func (*MetricContext) Context added in v0.2.4

func (ctx *MetricContext) Context() context.Context

Context returns the context.

func (*MetricContext) GetRequests added in v0.2.4

func (ctx *MetricContext) GetRequests() map[string]*protoCommonV1.TaskRequest

GetRequests returns the request list which send to target node.

func (*MetricContext) HandleResponse added in v0.2.4

func (ctx *MetricContext) HandleResponse(resp *protoCommonV1.TaskResponse, fromNode string)

HandleResponse handles metric data search task response.

func (*MetricContext) SendRequest added in v0.2.4

func (ctx *MetricContext) SendRequest(targetNodeID string, req *protoCommonV1.TaskRequest) error

SendRequest sends the task request to target node.

func (*MetricContext) SetTracker added in v0.2.4

func (ctx *MetricContext) SetTracker(stageTracker *tracker.StageTracker)

SetTracker sets stage tracker.

type RootMetricContext added in v0.2.4

type RootMetricContext struct {
	MetricContext

	Deps *RootMetricContextDeps
}

RootMetricContext represents root metric data search context.

func NewRootMetricContext added in v0.2.4

func NewRootMetricContext(deps *RootMetricContextDeps) *RootMetricContext

NewRootMetricContext creates the root metric data search context.

func (*RootMetricContext) Complete added in v0.2.4

func (ctx *RootMetricContext) Complete(err error)

Complete completes the task with error(if execute failure).

func (*RootMetricContext) Context added in v0.2.4

func (ctx *RootMetricContext) Context() context.Context

Context returns the context.

func (*RootMetricContext) GetRequests added in v0.2.4

func (ctx *RootMetricContext) GetRequests() map[string]*protoCommonV1.TaskRequest

GetRequests returns the request list which send to target node.

func (*RootMetricContext) MakePlan added in v0.2.4

func (ctx *RootMetricContext) MakePlan() error

MakePlan makes the metric data physical plan.

func (*RootMetricContext) SendRequest added in v0.2.4

func (ctx *RootMetricContext) SendRequest(targetNodeID string, req *protoCommonV1.TaskRequest) error

SendRequest sends the task request to target node.

func (*RootMetricContext) SetTracker added in v0.2.4

func (ctx *RootMetricContext) SetTracker(stageTracker *tracker.StageTracker)

SetTracker sets stage tracker.

func (*RootMetricContext) WaitResponse added in v0.2.4

func (ctx *RootMetricContext) WaitResponse() (any, error)

WaitResponse waits metric data search task completed, then returns the result set,

type RootMetricContextDeps added in v0.2.4

type RootMetricContextDeps struct {
	Ctx          context.Context
	Request      *models.Request
	Database     string
	CurrentNode  models.StatelessNode
	Statement    *stmt.Query
	Choose       flow.NodeChoose
	TransportMgr rpc.TransportManager
}

RootMetricContextDeps represents root metric data search dependency.

type TaskContext added in v0.2.4

type TaskContext interface {
	// Context returns the context.
	Context() context.Context
	// MakePlan executes search logic in compute level.
	// 1) get metadata based on params
	// 2) build execute plan
	MakePlan() error
	// HandleResponse handles task response.
	HandleResponse(resp *protoCommonV1.TaskResponse, fromNode string)
	// SendRequest sends the task request to target node.
	SendRequest(targetNodeID string, req *protoCommonV1.TaskRequest) error
	// GetRequests returns the request list which send to target node.
	GetRequests() map[string]*protoCommonV1.TaskRequest
	// Complete completes the task with error(if execute failure).
	Complete(err error)
	// WaitResponse waits task complete and returns the response.
	WaitResponse() (any, error)
	// SetTracker sets stage tracker.
	SetTracker(stageTracker *tracker.StageTracker)
}

TaskContext represents the task context for distribution query and computing.

Jump to

Keyboard shortcuts

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