query

package
v0.0.0-...-6719cd2 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2019 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package query provides a high level entry point for executing AkutanQL queries. It runs the entire query processor, including the parser, planner, and executor.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

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

Engine provides a high level interface for running queries.

func New

func New(statsProvider StatsProvider, lookups lookups.All) *Engine

New creates a new Engine, the resulting Engine can be used concurrently to execute queries.

func (*Engine) Query

func (e *Engine) Query(ctx context.Context,
	index blog.Index, rawQuery string,
	opt Options, resCh chan<- ResultChunk) error

Query will execute a query starting from the string representation of the query all the way through the steps, Parse, Rewrite, Plan & Execute. The query is executed as of the supplied log index. Results will be written to the provided 'resCh' channel. The caller can apply backpressure to the query execution by reading slowly from this channel.

This function will block until the query has completed and all results have been passed to the 'resCh' channel, or an error occurs. In all cases resCh will be closed before this function returns.

type Options

type Options struct {
	// Format indicates which query text format to parse the query with. Can be
	// either parser.QuerySparql or parser.QueryFactPattern. Defaults to
	// parser.QuerySparql if not set.
	Format string
	// If set diagnostic information about the query processing will be collected into a report.
	Debug bool
	// By default the report is written to a file in $TMPDIR. If DebugOut is set, the report
	// will be written to that instead.
	DebugOut io.Writer
	// If set the Debug tracker will use this clock for generating timing information, if not
	// set it'll use clocks.Wall.
	Clock clocks.Source
}

Options contains various settings that affect the query processing.

type ResultChunk

type ResultChunk = exec.ResultChunk

ResultChunk contains a part of the results of a query.

type StatsProvider

type StatsProvider func(context.Context) (planner.Stats, error)

StatsProvider allows the engine to obtain the current statistics for use in planning. This is called for every query execution.

Directories

Path Synopsis
Package exec is used to execute a KG query that was built by the query planner.
Package exec is used to execute a KG query that was built by the query planner.
internal
debug
Package debug contains functions to help track details about query processing and report them.
Package debug contains functions to help track details about query processing and report them.
Package parser implements a parser combinator for the akutan query language.
Package parser implements a parser combinator for the akutan query language.
Package planner is the KG/Akutan-specific query optimizer.
Package planner is the KG/Akutan-specific query optimizer.
plandef
Package plandef defines the output of the query planner.
Package plandef defines the output of the query planner.
search
Package search implements a generic query optimizer algorithm.
Package search implements a generic query optimizer algorithm.

Jump to

Keyboard shortcuts

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