search

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2020 License: BSD-3-Clause Imports: 24 Imported by: 0

Documentation

Overview

Package search provides an implementation for launching zq searches and performing analytics on zng files stored in the server's root directory.

Index

Constants

View Source
const (
	MimeTypeCSV    = "text/csv"
	MimeTypeJSON   = "application/json"
	MimeTypeNDJSON = "application/x-ndjson"
	MimeTypeZJSON  = "application/x-zjson"
	MimeTypeZNG    = "application/x-zng"
)
View Source
const DefaultMTU = 100

This mtu is pretty small but it keeps the JSON object size below 64kb or so so the recevier can do reasonable, interactive streaming updates.

View Source
const MaxJSONRecords = 25000
View Source
const StatsInterval = time.Millisecond * 500

Variables

This section is empty.

Functions

func SendFromReader added in v0.17.0

func SendFromReader(out Output, r zbuf.Reader) (err error)

Types

type CSVOutput added in v0.22.0

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

CSVOutput implements the Output inteface and writes csv encoded-output directly to the client as text/csv.

func NewCSVOutput added in v0.22.0

func NewCSVOutput(response http.ResponseWriter, ctrl bool) *CSVOutput

func (*CSVOutput) Collect added in v0.22.0

func (r *CSVOutput) Collect() interface{}

func (*CSVOutput) ContentType added in v0.22.0

func (r *CSVOutput) ContentType() string

func (*CSVOutput) End added in v0.22.0

func (r *CSVOutput) End(ctrl interface{}) error

func (*CSVOutput) SendBatch added in v0.22.0

func (r *CSVOutput) SendBatch(cid int, batch zbuf.Batch) error

func (*CSVOutput) SendControl added in v0.22.0

func (r *CSVOutput) SendControl(ctrl interface{}) error

type IndexSearchOp added in v0.15.0

type IndexSearchOp struct {
	zbuf.ReadCloser
}

func NewIndexSearchOp added in v0.15.0

func NewIndexSearchOp(ctx context.Context, s IndexSearcher, req api.IndexSearchRequest) (*IndexSearchOp, error)

func (*IndexSearchOp) Run added in v0.15.0

func (s *IndexSearchOp) Run(out Output) (err error)

type IndexSearcher added in v0.15.0

type IndexSearcher interface {
	IndexSearch(context.Context, *resolver.Context, archive.IndexQuery) (zbuf.ReadCloser, error)
}

type JSON

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

JSON implements the Output interface.

func NewJSONOutput added in v0.3.0

func NewJSONOutput(resp http.ResponseWriter, mtu int, ctrl bool) *JSON

func (*JSON) ContentType added in v0.15.0

func (s *JSON) ContentType() string

func (*JSON) End

func (j *JSON) End(msg interface{}) error

func (*JSON) SendBatch

func (j *JSON) SendBatch(cid int, set zbuf.Batch) error

func (*JSON) SendControl

func (v *JSON) SendControl(msg interface{}) error

type NDJSONOutput added in v0.22.0

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

NDJSONOutput implements the Output inteface and writes NDJSON encoded-output directly to the client as application/x-ndjson..

func NewNDJSONOutput added in v0.22.0

func NewNDJSONOutput(response http.ResponseWriter) *NDJSONOutput

func (*NDJSONOutput) Collect added in v0.22.0

func (*NDJSONOutput) Collect() interface{}

func (*NDJSONOutput) ContentType added in v0.22.0

func (r *NDJSONOutput) ContentType() string

func (*NDJSONOutput) End added in v0.22.0

func (n *NDJSONOutput) End(ctrl interface{}) error

func (*NDJSONOutput) SendBatch added in v0.22.0

func (n *NDJSONOutput) SendBatch(cid int, batch zbuf.Batch) error

func (*NDJSONOutput) SendControl added in v0.22.0

func (r *NDJSONOutput) SendControl(ctrl interface{}) error

type Output

type Output interface {
	SendBatch(int, zbuf.Batch) error
	SendControl(interface{}) error
	End(interface{}) error
	ContentType() string
}

type Query

type Query struct {
	Space api.SpaceID
	Dir   int
	Span  nano.Span
	Proc  ast.Proc
}

A Query is the internal representation of search query describing a source of tuples, a "search" applied to the tuples producing a set of matched tuples, and a proc to the process the tuples

func UnpackQuery

func UnpackQuery(req api.SearchRequest) (*Query, error)

UnpackQuery transforms a api.SearchRequest into a Query.

type SearchOp added in v0.15.0

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

func NewSearchOp added in v0.15.0

func NewSearchOp(req api.SearchRequest) (*SearchOp, error)

func (*SearchOp) Run added in v0.15.0

func (s *SearchOp) Run(ctx context.Context, store storage.Storage, output Output) (err error)

type ZJSON added in v0.22.0

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

ZJSON implements the Output interface.

func NewZJSONOutput added in v0.22.0

func NewZJSONOutput(resp http.ResponseWriter, mtu int, ctrl bool) *ZJSON

func (*ZJSON) ContentType added in v0.22.0

func (s *ZJSON) ContentType() string

func (*ZJSON) End added in v0.22.0

func (s *ZJSON) End(msg interface{}) error

func (*ZJSON) SendBatch added in v0.22.0

func (s *ZJSON) SendBatch(cid int, set zbuf.Batch) error

func (*ZJSON) SendControl added in v0.22.0

func (s *ZJSON) SendControl(msg interface{}) error

type ZngOutput added in v0.12.0

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

ZngOutput writes zng encodings directly to the client via binary data sent over http chunked encoding interleaved with json protocol messages sent as zng comment payloads. The simplicity of this is a thing of beauty. Also, it implements the Output interface.

func NewZngOutput added in v0.12.0

func NewZngOutput(response http.ResponseWriter, ctrl bool) *ZngOutput

func (*ZngOutput) Collect added in v0.12.0

func (r *ZngOutput) Collect() interface{}

func (*ZngOutput) ContentType added in v0.15.0

func (r *ZngOutput) ContentType() string

func (*ZngOutput) End added in v0.12.0

func (r *ZngOutput) End(ctrl interface{}) error

func (*ZngOutput) SendBatch added in v0.12.0

func (r *ZngOutput) SendBatch(cid int, batch zbuf.Batch) error

func (*ZngOutput) SendControl added in v0.12.0

func (r *ZngOutput) SendControl(ctrl interface{}) error

Jump to

Keyboard shortcuts

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