runtime

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClassLocal   = "local"
	ClassSession = "session"
	ClassGlobal  = "global"
)
View Source
const (
	KindSignal   = "signal"
	KindMemo     = "memo"
	KindResource = "resource"
	KindAction   = "action"
	KindEffect   = "effect"
	KindOnMount  = "onmount"
	KindOnChange = "onchange"
)

Variables

This section is empty.

Functions

func AllBindings

func AllBindings() map[string]BindingInfo

AllBindings returns a copy of all registered bindings.

func AllSessionKeyBindings

func AllSessionKeyBindings() map[string]SessionKeyBinding

AllSessionKeyBindings returns a copy of all session key bindings.

func BindingsByStableID

func BindingsByStableID() map[string][]string

BindingsByStableID groups bindings by stable ID.

func BindingsHash

func BindingsHash() string

BindingsHash returns the computed hash of all registered bindings.

func BindingsHashMismatch

func BindingsHashMismatch() bool

BindingsHashMismatch reports whether the embedded hash mismatched the registry.

func GetEmbeddedBindingsHash

func GetEmbeddedBindingsHash() string

GetEmbeddedBindingsHash returns the embedded hash set by generated bindings.

func IsPersistenceDisabled

func IsPersistenceDisabled() bool

IsPersistenceDisabled reports whether persistence was disabled due to mismatch.

func LookupSetupIndex

func LookupSetupIndex(pkgPath, funcName string, line int) (index int, hasFunc bool, ok bool)

LookupSetupIndex resolves the setup index for a specific function callsite line.

func NormalizeFuncName

func NormalizeFuncName(name string) string

NormalizeFuncName normalizes method receiver format and strips type parameters.

func RegisterBindings

func RegisterBindings(bindings map[string]BindingInfo)

RegisterBindings registers a batch of bindings from generated code. Called from package init() functions.

func RegisterSessionKeyBindings

func RegisterSessionKeyBindings(bindings map[string]SessionKeyBinding)

RegisterSessionKeyBindings registers a batch of session key bindings.

func RegisterSetupCallsites

func RegisterSetupCallsites(entries map[string][]SetupCallsite)

RegisterSetupCallsites registers Setup callsite metadata by function key.

func ResolveCallerInfo

func ResolveCallerInfo(skip int) (packagePath, funcName string)

ResolveCallerInfo extracts package path and function name for the caller.

func ResolveCallerSite

func ResolveCallerSite(skip int) (packagePath, funcName, file string, line int)

ResolveCallerSite extracts package path, function name, and source location for the caller.

func SetEmbeddedBindingsHash

func SetEmbeddedBindingsHash(hash string)

SetEmbeddedBindingsHash records the build-time bindings hash. It is idempotent and panics if a different hash is provided.

func SetIntegrityMode

func SetIntegrityMode(mode BindingsIntegrityMode)

SetIntegrityMode configures the mismatch handling behavior.

func VerifyBindingsHash

func VerifyBindingsHash(devMode bool) error

VerifyBindingsHash checks that the embedded bindings hash matches the computed registry hash. In dev mode, mismatch is a warning; in prod, it disables persistence and returns an error.

func VerifyBindingsIntegrity

func VerifyBindingsIntegrity() bool

VerifyBindingsIntegrity compares the embedded hash with the computed registry hash. It returns true when hashes match, and applies the configured integrity mode otherwise.

Types

type AnchorKeyBuilder

type AnchorKeyBuilder struct {
	// contains filtered or unexported fields
}

AnchorKeyBuilder computes anchor keys with partitioned ordinals.

func NewAnchorKeyBuilder

func NewAnchorKeyBuilder(scope SetupScope) *AnchorKeyBuilder

NewAnchorKeyBuilder creates a builder for a Setup scope.

func (*AnchorKeyBuilder) NextKey

func (b *AnchorKeyBuilder) NextKey(class, kind string) string

NextKey returns the next anchor key for the given class and kind.

type BindingInfo

type BindingInfo struct {
	StableID         string
	DebugName        string
	CodecFingerprint string
	Persisted        bool
	Kind             string
	Class            string
}

BindingInfo contains identity information for a primitive allocation site. Generated by tooling and registered at init time.

func LookupBinding

func LookupBinding(anchorKey string) (BindingInfo, bool)

LookupBinding resolves an anchor key to its binding info.

func MustLookupBinding

func MustLookupBinding(anchorKey string) BindingInfo

MustLookupBinding resolves an anchor key or panics. Missing bindings are a hard error in all modes.

type BindingsIntegrityMode

type BindingsIntegrityMode int

BindingsIntegrityMode describes how to react to bindings hash mismatches.

const (
	BindingsIntegrityWarn BindingsIntegrityMode = iota
	BindingsIntegrityDisablePersistence
	BindingsIntegrityPanic
)

type PrimitiveInspection

type PrimitiveInspection struct {
	StableID     string `json:"stableId"`
	DebugName    string `json:"debugName,omitempty"`
	AnchorKey    string `json:"anchorKey"`
	Kind         string `json:"kind"`
	Class        string `json:"class"`
	Persisted    bool   `json:"persisted"`
	InstancePath string `json:"instancePath"`
}

PrimitiveInspection is a single primitive entry in StateInspection.

type PrimitiveMetadata

type PrimitiveMetadata interface {
	StableID() string
	DebugName() string
	AnchorKey() string
	Kind() string
	Class() string
	Persisted() bool
}

PrimitiveMetadata provides identity and debug information for a primitive.

type SessionKeyBinding

type SessionKeyBinding struct {
	Name             string
	StableID         string
	CodecFingerprint string
	HasDefault       bool
}

SessionKeyBinding captures identity metadata for typed session keys.

func LookupSessionKeyBinding

func LookupSessionKeyBinding(name string) (SessionKeyBinding, bool)

LookupSessionKeyBinding resolves a session key binding by name.

func LookupSessionKeyBindingByStableID

func LookupSessionKeyBindingByStableID(stableID string) (SessionKeyBinding, bool)

LookupSessionKeyBindingByStableID resolves a session key binding by stable ID.

type SetupCallsite

type SetupCallsite struct {
	Line       int
	SetupIndex int
}

SetupCallsite identifies a Setup callsite within a function.

type SetupScope

type SetupScope struct {
	PackagePath  string
	FunctionName string
	SetupIndex   int
}

SetupScope identifies a Setup callsite.

type StateInspection

type StateInspection struct {
	SessionID    string                `json:"sessionId"`
	Primitives   []PrimitiveInspection `json:"primitives"`
	BindingsHash string                `json:"bindingsHash"`
}

StateInspection is the JSON output format for vango inspect state.

Jump to

Keyboard shortcuts

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