quickjs

package
v2.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

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 manages per-site worker pools and executes JS worker scripts using the QuickJS engine.

func NewEngine

func NewEngine(cfg core.EngineConfig, sourceLoader core.SourceLoader) *Engine

NewEngine creates an Engine with the given configuration and source loader.

func (*Engine) CompileAndCache

func (e *Engine) CompileAndCache(siteID string, deployKey string, source string) ([]byte, error)

CompileAndCache validates that a worker script compiles and stores the source.

func (*Engine) EnsureSource

func (e *Engine) EnsureSource(siteID string, deployKey string) error

EnsureSource loads the worker JS source into memory if not already cached.

func (*Engine) Execute

func (e *Engine) Execute(siteID string, deployKey string, env *core.Env, req *core.WorkerRequest) (result *core.WorkerResult)

Execute runs the worker's fetch handler for the given request.

func (*Engine) ExecuteFunction

func (e *Engine) ExecuteFunction(siteID string, deployKey string, env *core.Env, fnName string, args ...any) (result *core.WorkerResult)

ExecuteFunction calls an arbitrary named function on the worker module.

func (*Engine) ExecuteScheduled

func (e *Engine) ExecuteScheduled(siteID string, deployKey string, env *core.Env, cron string) (result *core.WorkerResult)

ExecuteScheduled runs the worker's scheduled handler.

func (*Engine) ExecuteTail

func (e *Engine) ExecuteTail(siteID string, deployKey string, env *core.Env, events []core.TailEvent) (result *core.WorkerResult)

ExecuteTail runs the worker's tail handler for log forwarding.

func (*Engine) InvalidatePool

func (e *Engine) InvalidatePool(siteID string, deployKey string)

InvalidatePool marks the pool for the given site/deploy as invalid.

func (*Engine) MaxResponseBytes

func (e *Engine) MaxResponseBytes() int

MaxResponseBytes returns the configured maximum response body size.

func (*Engine) SetDispatcher

func (e *Engine) SetDispatcher(d core.WorkerDispatcher)

SetDispatcher sets the worker dispatcher for service binding support.

func (*Engine) Shutdown

func (e *Engine) Shutdown()

Shutdown invalidates all pools and clears all cached sources.

Jump to

Keyboard shortcuts

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