Documentation
¶
Index ¶
- Constants
- func AllBindings() map[string]BindingInfo
- func AllSessionKeyBindings() map[string]SessionKeyBinding
- func BindingsByStableID() map[string][]string
- func BindingsHash() string
- func BindingsHashMismatch() bool
- func GetEmbeddedBindingsHash() string
- func IsPersistenceDisabled() bool
- func LookupSetupIndex(pkgPath, funcName string, line int) (index int, hasFunc bool, ok bool)
- func NormalizeFuncName(name string) string
- func RegisterBindings(bindings map[string]BindingInfo)
- func RegisterSessionKeyBindings(bindings map[string]SessionKeyBinding)
- func RegisterSetupCallsites(entries map[string][]SetupCallsite)
- func ResolveCallerInfo(skip int) (packagePath, funcName string)
- func ResolveCallerSite(skip int) (packagePath, funcName, file string, line int)
- func SetEmbeddedBindingsHash(hash string)
- func SetIntegrityMode(mode BindingsIntegrityMode)
- func VerifyBindingsHash(devMode bool) error
- func VerifyBindingsIntegrity() bool
- type AnchorKeyBuilder
- type BindingInfo
- type BindingsIntegrityMode
- type PrimitiveInspection
- type PrimitiveMetadata
- type SessionKeyBinding
- type SetupCallsite
- type SetupScope
- type StateInspection
Constants ¶
const ( ClassLocal = "local" ClassSession = "session" ClassGlobal = "global" )
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 ¶
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 ¶
LookupSetupIndex resolves the setup index for a specific function callsite line.
func NormalizeFuncName ¶
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 ¶
ResolveCallerInfo extracts package path and function name for the caller.
func ResolveCallerSite ¶
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 ¶
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 ¶
SetupCallsite identifies a Setup callsite within a function.
type SetupScope ¶
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.