engine

package
v0.1.0-rc.4 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrQueryPlan is returned when the engine cannot build an execution plan
	// for a query.
	ErrQueryPlan = errors.New("engine: query plan failed")
	// ErrCacheInit is returned when the query plan cache cannot be allocated at
	// startup; the engine has no usable cache and must not be considered started.
	ErrCacheInit = errors.New("engine: cache initialisation failed")
)

Functions

This section is empty.

Types

type Engine

type Engine[K ~uint64, P float32 | float64] struct {
	Config        *config.ConfigSet
	Cache         cache.Cache[K, query.Query[K, P]]
	Scheduler     *scheduler.Scheduler[K, P]
	Optimisations *optimisation.Pipeline[K, P]
	Hasher        hash.Hasher[K, string]
}

func NewEngine

func NewEngine[K ~uint64, P float32 | float64](c *config.ConfigSet, hasher hash.Hasher[K, string]) *Engine[K, P]

func (*Engine[K, P]) Apply

func (e *Engine[K, P]) Apply(ctx context.Context, s *query.Stream[K, P]) error

Apply hands a planned stream to the scheduler for execution. It returns the scheduler's error (e.g. ErrShutdown, ErrQueueFull, or a wrapped context cancellation) so a caller knows the stream was never enqueued and must not wait on its completion.

func (*Engine[K, P]) Plan

func (e *Engine[K, P]) Plan(q query.Query[K, P]) (*query.Stream[K, P], error)

func (*Engine[K, P]) Start

func (e *Engine[K, P]) Start() error

Start allocates the plan cache and starts the scheduler workers. It returns an error if either fails, so a caller never brings up a live server backed by a nil cache: the cache is assigned only once it is known good.

func (*Engine[K, P]) Stop

func (e *Engine[K, P]) Stop()

Jump to

Keyboard shortcuts

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