distributed

package
v4.1.13 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2025 License: GPL-2.0 Imports: 15 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// DefaultSemTimeout is the default / fallback amount of time to wait for acquisition
	// of a semaphore when performing concurrent queries
	DefaultSemTimeout = time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorRunner

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

ErrorRunner is used to propagate an error all the way to the aggregation routine

func NewErrorRunner

func NewErrorRunner(err error) *ErrorRunner

NewErrorRunner creates a new error runner

func (*ErrorRunner) Run

Run doesn't execute anything but returns the error that was passed to the constructor

type Querier

type Querier interface {
	// Query runs the distributed query on the provided hosts and returns a channel from
	// which the results can be read. In addition, keepalives are sent via a second channel.
	// It is the responsibility of the implementing type to close the channels.
	// This may become a requirement through the interface definitions in future versions.
	Query(ctx context.Context, hosts hosts.Hosts, args *query.Args) (<-chan *results.Result, <-chan struct{})
}

Querier provides a general interface for all query executors

type QuerierAnyable

type QuerierAnyable interface {
	// AllHosts returns a list of all hosts / targets available to the Querier
	AllHosts() (hosts.Hosts, error)
}

QuerierAnyable extends a "common" Querier with the support to retrieve a list of all hosts / targets available to the Querier

type QueryOption

type QueryOption func(*QueryRunner)

QueryOption configures the query runner

func WithMaxConcurrent

func WithMaxConcurrent(sem chan struct{}) QueryOption

WithMaxConcurrent sets a maximum number of concurrent running queries

type QueryRunner

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

QueryRunner denotes a query runner / executor, wrapping a Querier interface instance with other fields required to perform a distributed query

func NewQueryRunner

func NewQueryRunner(resolver hosts.Resolver, querier Querier, opts ...QueryOption) (qr *QueryRunner)

NewQueryRunner instantiates a new distributed query runner

func (*QueryRunner) Run

func (q *QueryRunner) Run(ctx context.Context, args *query.Args) (*results.Result, error)

Run executes / runs the query and creates the final result structure

func (*QueryRunner) RunStreaming

func (q *QueryRunner) RunStreaming(ctx context.Context, args *query.Args, send sse.Sender) (*results.Result, error)

Jump to

Keyboard shortcuts

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