Directories
¶
| Path | Synopsis |
|---|---|
|
Example basics is the smallest end-to-end use of the luart library: register a script with a SourceLoader, create a Runtime, and Run a Lua function with an argument, reading back its return value.
|
Example basics is the smallest end-to-end use of the luart library: register a script with a SourceLoader, create a Runtime, and Run a Lua function with an argument, reading back its return value. |
|
Example config-loading shows building a luart.Config from external sources via the luartconfig subpackage: a base JSON string overlaid by environment variables, using the precedence resolver (env > base > defaults).
|
Example config-loading shows building a luart.Config from external sources via the luartconfig subpackage: a base JSON string overlaid by environment variables, using the precedence resolver (env > base > defaults). |
|
Example custom-libs adds a user-authored library to pooled States via Config.ExtraLibs — without restating the sandbox defaults.
|
Example custom-libs adds a user-authored library to pooled States via Config.ExtraLibs — without restating the sandbox defaults. |
|
Example custom-loaders shows how to implement the luart.SourceLoader interface for real backends — a file tree, a database, an in-memory store — plus two hybrid patterns (a caching wrapper and a prefix router).
|
Example custom-loaders shows how to implement the luart.SourceLoader interface for real backends — a file tree, a database, an in-memory store — plus two hybrid patterns (a caching wrapper and a prefix router). |
|
Example exec-timeout shows two ways a runaway script is stopped: a server-side hard cap via Config.ExecTimeout, and a caller deadline via the context passed to Run.
|
Example exec-timeout shows two ways a runaway script is stopped: a server-side hard cap via Config.ExecTimeout, and a caller deadline via the context passed to Run. |
|
Example graceful-shutdown shows the Close vs Shutdown split (mirroring net/http.Server): Close stops immediately, Shutdown drains in-flight calls first (up to the ctx deadline).
|
Example graceful-shutdown shows the Close vs Shutdown split (mirroring net/http.Server): Close stops immediately, Shutdown drains in-flight calls first (up to the ctx deadline). |
|
Example hot-reload shows notification-driven drop-and-reload: when a script's source changes, Notify drops that script's pool so the next Run picks up the new version — with no Runtime restart.
|
Example hot-reload shows notification-driven drop-and-reload: when a script's source changes, Notify drops that script's pool so the next Run picks up the new version — with no Runtime restart. |
|
Example logging shows routing luart's structured events into log/slog via Config.Logger + NewSlogLogger.
|
Example logging shows routing luart's structured events into log/slog via Config.Logger + NewSlogLogger. |
|
Example memory-budget shows capping total live VMs by a memory budget instead of a fixed count: with Config.MaxStates unset, the Runtime derives MaxStates from MemoryBudgetBytes ÷ measured per-state cost, then enforces it with LRU eviction + back-pressure under load.
|
Example memory-budget shows capping total live VMs by a memory budget instead of a fixed count: with Config.MaxStates unset, the Runtime derives MaxStates from MemoryBudgetBytes ÷ measured per-state cost, then enforces it with LRU eviction + back-pressure under load. |
|
Example metrics shows wiring a Config.Metrics sink: the Runtime calls OnCompile/OnBuild/OnReuse/OnEvict/OnDrop at lifecycle points.
|
Example metrics shows wiring a Config.Metrics sink: the Runtime calls OnCompile/OnBuild/OnReuse/OnEvict/OnDrop at lifecycle points. |
|
Example observability shows the read-only introspection API: Stats (global gauges), PoolStats (per-script snapshot incl.
|
Example observability shows the read-only introspection API: Stats (global gauges), PoolStats (per-script snapshot incl. |
|
Example sandbox-libs shows controlling which Lua standard libraries a script can reach via Config.Libs.
|
Example sandbox-libs shows controlling which Lua standard libraries a script can reach via Config.Libs. |
|
Example trace-profiling shows Config.Trace: a TraceHook receives per-request, per-stage timings (load, compile, acquire, build, execute, release).
|
Example trace-profiling shows Config.Trace: a TraceHook receives per-request, per-stage timings (load, compile, acquire, build, execute, release). |
|
Example ttl-eviction shows the background janitor reclaiming idle script pools: a pool unused for longer than Config.IdleTTL is evicted whole (its pooled States closed), freeing memory automatically.
|
Example ttl-eviction shows the background janitor reclaiming idle script pools: a pool unused for longer than Config.IdleTTL is evicted whole (its pooled States closed), freeing memory automatically. |
Click to show internal directories.
Click to hide internal directories.