Documentation
¶
Overview ¶
Package runtime owns registered-component lookup and small method/path dispatch into the unified handler engine. HTTP adaptation, SQL execution, artifact compilation, and component metadata live in focused packages.
Index ¶
- type ComponentLoader
- type Observability
- type ObservabilityConfig
- type Option
- type RegisteredComponent
- type Runtime
- func (r *Runtime) AllowedMethodsForPath(path string) []string
- func (r *Runtime) ComponentTargetByMethodPath(method, path string) (dexec.ComponentTarget, bool)
- func (r *Runtime) Components() []*spec.Component
- func (r *Runtime) ExecuteRoute(ctx context.Context, method, path string, scope dexec.ProviderScope) (any, error)
- func (r *Runtime) ExposesComponent(key spec.Key) bool
- func (r *Runtime) ExposesMCPComponent(key spec.Key) bool
- func (r *Runtime) InvokeComponent(ctx context.Context, request dexec.ComponentRequest) (any, error)
- func (r *Runtime) LoadComponent(ctx context.Context, key spec.Key) (*RegisteredComponent, error)
- func (r *Runtime) LoadComponents(ctx context.Context, key spec.Key) ([]*RegisteredComponent, error)
- func (r *Runtime) MatchPathParams(method, path string) (map[string]string, bool)
- func (r *Runtime) NewAsyncService(config jobs.Config) (*jobs.Service, error)
- func (r *Runtime) NewWarmup(target dexec.ComponentTarget) (*Warmup, error)
- func (r *Runtime) Observability() *Observability
- func (r *Runtime) OutputByRoute(method, path string) (*registry.OutputContract, bool)
- func (r *Runtime) ReadResource(reference string) ([]byte, error)
- func (r *Runtime) ResolveComponentRoute(method, path string) (spec.Key, *spec.Route, bool)
- func (r *Runtime) ResolveOutputByRoute(ctx context.Context, method, path string) (*registry.OutputContract, error)
- func (r *Runtime) ResourceFS(name string) (fs.FS, bool)
- func (r *Runtime) Resources() *resource.Store
- func (r *Runtime) RouteByMethodPath(method, path string) (*spec.Route, bool)
- func (r *Runtime) Routes() []*spec.Route
- func (r *Runtime) Shutdown(ctx context.Context) error
- func (r *Runtime) Warmup(ctx context.Context, target dexec.ComponentTarget) (int, error)
- func (r *Runtime) WarmupRoute(path string) (spec.RouteRef, bool)
- func (r *Runtime) WarmupRoutes() []*spec.Route
- func (r *Runtime) WarmupTarget(path string) (dexec.ComponentTarget, bool)
- type Warmup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ComponentLoader ¶
type ComponentLoader interface {
LoadComponent(context.Context, spec.Key) (*RegisteredComponent, error)
}
ComponentLoader materializes one indexed component inside the currently pinned application generation.
type Observability ¶
type Observability struct {
Recorder *observability.Recorder
// contains filtered or unexported fields
}
Observability is application-owned. Native capture is always present; the optional adapter has no request-scoped lifecycle or global SDK registration.
func NewObservability ¶
func NewObservability(config ObservabilityConfig) (*Observability, error)
NewObservability creates one application-scoped capture/export owner.
func (*Observability) ExportStats ¶
func (o *Observability) ExportStats() otel.Stats
func (*Observability) Shutdown ¶
func (o *Observability) Shutdown(ctx context.Context) error
Shutdown continues cleanup after a caller deadline; there is one join/drain task per owner, never a task per generation or per retry.
func (*Observability) Stop ¶
func (o *Observability) Stop()
Stop ends export-lifetime admission. Existing native invocations retain their behavior, and accepted invocations finish capture before export is drained.
type ObservabilityConfig ¶
type ObservabilityConfig struct {
Logger xlogger.Logger
ReadingData observability.ReadingData
OTel *otel.Config
}
type Option ¶
type Option func(*options) error
Option configures application-scoped runtime dependencies.
func WithExposedPackages ¶
WithExposedPackages restricts public HTTP/MCP endpoints by package import path. All supplied components remain registered for internal dependency calls.
func WithManagedObservability ¶
func WithManagedObservability(owner *Observability) Option
WithManagedObservability borrows an application owner. It rejects stage-local policies rather than creating an exporter per reloadable generation.
func WithObservability ¶
func WithObservability(config ObservabilityConfig) Option
func WithResourceFS ¶
WithResourceFS registers a package filesystem for SQL, StructQL, codecs, and other compiled resources in a newly created store. It cannot be combined with WithResources: register files in that explicit store before compilation instead. embed.FS implements fs.FS and is retained unchanged.
func WithResources ¶
WithResources installs the shared package resource store used by binding, transcription, artifact compilation, and runtime handlers.
type RegisteredComponent ¶
type RegisteredComponent = rregistry.RegisteredComponent
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
func NewIndexedRuntime ¶
func NewIndexedRuntime(components []*spec.Component, preloaded []*RegisteredComponent, loader ComponentLoader, runtimeOptions ...Option) (*Runtime, error)
NewIndexedRuntime publishes route metadata immediately and resolves each executable registration through loader on first invocation.
func NewRuntime ¶
func NewRuntime(components []*RegisteredComponent, runtimeOptions ...Option) (*Runtime, error)
func (*Runtime) AllowedMethodsForPath ¶
func (*Runtime) ComponentTargetByMethodPath ¶
func (r *Runtime) ComponentTargetByMethodPath(method, path string) (dexec.ComponentTarget, bool)
ComponentTargetByMethodPath resolves the exact public component target used by protocol authorization without exposing the mutable route bundle.
func (*Runtime) Components ¶
Components returns detached canonical metadata without invoking handlers.
func (*Runtime) ExecuteRoute ¶
func (r *Runtime) ExecuteRoute(ctx context.Context, method, path string, scope dexec.ProviderScope) (any, error)
ExecuteRoute resolves a component and sends its prepared invocation through the single handler engine using providers assembled by the protocol adapter.
func (*Runtime) ExposesComponent ¶
ExposesComponent is the protocol catalog boundary. Internal invocation uses the complete registry and does not consult endpoint exposure.
func (*Runtime) ExposesMCPComponent ¶
ExposesMCPComponent applies scope visibility to an MCP catalogue entry. An explicitly MCP-exposed internal route is intentionally absent from the public HTTP bundle, but must remain discoverable by the MCP compiler.
func (*Runtime) InvokeComponent ¶
InvokeComponent executes one exact component target without route lookup.
func (*Runtime) LoadComponent ¶
LoadComponent exposes generation-scoped lazy resolution to protocol owners.
func (*Runtime) LoadComponents ¶
func (*Runtime) MatchPathParams ¶
MatchPathParams returns router-derived path values for a protocol adapter.
func (*Runtime) NewAsyncService ¶
NewAsyncService wires durable jobs over canonical component execution. Transport publication and watcher lifetime are configured explicitly.
func (*Runtime) NewWarmup ¶
func (r *Runtime) NewWarmup(target dexec.ComponentTarget) (*Warmup, error)
func (*Runtime) Observability ¶
func (r *Runtime) Observability() *Observability
func (*Runtime) OutputByRoute ¶
func (r *Runtime) OutputByRoute(method, path string) (*registry.OutputContract, bool)
OutputByRoute uses the same route precedence as execution and authorization.
func (*Runtime) ReadResource ¶
ReadResource reads a default or namespace-qualified package resource.
func (*Runtime) ResolveComponentRoute ¶
func (*Runtime) ResolveOutputByRoute ¶
func (r *Runtime) ResolveOutputByRoute(ctx context.Context, method, path string) (*registry.OutputContract, error)
ResolveOutputByRoute resolves output authority through this generation's loader. HTTP must not serialize a lazy component without its output contract.
func (*Runtime) ResourceFS ¶
ResourceFS returns the original package filesystem registered under name.
func (*Runtime) Resources ¶
Resources returns the shared package resource store used by this runtime.
func (*Runtime) RouteByMethodPath ¶
func (*Runtime) Shutdown ¶
Shutdown releases only a standalone runtime's owned services. Managed generations borrow their application owner and must not close it on retirement.
func (*Runtime) Warmup ¶
Warmup binds each authored root cache case through the canonical component engine before invoking the reader's native SQLX warmup operation.
func (*Runtime) WarmupRoute ¶
WarmupRoute resolves the public/requested GET route template that owns a warmup path. The returned route can differ from WarmupTarget when a handler delegates warmup execution to a private reader.
func (*Runtime) WarmupRoutes ¶
WarmupRoutes returns detached GET route metadata for operational cache warmup. Unlike Routes, this includes internal reader routes because warmup is separately administrator-authorized and does not publish the component.
func (*Runtime) WarmupTarget ¶
func (r *Runtime) WarmupTarget(path string) (dexec.ComponentTarget, bool)
WarmupTarget resolves exact GET warmup eligibility without requiring public HTTP visibility. Warmup is separately administrator-authorized.
type Warmup ¶
type Warmup struct {
// contains filtered or unexported fields
}
Warmup is an exact, server-selected operation. Prepare validates the selected credentials through canonical binding/query policy before retaining providers. It retains no caller context or HTTP request.
func (*Warmup) CredentialHeaders ¶
CredentialHeaders selects only canonical, verified JWT inputs for transport retention. Other input values must come from server-authored warmup cases.
func (*Warmup) PlannedCases ¶
PlannedCases returns the number of server-expanded authored cases that Run will execute. It uses the exact input contract and MaxCases policy retained by this warmup operation; callers do not supply case values.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package auth configures the original Datly JWT verification contract for explicitly declared input codecs.
|
Package auth configures the original Datly JWT verification contract for explicitly declared input codecs. |
|
Package differ adapts native godiff comparisons to the public handler contract.
|
Package differ adapts native godiff comparisons to the public handler contract. |
|
Package handler defines invocation-facing binder and handler abstractions plus capability keys shared by the unified engine.
|
Package handler defines invocation-facing binder and handler abstractions plus capability keys shared by the unified engine. |
|
codec/structql
Package structql implements the built-in StructQL parameter codec.
|
Package structql implements the built-in StructQL parameter codec. |
|
compiler
Package compiler converts canonical component parameters and Go input types into immutable Bindly plans and codec bindings.
|
Package compiler converts canonical component parameters and Go input types into immutable Bindly plans and codec bindings. |
|
custom
Package custom adapts typed user-defined Go handlers to the shared runtime handler contract.
|
Package custom adapts typed user-defined Go handlers to the shared runtime handler contract. |
|
engine
Package engine owns the common invocation path shared by runtime handler flavors: one Bindly scope, one input plan, and one lifecycle.
|
Package engine owns the common invocation path shared by runtime handler flavors: one Bindly scope, one input plan, and one lifecycle. |
|
mutation
Package mutation adapts generated mutation programs to the canonical handler engine.
|
Package mutation adapts generated mutation programs to the canonical handler engine. |
|
provider
Package provider adapts runtime-owned values into Bindly providers.
|
Package provider adapts runtime-owned values into Bindly providers. |
|
reader
Package reader adapts a registered read execution to the unified handler engine without owning SQL plans, connections, caches, or mutable read state.
|
Package reader adapts a registered read execution to the unified handler engine without owning SQL plans, connections, caches, or mutable read state. |
|
velty
Package velty adapts cached typed Velty programs to the shared handler engine.
|
Package velty adapts cached typed Velty programs to the shared handler engine. |
|
writer
Package writer provides the metadata-driven built-in mutation handler.
|
Package writer provides the metadata-driven built-in mutation handler. |
|
Package jobs owns durable scheduling over the original Datly DATLY_JOBS table.
|
Package jobs owns durable scheduling over the original Datly DATLY_JOBS table. |
|
Package output compiles component output encoding independently of transport and delegates wire formats to their native codec owners.
|
Package output compiles component output encoding independently of transport and delegates wire formats to their native codec owners. |
|
predicate
|
|
|
velty
Package velty compiles Datly predicate metadata into Velty-backed runtime evaluators exposed through the exec.PredicateEvaluator port.
|
Package velty compiles Datly predicate metadata into Velty-backed runtime evaluators exposed through the exec.PredicateEvaluator port. |
|
Package registry owns the registered-component carrier consumed by runtime lookup.
|
Package registry owns the registered-component carrier consumed by runtime lookup. |
|
Package route owns immutable route metadata and pure method/path matching.
|
Package route owns immutable route metadata and pure method/path matching. |