api

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2019 License: Apache-2.0 Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Select

func Select(ctx context.Context, cli Client, qr *QueryRequest, streamMode bool,
	handler func(res *QueryResult)) error

Types

type Admin

type Admin interface {
	// Execute runs the lql query on server and provides the execution result or an error, if the query could not be
	// run
	Execute(ctx context.Context, req ExecRequest) (ExecResult, error)
}

Admin interface allows to perform some administrative actions

type Client

type Client interface {
	Querier
	Ingestor
	Admin
	Pipes

	Close() error
}

type ExecRequest

type ExecRequest struct {
	// Query contains a LQL statement to be executed
	Query string
}

ExecRequest struct must be provided as an input for Admin.Execute request

type ExecResult

type ExecResult struct {
	// Output contains formatted output result of the command execution
	Output string

	// Err contains the operation error, if any
	Err error `json:"-"`
}

ExecResult struct returns in response of the request to execute a LQL query

type Ingestor

type Ingestor interface {
	// Write sends log events into the pipe identified by tag provided. It expects a slice of events and
	// the reference to the WriteResult. Tags and Fields fields in LogEvents are ignored during the writing operation,
	// but tags and fields params will be applied to all of the events.
	Write(ctx context.Context, tags, fields string, evs []*LogEvent, res *WriteResult) error
}

Ingestor provides Wrtie method for sending log data into the storage. This intrface is exposed as a public API

type LogEvent

type LogEvent struct {
	// Timestamp contains the time-stamp for the message.
	Timestamp uint64
	// Message is the message itself
	Message string
	// Tag line for the message. It could be empty
	// The tag line has the form like `tag1=value1,tag2=value2...`
	Tags string
	// Fields line for the message. It could be empty
	// The fields line has the form like `field1=value1,field2=value2...`
	Fields string
}

LogEvent struct describes one message

type Pipe

type Pipe struct {
	// Name contains the pipe name, which must be unique
	Name string
	// TagsCond contains the condition, which filters sources for the pipe
	TagsCond string
	// FilterCond desribes the filtering condition (the events that must be in the pipe)
	FilterCond string
	// Destination contains tags conditions used for the pipe destination. This field is
	// defined by server, so it is ignored by Create
	Destination string
}

Pipe struct describes a pipe

type PipeCreateResult

type PipeCreateResult struct {
	// Pipe contains created pipe object
	Pipe Pipe

	// Err the operaion error, if any
	Err error `json:"-"`
}

PipeCreateResult struct describes the result of Pipes.Create() function

type Pipes

type Pipes interface {
	// Create creates a new pipe
	EnsurePipe(ctx context.Context, p Pipe, res *PipeCreateResult) error
}

Pipes allows to manage streams

type Querier

type Querier interface {
	// Query runs lql to collect the server data and return it in the QueryResult. It returns an error which indicates
	// that the query could not be delivered to the server, or it did not happen.
	Query(ctx context.Context, req *QueryRequest, res *QueryResult) error
}

Querier - executes a query agains logrange database

type QueryRequest

type QueryRequest struct {
	// ReqId identifies the request on server side. The field should not be populated by client,
	// but it can be returned with the structure in QueryResult.
	ReqId uint64

	// the LQL line for selecting records
	Query string

	// Pos contains the next read record position.
	Pos string

	// WaitTimeout in seconds provide waiting new data timeout in case of the request starts from
	// the EOF. The timout cannot exceed 60 seconds. When the tiemout expires and no data is arrived
	// response with no data will be returned.
	WaitTimeout int

	// Offset contains the offset from the current position (either positive or negative)
	Offset int

	// Limit defines the maximum number of records which could be read from the sources
	Limit int
}

QueryRequest struct describes a request for reading records

func (*QueryRequest) String

func (qr *QueryRequest) String() string

type QueryResult

type QueryResult struct {
	// Events slice contains the result of the query execution
	Events []*LogEvent
	// NextQueryRequest contains the query for reading next porition of events. It makes sense only if Err is
	// nil
	NextQueryRequest QueryRequest
	// Err the operation error. If the Err is nil, the operation successfully executed
	Err error `json:"-"`
}

QeryResult is a result returned by the server in a response on LQL execution (see Querier.Query)

func (*QueryResult) String

func (qres *QueryResult) String() string

type WriteResult

type WriteResult struct {
	Err error
}

WriteResult struct contains result of Ingestor.Write operation execution.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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