Documentation
¶
Index ¶
- Constants
- Variables
- func BundleWorkerScript(deployPath string) (string, error)
- func ResetUnenvCache()
- func ValidateCron(expr string) error
- type AssetsFetcher
- type CacheEntry
- type CacheStore
- type CryptoKeyEntry
- type D1ExecResult
- type D1Meta
- type D1Store
- type DurableObjectStore
- type Engine
- func (e *Engine) CompileAndCache(siteID, deployKey, source string) ([]byte, error)
- func (e *Engine) EnsureSource(siteID, deployKey string) error
- func (e *Engine) Execute(siteID, deployKey string, env *Env, req *WorkerRequest) *WorkerResult
- func (e *Engine) ExecuteFunction(siteID, deployKey string, env *Env, fnName string, args ...any) *WorkerResult
- func (e *Engine) ExecuteScheduled(siteID, deployKey string, env *Env, cron string) *WorkerResult
- func (e *Engine) ExecuteTail(siteID, deployKey string, env *Env, events []TailEvent) *WorkerResult
- func (e *Engine) InvalidatePool(siteID, deployKey string)
- func (e *Engine) MaxResponseBytes() int
- func (e *Engine) SetDispatcher(d WorkerDispatcher)
- func (e *Engine) Shutdown()
- type EngineConfig
- type Env
- type EnvBindingFunc
- type JSRuntime
- type KVListResult
- type KVPair
- type KVStore
- type KVValueWithMetadata
- type LogEntry
- type QueueMessageInput
- type QueueSender
- type R2ListOptions
- type R2ListResult
- type R2Object
- type R2PutOptions
- type R2Store
- type ServiceBindingConfig
- type SourceLoader
- type TailEvent
- type WebSocketBridger
- type WorkerDispatcher
- type WorkerRequest
- type WorkerResponse
- type WorkerResult
Constants ¶
const MaxKVValueSize = core.MaxKVValueSize
Constants re-exported from core.
Variables ¶
var DataDir = "./data"
DataDir is the base directory for cached polyfills. Defaults to "./data".
var DecodeCursor = core.DecodeCursor
Functions re-exported from core.
var EncodeCursor = core.EncodeCursor
Functions ¶
func BundleWorkerScript ¶
BundleWorkerScript uses esbuild to bundle a worker's _worker.js entry point with all its imports into a single self-contained script. This enables ES module import/export support for worker scripts.
If the source doesn't contain any import statements, it's returned as-is to avoid unnecessary processing.
func ResetUnenvCache ¶
func ResetUnenvCache()
ResetUnenvCache clears the cached unenv path (used in tests).
func ValidateCron ¶
ValidateCron checks if a cron expression is a valid 5-field format. Fields: minute(0-59) hour(0-23) day(1-31) month(1-12) weekday(0-6).
Types ¶
type AssetsFetcher ¶
type AssetsFetcher = core.AssetsFetcher
type CacheEntry ¶
type CacheEntry = core.CacheEntry
type CacheStore ¶
type CacheStore = core.CacheStore
type CryptoKeyEntry ¶
type CryptoKeyEntry = core.CryptoKeyEntry
type D1ExecResult ¶
type D1ExecResult = core.D1ExecResult
type DurableObjectStore ¶
type DurableObjectStore = core.DurableObjectStore
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine wraps a backend JS engine (QuickJS by default, V8 with -tags v8).
func NewEngine ¶
func NewEngine(cfg EngineConfig, loader SourceLoader) *Engine
NewEngine creates a new Engine with the given config and source loader.
func (*Engine) CompileAndCache ¶
CompileAndCache compiles the source and caches the bytecode.
func (*Engine) EnsureSource ¶
EnsureSource ensures the source for the given site/deploy is loaded.
func (*Engine) Execute ¶
func (e *Engine) Execute(siteID, deployKey string, env *Env, req *WorkerRequest) *WorkerResult
Execute runs the worker's fetch handler for the given request.
func (*Engine) ExecuteFunction ¶
func (e *Engine) ExecuteFunction(siteID, deployKey string, env *Env, fnName string, args ...any) *WorkerResult
ExecuteFunction calls a named exported function on the worker module.
func (*Engine) ExecuteScheduled ¶
func (e *Engine) ExecuteScheduled(siteID, deployKey string, env *Env, cron string) *WorkerResult
ExecuteScheduled runs the worker's scheduled handler.
func (*Engine) ExecuteTail ¶
func (e *Engine) ExecuteTail(siteID, deployKey string, env *Env, events []TailEvent) *WorkerResult
ExecuteTail runs the worker's tail handler.
func (*Engine) InvalidatePool ¶
InvalidatePool marks the pool for the given site as invalid.
func (*Engine) MaxResponseBytes ¶
MaxResponseBytes returns the configured max response body size.
func (*Engine) SetDispatcher ¶
func (e *Engine) SetDispatcher(d WorkerDispatcher)
SetDispatcher sets the worker dispatcher for service bindings.
type EngineConfig ¶
type EngineConfig = core.EngineConfig
type EnvBindingFunc ¶
type EnvBindingFunc = core.EnvBindingFunc
type KVListResult ¶
type KVListResult = core.KVListResult
type KVValueWithMetadata ¶
type KVValueWithMetadata = core.KVValueWithMetadata
type QueueMessageInput ¶
type QueueMessageInput = core.QueueMessageInput
type QueueSender ¶
type QueueSender = core.QueueSender
type R2ListOptions ¶
type R2ListOptions = core.R2ListOptions
type R2ListResult ¶
type R2ListResult = core.R2ListResult
type R2PutOptions ¶
type R2PutOptions = core.R2PutOptions
type ServiceBindingConfig ¶
type ServiceBindingConfig = core.ServiceBindingConfig
type SourceLoader ¶
type SourceLoader = core.SourceLoader
type WebSocketBridger ¶
type WebSocketBridger = core.WebSocketBridger
type WorkerDispatcher ¶
type WorkerDispatcher = core.WorkerDispatcher
type WorkerRequest ¶
type WorkerRequest = core.WorkerRequest
type WorkerResponse ¶
type WorkerResponse = core.WorkerResponse
type WorkerResult ¶
type WorkerResult = core.WorkerResult