runtime2

package
v4.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: MIT Imports: 27 Imported by: 0

README

Internal Runtime2

Location: internal/runtime2/

This folder contains the experimental multithreaded runtime and its transport, scheduling, and host-region machinery.

File Layout

  • scheduler*.go, shard_session.go: worker scheduling, shard identity, and session coordination
  • host_region_adapter*.go: host-region lifecycle, diagnostics, dispatch, recovery, and snapshot handling
  • worker_region_runtime*.go: worker-side region execution
  • render_ir*.go, render_node_*.go, render_prop_*.go, render_string_table.go: canonical render IR build and validation
  • snapshot*.go, shared_snapshot*.go, structured_clone_snapshot*.go, binary_snapshot*.go: snapshot capture and transport paths
  • patch_*.go, patch_stream*.go, shared_patch*.go, structured_clone_patch*.go, binary_patch*.go: patch encoding, streaming, and replay
  • control*.go, coordinator.go, recovery_*.go, registry.go: control-plane state and fallback behavior
  • perf_*.go, *_bench_test.go, *_test.go: hotspot benchmarks and regression coverage

Start Here

Plugin Interposer Inventory

The current internal plugin-kernel bridge for runtime2 is intentionally narrow:

  • plugininterposer.go exposes package-level capability reporting through BuildRuntime2MetaService()
  • the exported capability surface currently comes from capabilities.go
  • richer status, diagnostics, hydration, fallback, and downgrade summaries remain implementation-owned and should be promoted only when they can be normalized without leaking unstable internals

This folder is still implementation-owned and not part of the stable external API surface.

Documentation

Index

Constants

View Source
const (
	// SSRShellMarkerVersionV1 identifies the first runtime2 SSR shell marker schema.
	SSRShellMarkerVersionV1 = "gwc.runtime2.ssr-shell.v1"
	// SSRShellMarkerAttribute identifies the host attribute key used for runtime2 SSR shell marker payloads.
	SSRShellMarkerAttribute = "data-gwc-runtime2-shell"
)
View Source
const (
	// PatchStreamProtocolVersion is the supported patch-stream protocol version.
	PatchStreamProtocolVersion = "gwc.parallel.v1"
)

Variables

This section is empty.

Functions

func BuildBinaryEnvelopeHeader

func BuildBinaryEnvelopeHeader(parseKind BinaryEnvelopeKind, parsePayloadLength uint32, parseChecksum uint32) ([]byte, error)

BuildBinaryEnvelopeHeader encodes a binary envelope header with magic, version, kind, payload length, and checksum.

func BuildBinaryMountEnvelope

func BuildBinaryMountEnvelope(parseEnvelope BinaryMountEnvelope) ([]byte, error)

BuildBinaryMountEnvelope encodes one validated mount envelope using the runtime2 binary transport.

func BuildBinaryPatchPayload

func BuildBinaryPatchPayload(parsePatchStream PatchStreamRaw) ([]byte, error)

BuildBinaryPatchPayload encodes one patch stream payload using runtime2 binary framing.

func BuildBinaryPropsValue

func BuildBinaryPropsValue(parseProps any) ([]byte, error)

BuildBinaryPropsValue encodes one props payload using the same binary value graph as source values.

func BuildBinarySnapshotBody

func BuildBinarySnapshotBody(parseEnvelope SnapshotEnvelope) ([]byte, error)

BuildBinarySnapshotBody encodes one validated snapshot envelope into the runtime2 binary body format.

func BuildBinarySnapshotEnvelope

func BuildBinarySnapshotEnvelope(parseEnvelope SnapshotEnvelope) ([]byte, error)

BuildBinarySnapshotEnvelope encodes one validated snapshot envelope using the runtime2 binary body and header.

func BuildBinarySourceIDTable

func BuildBinarySourceIDTable(parseSourceIDs []string) ([]byte, error)

BuildBinarySourceIDTable encodes one canonical source-ID table for binary snapshot transport.

func BuildBinarySourceValue

func BuildBinarySourceValue(parseValue any) ([]byte, error)

BuildBinarySourceValue encodes one supported source value for binary snapshot transport.

func BuildBinaryUpdateEnvelope

func BuildBinaryUpdateEnvelope(parseEnvelope BinaryUpdateEnvelope) ([]byte, error)

BuildBinaryUpdateEnvelope encodes one validated update envelope using the runtime2 binary transport.

func BuildCapabilityFixtureJSON

func BuildCapabilityFixtureJSON(parseFixture CapabilityFixture) ([]byte, error)

BuildCapabilityFixtureJSON encodes a validated capability-negotiation fixture.

func BuildControlEnvelopeJSON

func BuildControlEnvelopeJSON(parseEnvelope ControlEnvelope) ([]byte, error)

BuildControlEnvelopeJSON encodes a validated control-plane envelope.

func BuildEventSlotMetadataJSON

func BuildEventSlotMetadataJSON(parseMetadata EventSlotMetadata) ([]byte, error)

BuildEventSlotMetadataJSON encodes one validated event-slot metadata payload.

func BuildEventSlotMetadataPlaceholderJSON

func BuildEventSlotMetadataPlaceholderJSON(parseMetadata EventSlotMetadata) ([]byte, error)

BuildEventSlotMetadataPlaceholderJSON encodes one event-slot metadata payload through the legacy placeholder helper name.

func BuildKnownNodeIDsForRegionDOMIndex

func BuildKnownNodeIDsForRegionDOMIndex(parseIndex *RegionDOMIndex, parseRegionID string) map[uint64]struct{}

BuildKnownNodeIDsForRegionDOMIndex extracts known node IDs for one region from the DOM index.

func BuildPatchStreamIdentity

func BuildPatchStreamIdentity(parseRaw PatchStreamRaw) (string, error)

BuildPatchStreamIdentity computes one deterministic patch identity used by idempotency tracking.

func BuildRegionDOMPatchLookupMaps

func BuildRegionDOMPatchLookupMaps(parseIndex *RegionDOMIndex, parseRegionID string) (map[uint64]struct{}, map[uint64]uint32)

BuildRegionDOMPatchLookupMaps extracts known node IDs and sibling counts for one region in one pass.

func BuildRenderPropRecordsFromRenderOutput

func BuildRenderPropRecordsFromRenderOutput(parseRenderOutput any) ([]RenderPropRecordRaw, RenderStringTable, error)

BuildRenderPropRecordsFromRenderOutput extracts canonical prop records from one render output tree.

func BuildRuntime2MetaService

func BuildRuntime2MetaService() pluginruntime.Runtime2MetaService

BuildRuntime2MetaService returns one runtime2 capability service.

func BuildSSRShellMarkerAttributeValue

func BuildSSRShellMarkerAttributeValue(parseMarker SSRShellMarker) (string, error)

BuildSSRShellMarkerAttributeValue encodes one validated SSR shell marker into the attribute payload format.

func BuildSharedSnapshotPageHeader

func BuildSharedSnapshotPageHeader(parseKind SharedSnapshotPageKind, parseGeneration uint64, parsePayloadLength uint32, parseStatus SharedSnapshotPageStatus) ([]byte, error)

BuildSharedSnapshotPageHeader encodes one shared snapshot page header.

func BuildSiblingCountByParentForRegionDOMIndex

func BuildSiblingCountByParentForRegionDOMIndex(parseIndex *RegionDOMIndex, parseRegionID string) map[uint64]uint32

BuildSiblingCountByParentForRegionDOMIndex extracts sibling counts keyed by parent node ID for one region.

func BuildSourceSnapshot

func BuildSourceSnapshot(parseSourceIDs []string, parseSourceValues map[string]any) (map[string]any, error)

BuildSourceSnapshot selects declared source values from the current source map.

func BuildStructuredCloneMountEnvelopeJSON

func BuildStructuredCloneMountEnvelopeJSON(parseEnvelope StructuredCloneMountEnvelope) ([]byte, error)

BuildStructuredCloneMountEnvelopeJSON encodes one validated mount envelope for structured-clone transport.

func BuildStructuredClonePatchEnvelopeJSON

func BuildStructuredClonePatchEnvelopeJSON(parseEnvelope StructuredClonePatchEnvelope) ([]byte, error)

BuildStructuredClonePatchEnvelopeJSON encodes one validated structured-clone patch envelope.

func BuildStructuredClonePatchPayloadJSON

func BuildStructuredClonePatchPayloadJSON(parsePatchPayload any) ([]byte, error)

BuildStructuredClonePatchPayloadJSON encodes one patch payload for structured-clone transport.

func BuildStructuredCloneSnapshotEnvelopeJSON

func BuildStructuredCloneSnapshotEnvelopeJSON(parseEnvelope SnapshotEnvelope) ([]byte, error)

BuildStructuredCloneSnapshotEnvelopeJSON encodes one validated snapshot envelope for structured-clone transport.

func BuildStructuredCloneUpdateEnvelopeJSON

func BuildStructuredCloneUpdateEnvelopeJSON(parseEnvelope StructuredCloneUpdateEnvelope) ([]byte, error)

BuildStructuredCloneUpdateEnvelopeJSON encodes one validated update envelope for structured-clone transport.

func FormatRenderStyleValue

func FormatRenderStyleValue(parseRaw any) (string, error)

FormatRenderStyleValue normalizes a supported style payload into a canonical string.

func GetRenderAllowedHostTags

func GetRenderAllowedHostTags() []string

GetRenderAllowedHostTags returns the explicit first-slice allowed host-tag set in stable sorted order.

func GetRenderAllowedPropFamilies

func GetRenderAllowedPropFamilies() []string

GetRenderAllowedPropFamilies returns the explicit first-slice allowed prop-family set in stable sorted order.

func GetSnapshotFingerprint

func GetSnapshotFingerprint(parseEnvelope SnapshotEnvelope) (string, error)

GetSnapshotFingerprint returns a stable fingerprint for a snapshot envelope.

func GetSnapshotFingerprintHash

func GetSnapshotFingerprintHash(parseEnvelope SnapshotEnvelope) ([sha256.Size]byte, error)

GetSnapshotFingerprintHash returns a stable SHA-256 digest for a snapshot envelope.

func HasCanonicalRenderIRInvariantValidationEnabled

func HasCanonicalRenderIRInvariantValidationEnabled() bool

HasCanonicalRenderIRInvariantValidationEnabled reports whether strict canonical IR self-parse invariant checks are enabled.

func HasRendererFeatureFlag

func HasRendererFeatureFlag(parseMetadata RendererMetadata, parseFeatureFlag string) bool

HasRendererFeatureFlag reports whether renderer metadata contains one normalized feature flag.

func IsCanonicalRenderIREqual

func IsCanonicalRenderIREqual(parseLeft CanonicalRenderIR, parseRight CanonicalRenderIR) bool

IsCanonicalRenderIREqual reports whether two canonical render trees are identical.

func NormalizeSourceIDs

func NormalizeSourceIDs(parseSourceIDs []string) ([]string, error)

NormalizeSourceIDs validates and canonicalizes declared source IDs.

func ParseBinaryPropsValue

func ParseBinaryPropsValue(parsePayload []byte) (any, error)

ParseBinaryPropsValue decodes one binary props payload back into the runtime2 value graph.

func ParseBinarySourceIDTable

func ParseBinarySourceIDTable(parsePayload []byte) ([]string, error)

ParseBinarySourceIDTable decodes and validates one canonical source-ID table.

func ParseBinarySourceValue

func ParseBinarySourceValue(parsePayload []byte) (any, error)

ParseBinarySourceValue decodes one supported binary source value payload.

func ParseCanonicalRenderTree

func ParseCanonicalRenderTree(parseIR CanonicalRenderIR) (canonicalRenderTree, error)

ParseCanonicalRenderTree decodes one canonical render IR payload into node-level lookup state.

func ParseHostPatchPayloadWithFallback

func ParseHostPatchPayloadWithFallback(
	parsePatchReadyEnvelope ControlEnvelope,
	parseMessagePayload []byte,
	parseSharedPatchPage *SharedPatchPage,
) (TransportTier, PatchStreamRaw, error)

ParseHostPatchPayloadWithFallback decodes one patch payload based on one patch-ready control envelope with fallback across shared-buffer, binary, and structured-clone tiers.

func ParseSSRShellMarkerVersion

func ParseSSRShellMarkerVersion(parseRaw string) (string, error)

ParseSSRShellMarkerVersion validates one runtime2 SSR shell marker version string.

func ParseSnapshotTransportPayloadWithFallback

func ParseSnapshotTransportPayloadWithFallback(parseTransportTier TransportTier, parsePayload []byte) (TransportTier, SnapshotEnvelope, error)

ParseSnapshotTransportPayloadWithFallback decodes one snapshot payload and downgrades to structured-clone when binary decode fails.

func RedactDiagnosticText

func RedactDiagnosticText(parseDiagnosticText string) string

RedactDiagnosticText removes source snapshot values and likely secrets from one diagnostic text payload.

func RegisterRenderer

func RegisterRenderer(parseRendererID RendererID, parseRenderer RegionRenderer, parseMetadata RendererMetadata) error

RegisterRenderer registers a region renderer and its metadata by stable ID.

func ResetCapabilityReport

func ResetCapabilityReport()

ResetCapabilityReport clears package-level capability overrides and restores default disabled capability reporting.

func ResetRendererRegistry

func ResetRendererRegistry()

ResetRendererRegistry clears the renderer registry for deterministic tests.

func ResetRuntime2MetaProvider

func ResetRuntime2MetaProvider()

ResetRuntime2MetaProvider clears the current runtime2 metadata provider.

func ResolveRenderer

func ResolveRenderer(parseRendererID RendererID) (RegionRenderer, RendererMetadata, error)

ResolveRenderer resolves a registered region renderer by stable ID.

func SetCanonicalRenderIRInvariantValidationEnabled

func SetCanonicalRenderIRInvariantValidationEnabled(parseIsEnabled bool)

SetCanonicalRenderIRInvariantValidationEnabled enables or disables strict canonical IR self-parse invariant checks.

func SetCapabilityReportOverride

func SetCapabilityReportOverride(parseReport CapabilityReport) error

SetCapabilityReportOverride stores one explicit package-level capability override.

func SetRendererMetadata

func SetRendererMetadata(parseRendererID RendererID, parseMetadata RendererMetadata) error

SetRendererMetadata updates registered renderer metadata by stable ID.

func SetRuntime2MetaProvider

func SetRuntime2MetaProvider(parseProvider Runtime2MetaProvider)

SetRuntime2MetaProvider stores one runtime2 metadata provider for plugin inspection.

func ValidateCapabilityFixture

func ValidateCapabilityFixture(parseFixture CapabilityFixture) error

ValidateCapabilityFixture verifies a decoded capability-negotiation fixture is complete.

func ValidateCapabilityReport

func ValidateCapabilityReport(parseReport CapabilityReport) error

ValidateCapabilityReport verifies an explicit capability report is internally consistent.

func ValidateControlEnvelope

func ValidateControlEnvelope(parseEnvelope ControlEnvelope) error

ValidateControlEnvelope verifies one control-plane message is internally consistent.

func ValidateDiagnosticDowngradeReason

func ValidateDiagnosticDowngradeReason(parseDowngradeReason DiagnosticDowngradeReason) error

ValidateDiagnosticDowngradeReason verifies downgrade diagnostics align with binary and shared-memory fallback reason sets.

func ValidateDiagnosticFallbackReason

func ValidateDiagnosticFallbackReason(parseReason DiagnosticFallbackReason) error

ValidateDiagnosticFallbackReason verifies fallback diagnostics align with transport, DOM, and worker-death reason sets.

func ValidateDiagnosticShardID

func ValidateDiagnosticShardID(parseShardID SchedulerShardID) error

ValidateDiagnosticShardID verifies diagnostic shard reporting uses a non-empty, normalized shard identity.

func ValidateDiagnosticSizeMetrics

func ValidateDiagnosticSizeMetrics(parseMetrics DiagnosticSizeMetrics) error

ValidateDiagnosticSizeMetrics verifies size diagnostics include at least one non-zero payload size.

func ValidateDiagnosticTimingMetrics

func ValidateDiagnosticTimingMetrics(parseMetrics DiagnosticTimingMetrics) error

ValidateDiagnosticTimingMetrics verifies timing diagnostics include at least one non-zero stage duration.

func ValidateDiagnosticTraceMetadata

func ValidateDiagnosticTraceMetadata(parseMetadata DiagnosticTraceMetadata) error

ValidateDiagnosticTraceMetadata verifies debug-only trace metadata is complete and non-ambiguous.

func ValidateEventSlotDispatch

func ValidateEventSlotDispatch(parseDispatch EventSlotDispatch) error

ValidateEventSlotDispatch verifies one semantic event dispatch uses a declared-slot compatible shape.

func ValidateEventSlotMetadata

func ValidateEventSlotMetadata(parseMetadata EventSlotMetadata) error

ValidateEventSlotMetadata verifies event-slot metadata shape and version rules.

func ValidateMonotonicInputVersion

func ValidateMonotonicInputVersion(parsePrevious uint64, parseCurrent uint64) error

ValidateMonotonicInputVersion verifies input versions do not move backward.

func ValidateParallelRegionSpec

func ValidateParallelRegionSpec(parseSpec ParallelRegionSpec) error

ValidateParallelRegionSpec verifies the required IDs, props, and declared sources for a parallel region.

func ValidatePatchOrder

func ValidatePatchOrder(parseEntries []PatchOrderEntry, parseKnownNodeIDs map[uint64]struct{}) error

ValidatePatchOrder validates structural patch ordering rules for one patch stream.

func ValidateProtocolVersionMatch

func ValidateProtocolVersionMatch(parseExpected ProtocolVersion, parseActual ProtocolVersion) error

ValidateProtocolVersionMatch verifies two protocol versions are compatible.

func ValidateRendererMetadata

func ValidateRendererMetadata(parseMetadata RendererMetadata) error

ValidateRendererMetadata verifies optional renderer metadata is internally consistent.

func ValidateSSRShellMarker

func ValidateSSRShellMarker(parseMarker SSRShellMarker) error

ValidateSSRShellMarker verifies one runtime2 SSR shell marker is internally consistent.

func ValidateSerializableProps

func ValidateSerializableProps(parseProps any) error

ValidateSerializableProps verifies props are serializable through the supported Track A contract.

func ValidateSnapshotEnvelope

func ValidateSnapshotEnvelope(parseEnvelope SnapshotEnvelope) error

ValidateSnapshotEnvelope verifies a snapshot envelope is complete enough to dispatch.

func ValidateSourceSnapshotConsistency

func ValidateSourceSnapshotConsistency(parseSourceIDs []string, parseSourceVersions map[string]uint64) (uint64, error)

ValidateSourceSnapshotConsistency verifies all declared source versions describe one coherent snapshot.

func ValidateStructuredClonePatchEnvelope

func ValidateStructuredClonePatchEnvelope(parseEnvelope StructuredClonePatchEnvelope) error

ValidateStructuredClonePatchEnvelope verifies one structured-clone patch envelope contract.

func ValidateWorkerRenderableHostTag

func ValidateWorkerRenderableHostTag(parseHostTag string) error

ValidateWorkerRenderableHostTag verifies one host tag is explicitly allowed for first-slice worker-renderable regions.

func ValidateWorkerRenderablePropFamily

func ValidateWorkerRenderablePropFamily(parsePropFamily string) error

ValidateWorkerRenderablePropFamily verifies one prop family is explicitly allowed for first-slice worker-renderable regions.

func ValidateWorkerRenderableRenderOutput

func ValidateWorkerRenderableRenderOutput(parseRenderOutput any) error

ValidateWorkerRenderableRenderOutput verifies worker render output excludes first-slice portal-like markers.

Types

type BinaryEnvelopeHeader

type BinaryEnvelopeHeader struct {
	Kind          BinaryEnvelopeKind
	SectionCount  uint8
	PayloadLength uint32
	Checksum      uint32
}

BinaryEnvelopeHeader stores decoded binary envelope header fields.

func ParseBinaryEnvelopeHeader

func ParseBinaryEnvelopeHeader(parsePayload []byte) (BinaryEnvelopeHeader, error)

ParseBinaryEnvelopeHeader decodes and validates a binary envelope header.

type BinaryEnvelopeKind

type BinaryEnvelopeKind uint8

BinaryEnvelopeKind identifies the payload kind carried by one binary envelope.

const (
	// BinaryEnvelopeKindSnapshot identifies snapshot envelope payloads.
	BinaryEnvelopeKindSnapshot BinaryEnvelopeKind = 1
	// BinaryEnvelopeKindMount identifies mount envelope payloads.
	BinaryEnvelopeKindMount BinaryEnvelopeKind = 2
	// BinaryEnvelopeKindUpdate identifies update envelope payloads.
	BinaryEnvelopeKindUpdate BinaryEnvelopeKind = 3
)

type BinaryMountEnvelope

type BinaryMountEnvelope struct {
	RegionInstanceID RegionInstanceID
	RendererID       RendererID
	SourceIDs        []string
	Snapshot         SnapshotEnvelope
}

BinaryMountEnvelope stores the mount payload encoded over runtime2 binary transport.

func ParseBinaryMountEnvelope

func ParseBinaryMountEnvelope(parsePayload []byte) (BinaryMountEnvelope, error)

ParseBinaryMountEnvelope decodes and validates one runtime2 binary mount envelope payload.

type BinaryUpdateEnvelope

type BinaryUpdateEnvelope struct {
	RegionInstanceID RegionInstanceID
	InputVersion     uint64
	Snapshot         SnapshotEnvelope
}

BinaryUpdateEnvelope stores the update payload encoded over runtime2 binary transport.

func ParseBinaryUpdateEnvelope

func ParseBinaryUpdateEnvelope(parsePayload []byte) (BinaryUpdateEnvelope, error)

ParseBinaryUpdateEnvelope decodes and validates one runtime2 binary update envelope payload.

type CanonicalRenderIR

type CanonicalRenderIR struct {
	GetRootNodeID  uint64
	GetStringTable RenderStringTable
	GetNodeRecords []RenderNodeRecordRaw
	GetPropRecords []RenderPropRecordRaw
}

CanonicalRenderIR stores one fully canonicalized render tree for worker diffing.

func BuildCanonicalRenderIR

func BuildCanonicalRenderIR(parseRenderOutput any) (CanonicalRenderIR, error)

BuildCanonicalRenderIR converts one validated display-only render output into canonical render IR tables.

type CapabilityFixture

type CapabilityFixture struct {
	ProtocolVersion ProtocolVersion  `json:"protocol_version"`
	Capabilities    CapabilityReport `json:"capabilities"`
}

CapabilityFixture stores a deterministic capability-negotiation fixture for tests.

func ParseCapabilityFixtureJSON

func ParseCapabilityFixtureJSON(parseValue []byte) (CapabilityFixture, error)

ParseCapabilityFixtureJSON decodes and validates a capability-negotiation fixture.

type CapabilityReport

type CapabilityReport struct {
	HasWorkerSupport                bool
	HasMessagePortSupport           bool
	HasStructuredCloneSupport       bool
	HasBinaryTransportSupport       bool
	HasSharedBufferSupport          bool
	HasSharedMemoryTransportSupport bool
}

CapabilityReport reports the currently usable multithreaded runtime capabilities.

func BuildCapabilityReport

func BuildCapabilityReport(parseSource CapabilitySource) CapabilityReport

BuildCapabilityReport normalizes raw capability inputs into a usable runtime2 capability report.

func GetCapabilityReport

func GetCapabilityReport() CapabilityReport

GetCapabilityReport reports the currently known package-level multithreaded runtime capabilities.

func InitCapabilityReport

func InitCapabilityReport(parseSource CapabilitySource) (CapabilityReport, error)

InitCapabilityReport initializes package-level capability state from one detected capability source.

func InitCapabilityReportFromRuntime

func InitCapabilityReportFromRuntime() (CapabilityReport, error)

InitCapabilityReportFromRuntime initializes package-level capability state from live runtime feature detection.

type CapabilitySource

type CapabilitySource struct {
	HasWorkerSupport                bool
	HasMessagePortSupport           bool
	HasStructuredCloneSupport       bool
	HasBinaryTransportSupport       bool
	HasSharedBufferSupport          bool
	HasSharedMemoryTransportSupport bool
}

CapabilitySource describes the raw capability inputs used to build a runtime2 capability report.

func DetectCapabilitySource

func DetectCapabilitySource() CapabilitySource

DetectCapabilitySource reports runtime capability inputs for non-browser builds.

type ControlDiagnosticEnvelopeSpec

type ControlDiagnosticEnvelopeSpec struct {
	DiagnosticType      DiagnosticEventKind
	DiagnosticText      string
	DiagnosticTiming    *DiagnosticTimingMetrics
	DiagnosticSize      *DiagnosticSizeMetrics
	DiagnosticFallback  *DiagnosticFallbackReason
	DiagnosticTrace     *DiagnosticTraceMetadata
	DiagnosticShardID   SchedulerShardID
	TransportTier       TransportTier
	DiagnosticDowngrade *DiagnosticDowngradeReason
}

ControlDiagnosticEnvelopeSpec stores one diagnostic envelope payload contract.

type ControlEnvelope

type ControlEnvelope struct {
	ProtocolVersion     ProtocolVersion            `json:"protocol_version"`
	Kind                ControlKind                `json:"kind"`
	RegionInstanceID    RegionInstanceID           `json:"region_instance_id,omitempty"`
	RendererID          RendererID                 `json:"renderer_id,omitempty"`
	Epoch               uint64                     `json:"epoch,omitempty"`
	InputVersion        uint64                     `json:"input_version,omitempty"`
	PatchVersion        uint64                     `json:"patch_version,omitempty"`
	TransportTier       TransportTier              `json:"transport_tier,omitempty"`
	EventSlot           *EventSlotDispatch         `json:"event_slot,omitempty"`
	Capabilities        *CapabilityReport          `json:"capabilities,omitempty"`
	Snapshot            *SnapshotEnvelope          `json:"snapshot,omitempty"`
	DiagnosticType      string                     `json:"diagnostic_type,omitempty"`
	DiagnosticText      string                     `json:"diagnostic_text,omitempty"`
	DiagnosticTiming    *DiagnosticTimingMetrics   `json:"diagnostic_timing,omitempty"`
	DiagnosticSize      *DiagnosticSizeMetrics     `json:"diagnostic_size,omitempty"`
	DiagnosticFallback  *DiagnosticFallbackReason  `json:"diagnostic_fallback,omitempty"`
	DiagnosticTrace     *DiagnosticTraceMetadata   `json:"diagnostic_trace,omitempty"`
	DiagnosticShardID   SchedulerShardID           `json:"diagnostic_shard_id,omitempty"`
	DiagnosticDowngrade *DiagnosticDowngradeReason `json:"diagnostic_downgrade,omitempty"`
	PongShardID         SchedulerShardID           `json:"pong_shard_id,omitempty"`
	PongSequence        uint64                     `json:"pong_sequence,omitempty"`
}

ControlEnvelope stores a validated control-plane message.

func BuildControlCancelEnvelope

func BuildControlCancelEnvelope(parseRegionInstanceID RegionInstanceID) (ControlEnvelope, error)

BuildControlCancelEnvelope builds one validated cancel control envelope.

func BuildControlCapabilitiesEnvelope

func BuildControlCapabilitiesEnvelope(parseCapabilityReport CapabilityReport) (ControlEnvelope, error)

BuildControlCapabilitiesEnvelope builds one validated capabilities control envelope.

func BuildControlDiagnosticEnvelope

func BuildControlDiagnosticEnvelope(
	parseRegionInstanceID RegionInstanceID,
	parseDiagnosticSpec ControlDiagnosticEnvelopeSpec,
) (ControlEnvelope, error)

BuildControlDiagnosticEnvelope builds one validated diagnostic control envelope.

func BuildControlDisposeEnvelope

func BuildControlDisposeEnvelope(parseRegionInstanceID RegionInstanceID) (ControlEnvelope, error)

BuildControlDisposeEnvelope builds one validated dispose control envelope.

func BuildControlEventEnvelope

func BuildControlEventEnvelope(parseRegionInstanceID RegionInstanceID, parseEventSlot EventSlotDispatch) (ControlEnvelope, error)

BuildControlEventEnvelope builds one validated semantic event-slot control envelope.

func BuildControlMountEnvelope

func BuildControlMountEnvelope(parseRendererID RendererID, parseSnapshot SnapshotEnvelope) (ControlEnvelope, error)

BuildControlMountEnvelope builds one validated mount control envelope.

func BuildControlPatchReadyEnvelope

func BuildControlPatchReadyEnvelope(
	parseRegionInstanceID RegionInstanceID,
	parsePatchVersion uint64,
	parseInputVersion uint64,
	parseTransportTier TransportTier,
) (ControlEnvelope, error)

BuildControlPatchReadyEnvelope builds one validated patch-ready control envelope.

func BuildControlPongEnvelope

func BuildControlPongEnvelope(parseShardID SchedulerShardID, parseSequence uint64) (ControlEnvelope, error)

BuildControlPongEnvelope builds one validated pong control envelope.

func BuildControlReadyEnvelope

func BuildControlReadyEnvelope() ControlEnvelope

BuildControlReadyEnvelope builds one validated ready control envelope.

func BuildControlRestartEnvelope

func BuildControlRestartEnvelope(parseRegionInstanceID RegionInstanceID, parseEpoch uint64) (ControlEnvelope, error)

BuildControlRestartEnvelope builds one validated restart control envelope.

func BuildControlUpdateEnvelope

func BuildControlUpdateEnvelope(parseSnapshot SnapshotEnvelope) (ControlEnvelope, error)

BuildControlUpdateEnvelope builds one validated update control envelope.

func ParseControlEnvelopeJSON

func ParseControlEnvelopeJSON(parseValue []byte) (ControlEnvelope, error)

ParseControlEnvelopeJSON decodes and validates a control-plane envelope.

func RedactControlDiagnosticEnvelope

func RedactControlDiagnosticEnvelope(parseEnvelope ControlEnvelope) ControlEnvelope

RedactControlDiagnosticEnvelope scrubs diagnostic text fields before control-envelope emission or host-side processing.

type ControlKind

type ControlKind string

ControlKind identifies one control-plane message kind.

const (
	// ControlKindReady reports worker readiness.
	ControlKindReady ControlKind = "ready"
	// ControlKindCapabilities reports worker capabilities.
	ControlKindCapabilities ControlKind = "capabilities"
	// ControlKindMount requests region mount work.
	ControlKindMount ControlKind = "mount"
	// ControlKindUpdate requests region update work.
	ControlKindUpdate ControlKind = "update"
	// ControlKindEvent requests one semantic event-slot dispatch against one mounted region.
	ControlKindEvent ControlKind = "event"
	// ControlKindCancel requests cancellation of in-flight region work.
	ControlKindCancel ControlKind = "cancel"
	// ControlKindDispose requests region disposal.
	ControlKindDispose ControlKind = "dispose"
	// ControlKindPatchReady reports that a patch is available.
	ControlKindPatchReady ControlKind = "patch-ready"
	// ControlKindDiagnostic reports diagnostics.
	ControlKindDiagnostic ControlKind = "diagnostic"
	// ControlKindRestart coordinates restart handling.
	ControlKindRestart ControlKind = "restart"
	// ControlKindPong reports shard liveness keepalive.
	ControlKindPong ControlKind = "pong"
)

func ParseControlKind

func ParseControlKind(parseRaw string) (ControlKind, error)

ParseControlKind validates a raw control-plane kind value.

type Coordinator

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

Coordinator scopes future multithreaded runtime state away from the shipped runtime singleton.

func BuildCoordinator

func BuildCoordinator() *Coordinator

BuildCoordinator creates an isolated coordinator for the multithreaded runtime package.

func (*Coordinator) CancelRegion

func (parseCoordinator *Coordinator) CancelRegion(parseRegionInstanceID RegionInstanceID) error

CancelRegion marks one region's in-flight work as canceled.

func (*Coordinator) CommitRegion

func (parseCoordinator *Coordinator) CommitRegion(parseRegionInstanceID RegionInstanceID, parseCommittedVersion uint64) error

CommitRegion records a committed region patch version.

func (*Coordinator) DisposeRegion

func (parseCoordinator *Coordinator) DisposeRegion(parseRegionInstanceID RegionInstanceID) error

DisposeRegion removes one live coordinator entry.

func (*Coordinator) FallbackRegion

func (parseCoordinator *Coordinator) FallbackRegion(parseRegionInstanceID RegionInstanceID) error

FallbackRegion marks one region as locally owned fallback state.

func (*Coordinator) GetEntry

func (parseCoordinator *Coordinator) GetEntry(parseRegionInstanceID RegionInstanceID) (CoordinatorEntry, bool)

GetEntry reports the current coordinator entry for one region instance.

func (*Coordinator) GetEntryDispatchValidation

func (parseCoordinator *Coordinator) GetEntryDispatchValidation(parseRegionInstanceID RegionInstanceID) (isFallback bool, lastSnapshotVersion uint64, lastDispatchedVersion uint64, ok bool)

GetEntryDispatchValidation reads only the IsFallback, LastSnapshotVersion, and LastDispatchedVersion from one coordinator entry. It avoids copying the full CoordinatorEntry value and is optimized for the hot dispatch-validation path.

func (*Coordinator) GetEntrySnapshotAndDispatchFields

func (parseCoordinator *Coordinator) GetEntrySnapshotAndDispatchFields(
	parseRegionInstanceID RegionInstanceID,
) (
	getEpoch uint64,
	getRendererID RendererID,
	getSourceIDs []string,
	isFallback bool,
	lastSnapshotVersion uint64,
	lastDispatchedVersion uint64,
	ok bool,
)

GetEntrySnapshotAndDispatchFields reads snapshot fields and dispatch validation fields in one lock round. It avoids separate GetEntrySnapshotFields and GetEntryDispatchValidation calls on hot update-dispatch paths.

func (*Coordinator) GetEntrySnapshotFields

func (parseCoordinator *Coordinator) GetEntrySnapshotFields(parseRegionInstanceID RegionInstanceID) (getEpoch uint64, getRendererID RendererID, getSourceIDs []string, ok bool)

GetEntrySnapshotFields reads only the Epoch, RendererID, and SourceIDs from one coordinator entry. It avoids copying the full CoordinatorEntry value and is optimized for the hot update-snapshot path.

func (*Coordinator) GetStatus

func (parseCoordinator *Coordinator) GetStatus() Status

GetStatus reports whether the coordinator has been configured.

func (*Coordinator) IncrementRegionDroppedStalePatchCount

func (parseCoordinator *Coordinator) IncrementRegionDroppedStalePatchCount(parseRegionInstanceID RegionInstanceID) (uint64, error)

IncrementRegionDroppedStalePatchCount increments one region's stale patch-drop counter.

func (*Coordinator) IncrementRegionIgnoredStaleDiagnosticCount

func (parseCoordinator *Coordinator) IncrementRegionIgnoredStaleDiagnosticCount(parseRegionInstanceID RegionInstanceID) (uint64, error)

IncrementRegionIgnoredStaleDiagnosticCount increments one region's stale-diagnostic ignore counter.

func (*Coordinator) IncrementRegionRepairRemountCount

func (parseCoordinator *Coordinator) IncrementRegionRepairRemountCount(parseRegionInstanceID RegionInstanceID) (uint64, error)

IncrementRegionRepairRemountCount increments one region's successful repair-remount counter.

func (*Coordinator) MountRegion

func (parseCoordinator *Coordinator) MountRegion(parseEntry CoordinatorEntry) error

MountRegion creates one live coordinator entry for a mounted region.

func (*Coordinator) RestartRegion

func (parseCoordinator *Coordinator) RestartRegion(parseRegionInstanceID RegionInstanceID, parseEpoch uint64) error

RestartRegion bumps one region's epoch and clears version state for a fresh mount cycle.

func (*Coordinator) SetRegionAttached

func (parseCoordinator *Coordinator) SetRegionAttached(parseRegionInstanceID RegionInstanceID, parseIsAttached bool) error

SetRegionAttached stores one coordinator attached-state transition for a mounted region.

func (*Coordinator) SetRegionLastSnapshotVersion

func (parseCoordinator *Coordinator) SetRegionLastSnapshotVersion(parseRegionInstanceID RegionInstanceID, parseSnapshotVersion uint64) error

SetRegionLastSnapshotVersion stores one monotonic snapshot version for a mounted region.

func (*Coordinator) SetRegionSnapshotState

func (parseCoordinator *Coordinator) SetRegionSnapshotState(
	parseRegionInstanceID RegionInstanceID,
	parseSnapshotVersion uint64,
	parseSourceIDs []string,
	parseShouldStoreSourceIDs bool,
) (CoordinatorEntry, error)

SetRegionSnapshotState stores one monotonic snapshot version and optionally canonical source IDs in one transaction.

func (*Coordinator) SetRegionSourceIDs

func (parseCoordinator *Coordinator) SetRegionSourceIDs(parseRegionInstanceID RegionInstanceID, parseSourceIDs []string) error

SetRegionSourceIDs stores one canonical declared-source set for a mounted region.

func (*Coordinator) StoreRegionSnapshotAndDispatchedVersion

func (parseCoordinator *Coordinator) StoreRegionSnapshotAndDispatchedVersion(
	parseRegionInstanceID RegionInstanceID,
	parseSnapshotVersion uint64,
	parseDispatchedVersion uint64,
) (CoordinatorEntry, error)

StoreRegionSnapshotAndDispatchedVersion stores monotonic snapshot and dispatched versions in one transaction and returns the updated entry.

func (*Coordinator) StoreRegionSnapshotDispatchState

func (parseCoordinator *Coordinator) StoreRegionSnapshotDispatchState(
	parseRegionInstanceID RegionInstanceID,
	parseSnapshotVersion uint64,
	parseDispatchedVersion uint64,
	parseSourceIDs []string,
	parseShouldStoreSourceIDs bool,
) (CoordinatorEntry, error)

StoreRegionSnapshotDispatchState stores monotonic snapshot and dispatched versions and optionally canonical source IDs in one transaction.

func (*Coordinator) UpdateRegion

func (parseCoordinator *Coordinator) UpdateRegion(parseRegionInstanceID RegionInstanceID, parseInputVersion uint64) error

UpdateRegion records a dispatched region update.

func (*Coordinator) UpdateRegionAndGetEntry

func (parseCoordinator *Coordinator) UpdateRegionAndGetEntry(parseRegionInstanceID RegionInstanceID, parseInputVersion uint64) (CoordinatorEntry, error)

UpdateRegionAndGetEntry records a dispatched region update and returns the updated entry.

type CoordinatorEntry

type CoordinatorEntry struct {
	RegionInstanceID            RegionInstanceID
	RendererID                  RendererID
	SourceIDs                   []string
	Epoch                       uint64
	AssignedWorkerShard         string
	CurrentState                CoordinatorState
	LastSnapshotVersion         uint64
	LastDispatchedVersion       uint64
	LastCommittedVersion        uint64
	DroppedStalePatchCount      uint64
	IgnoredStaleDiagnosticCount uint64
	RepairRemountCount          uint64
	IsAttached                  bool
	IsFallback                  bool
}

CoordinatorEntry stores one live region's coordinator state.

type CoordinatorState

type CoordinatorState string

CoordinatorState identifies one coordinator lifecycle state.

const (
	// CoordinatorStateMounted reports a mounted region awaiting or holding worker ownership.
	CoordinatorStateMounted CoordinatorState = "mounted"
	// CoordinatorStateActive reports a region with active worker-backed updates.
	CoordinatorStateActive CoordinatorState = "active"
	// CoordinatorStateCanceled reports a region with canceled in-flight work.
	CoordinatorStateCanceled CoordinatorState = "canceled"
	// CoordinatorStateFallback reports a region that has exited worker-backed mode.
	CoordinatorStateFallback CoordinatorState = "fallback"
)

type DOMCommitFailureKind

type DOMCommitFailureKind string

DOMCommitFailureKind identifies one commit-layer failure trigger that should enter fallback.

const (
	DOMCommitFailureKindMissingParentAnchor DOMCommitFailureKind = "missing-parent-anchor"
	DOMCommitFailureKindMissingNodeLookup   DOMCommitFailureKind = "missing-node-lookup"
	DOMCommitFailureKindInvalidKeyedMove    DOMCommitFailureKind = "invalid-keyed-move"
)

type DOMCommitResult

type DOMCommitResult struct {
	IsNoOp bool
}

DOMCommitResult reports whether a commit operation changed region-local DOM state.

type DOMCommitter

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

DOMCommitter applies patch operations against a region-local DOM index.

func BuildDOMCommitter

func BuildDOMCommitter(parseRegionDOMIndex *RegionDOMIndex) *DOMCommitter

BuildDOMCommitter creates a DOM committer for the provided region-local DOM index.

func (*DOMCommitter) CommitRegionAttr

func (parseDOMCommitter *DOMCommitter) CommitRegionAttr(parseRegionID string, parseNodeID uint64, parseAttrKey string, parseAttrValue string) (DOMCommitResult, error)

CommitRegionAttr applies one set-attr operation to a region-local host node for supported first-slice attr kinds.

func (*DOMCommitter) CommitRegionInsertNode

func (parseDOMCommitter *DOMCommitter) CommitRegionInsertNode(parseRegionID string, parseParentNodeID uint64, parseInsertNode *RegionDOMNode, parseBeforeNodeID uint64) (DOMCommitResult, error)

CommitRegionInsertNode inserts one region-local node under a parent, optionally before a sibling anchor.

func (*DOMCommitter) CommitRegionMoveKeyedNode

func (parseDOMCommitter *DOMCommitter) CommitRegionMoveKeyedNode(parseRegionID string, parseParentNodeID uint64, parseMoveNodeID uint64, parseBeforeNodeID uint64) (DOMCommitResult, error)

CommitRegionMoveKeyedNode reorders one keyed child under a parent, optionally before a target sibling.

func (*DOMCommitter) CommitRegionPatchTransaction

func (parseDOMCommitter *DOMCommitter) CommitRegionPatchTransaction(parseTransaction RegionPatchTransaction) (RegionPatchTransactionResult, error)

CommitRegionPatchTransaction applies a patch stream as an atomic transaction with rollback on failure.

func (*DOMCommitter) CommitRegionRemoveAttr

func (parseDOMCommitter *DOMCommitter) CommitRegionRemoveAttr(parseRegionID string, parseNodeID uint64, parseAttrKey string) (DOMCommitResult, error)

CommitRegionRemoveAttr applies one remove-attr operation to a region-local host node.

func (*DOMCommitter) CommitRegionRemoveNode

func (parseDOMCommitter *DOMCommitter) CommitRegionRemoveNode(parseRegionID string, parseNodeID uint64) (DOMCommitResult, error)

CommitRegionRemoveNode removes one region-local node and any indexed descendants from the DOM index.

func (*DOMCommitter) CommitRegionRemoveStyle

func (parseDOMCommitter *DOMCommitter) CommitRegionRemoveStyle(parseRegionID string, parseNodeID uint64) (DOMCommitResult, error)

CommitRegionRemoveStyle applies one remove-style operation to a region-local host node.

func (*DOMCommitter) CommitRegionReplaceSubtree

func (parseDOMCommitter *DOMCommitter) CommitRegionReplaceSubtree(parseRegionID string, parseTargetNodeID uint64, parseSubtreeIR CanonicalRenderIR) (DOMCommitResult, error)

CommitRegionReplaceSubtree replaces one target node subtree with one canonical replacement subtree and rebuilds local index entries.

func (*DOMCommitter) CommitRegionSetStyle

func (parseDOMCommitter *DOMCommitter) CommitRegionSetStyle(parseRegionID string, parseNodeID uint64, parseStyleValue string) (DOMCommitResult, error)

CommitRegionSetStyle applies one set-style operation to a region-local host node.

func (*DOMCommitter) CommitRegionText

func (parseDOMCommitter *DOMCommitter) CommitRegionText(parseRegionID string, parseNodeID uint64, parseText string) (DOMCommitResult, error)

CommitRegionText applies one set-text operation to a region-local node.

type DiagnosticDowngradePath

type DiagnosticDowngradePath string

DiagnosticDowngradePath identifies one transport path that can downgrade.

const (
	DiagnosticDowngradePathSharedMemory DiagnosticDowngradePath = "shared-memory"
	DiagnosticDowngradePathBinary       DiagnosticDowngradePath = "binary"
)

func ParseDiagnosticDowngradePath

func ParseDiagnosticDowngradePath(parseRaw string) (DiagnosticDowngradePath, error)

ParseDiagnosticDowngradePath validates one downgrade path identifier.

type DiagnosticDowngradeReason

type DiagnosticDowngradeReason struct {
	Path   DiagnosticDowngradePath `json:"path,omitempty"`
	Reason string                  `json:"reason,omitempty"`
}

DiagnosticDowngradeReason stores structured downgrade diagnostics for binary and shared-memory fallback paths.

type DiagnosticEventKind

type DiagnosticEventKind string

DiagnosticEventKind identifies one stable runtime2 lifecycle diagnostic event kind.

const (
	// DiagnosticEventKindMount identifies one mount lifecycle diagnostic.
	DiagnosticEventKindMount DiagnosticEventKind = "mount"
	// DiagnosticEventKindUpdate identifies one update lifecycle diagnostic.
	DiagnosticEventKindUpdate DiagnosticEventKind = "update"
	// DiagnosticEventKindCancel identifies one cancel lifecycle diagnostic.
	DiagnosticEventKindCancel DiagnosticEventKind = "cancel"
	// DiagnosticEventKindDispose identifies one dispose lifecycle diagnostic.
	DiagnosticEventKindDispose DiagnosticEventKind = "dispose"
	// DiagnosticEventKindRestart identifies one restart lifecycle diagnostic.
	DiagnosticEventKindRestart DiagnosticEventKind = "restart"
	// DiagnosticEventKindPatchReady identifies one patch-ready lifecycle diagnostic.
	DiagnosticEventKindPatchReady DiagnosticEventKind = "patch-ready"
	// DiagnosticEventKindFallback identifies one fallback lifecycle diagnostic.
	DiagnosticEventKindFallback DiagnosticEventKind = "fallback"
	// DiagnosticEventKindRepair identifies one repair lifecycle diagnostic.
	DiagnosticEventKindRepair DiagnosticEventKind = "repair"
)

func GetDiagnosticEventKinds

func GetDiagnosticEventKinds() []DiagnosticEventKind

GetDiagnosticEventKinds returns the stable lifecycle diagnostic event kinds in deterministic order.

func ParseDiagnosticEventKind

func ParseDiagnosticEventKind(parseRaw string) (DiagnosticEventKind, error)

ParseDiagnosticEventKind validates one raw diagnostic event kind value.

type DiagnosticFallbackReason

type DiagnosticFallbackReason struct {
	Domain string `json:"domain,omitempty"`
	Reason string `json:"reason,omitempty"`
}

DiagnosticFallbackReason stores structured fallback diagnostics aligned with recovery-layer reason domains.

type DiagnosticSizeMetrics

type DiagnosticSizeMetrics struct {
	SnapshotBytes   uint64 `json:"snapshot_bytes,omitempty"`
	IRBytes         uint64 `json:"ir_bytes,omitempty"`
	PatchBytes      uint64 `json:"patch_bytes,omitempty"`
	SharedPageBytes uint64 `json:"shared_page_bytes,omitempty"`
}

DiagnosticSizeMetrics stores structured size diagnostics for one worker-backed lifecycle event.

type DiagnosticTimingMetrics

type DiagnosticTimingMetrics struct {
	QueueNanos     uint64 `json:"queue_ns,omitempty"`
	RenderNanos    uint64 `json:"render_ns,omitempty"`
	DiffNanos      uint64 `json:"diff_ns,omitempty"`
	EncodeNanos    uint64 `json:"encode_ns,omitempty"`
	TransportNanos uint64 `json:"transport_ns,omitempty"`
	CommitNanos    uint64 `json:"commit_ns,omitempty"`
}

DiagnosticTimingMetrics stores structured timing diagnostics for one worker-backed lifecycle event.

type DiagnosticTraceMetadata

type DiagnosticTraceMetadata struct {
	IsDebug            bool   `json:"is_debug,omitempty"`
	TraceID            string `json:"trace_id,omitempty"`
	SchedulerAttemptID uint64 `json:"scheduler_attempt_id,omitempty"`
	WorkerAttemptID    uint64 `json:"worker_attempt_id,omitempty"`
	CommitAttemptID    uint64 `json:"commit_attempt_id,omitempty"`
}

DiagnosticTraceMetadata stores debug-only trace IDs that correlate scheduler, worker, and commit attempts.

type EventSlotDispatch

type EventSlotDispatch struct {
	SlotID    string `json:"slot_id,omitempty"`
	EventType string `json:"event_type,omitempty"`
	Payload   any    `json:"payload,omitempty"`
}

EventSlotDispatch stores one semantic event dispatch for one declared event slot.

type EventSlotMetadata

type EventSlotMetadata struct {
	Version EventSlotMetadataVersion `json:"version,omitempty"`
	Slots   []EventSlotRecord        `json:"slots,omitempty"`
}

EventSlotMetadata stores optional event-slot metadata for renderer capability declarations.

func ParseEventSlotMetadataJSON

func ParseEventSlotMetadataJSON(parsePayload []byte) (EventSlotMetadata, error)

ParseEventSlotMetadataJSON decodes one validated event-slot metadata payload.

func ParseEventSlotMetadataPlaceholderJSON

func ParseEventSlotMetadataPlaceholderJSON(parsePayload []byte) (EventSlotMetadata, error)

ParseEventSlotMetadataPlaceholderJSON decodes one event-slot metadata payload through the legacy placeholder helper name.

type EventSlotMetadataVersion

type EventSlotMetadataVersion string

EventSlotMetadataVersion identifies one event-slot metadata schema version.

const (
	// EventSlotMetadataVersionV1 identifies the current event-slot metadata schema.
	EventSlotMetadataVersionV1 EventSlotMetadataVersion = "gwc.parallel.event-slot.v1"
	// EventSlotMetadataVersionPlaceholderV1 is the legacy placeholder schema identifier accepted on decode and normalized to v1.
	EventSlotMetadataVersionPlaceholderV1 EventSlotMetadataVersion = "gwc.parallel.event-slot.placeholder.v1"
)

type EventSlotRecord

type EventSlotRecord struct {
	SlotID    string `json:"slot_id,omitempty"`
	EventType string `json:"event_type,omitempty"`
}

EventSlotRecord stores one event-slot declaration.

type HostControlDispatchResult

type HostControlDispatchResult struct {
	HasPatchReadyResult bool
	HasDiagnosticResult bool
	HasRestartResult    bool
	HasPongResult       bool

	GetPatchReadyResult  HostRegionPatchReadyResult
	GetDiagnosticType    DiagnosticEventKind
	HasDiagnosticIgnored bool
	GetDiagnosticIgnore  string
	GetDiagnostic        ControlEnvelope
	GetRestartEpoch      uint64
	GetPongShardID       SchedulerShardID
	GetPongSequence      uint64
}

HostControlDispatchResult reports one host-side control-envelope dispatch outcome.

func HandleHostControlEnvelope

func HandleHostControlEnvelope(
	parseHostRegionAdapter *HostRegionAdapter,
	parseEnvelope ControlEnvelope,
) (HostControlDispatchResult, error)

HandleHostControlEnvelope validates and routes one host-side control envelope.

type HostPatchConsumeResult

type HostPatchConsumeResult struct {
	GetTransportTier TransportTier
	GetPatchStream   PatchStreamRaw
	GetCommitResult  HostRegionWorkerOutputResult
}

HostPatchConsumeResult reports one decoded patch payload and host-side commit outcome.

type HostRegionAdapter

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

HostRegionAdapter owns host-side runtime2 handles for one live region instance.

func BuildHostRegionAdapter

func BuildHostRegionAdapter(parseRegionInstanceID RegionInstanceID, parseSchedulerShardIDs []SchedulerShardID) (*HostRegionAdapter, error)

func (*HostRegionAdapter) GetHostRegionCoordinator

func (parseHostRegionAdapter *HostRegionAdapter) GetHostRegionCoordinator() *Coordinator

GetHostRegionCoordinator reports the adapter-owned coordinator handle.

func (*HostRegionAdapter) GetHostRegionDOMIndex

func (parseHostRegionAdapter *HostRegionAdapter) GetHostRegionDOMIndex() *RegionDOMIndex

GetHostRegionDOMIndex reports the adapter-owned region DOM index handle.

func (*HostRegionAdapter) GetHostRegionDeferredInputVersion

func (parseHostRegionAdapter *HostRegionAdapter) GetHostRegionDeferredInputVersion() uint64

GetHostRegionDeferredInputVersion reports the currently queued deferred input version, or zero when no deferred update is queued.

func (*HostRegionAdapter) GetHostRegionDiagnosticRing

func (parseHostRegionAdapter *HostRegionAdapter) GetHostRegionDiagnosticRing() []ControlEnvelope

GetHostRegionDiagnosticRing reports the durable diagnostic envelope ring for the mounted region.

func (*HostRegionAdapter) GetHostRegionDiagnosticsSnapshot

func (parseHostRegionAdapter *HostRegionAdapter) GetHostRegionDiagnosticsSnapshot() (HostRegionDiagnosticsSnapshot, bool)

GetHostRegionDiagnosticsSnapshot reports one read-only diagnostics snapshot for the mounted region.

func (*HostRegionAdapter) GetHostRegionInstanceID

func (parseHostRegionAdapter *HostRegionAdapter) GetHostRegionInstanceID() RegionInstanceID

GetHostRegionInstanceID reports the adapter-owned region instance identity.

func (*HostRegionAdapter) GetHostRegionIsFallbackActive

func (parseHostRegionAdapter *HostRegionAdapter) GetHostRegionIsFallbackActive() bool

GetHostRegionIsFallbackActive reports whether fallback ownership is currently active.

func (*HostRegionAdapter) GetHostRegionIsFallbackPending

func (parseHostRegionAdapter *HostRegionAdapter) GetHostRegionIsFallbackPending() bool

GetHostRegionIsFallbackPending reports whether fallback ownership handoff has started but not yet mirrored.

func (*HostRegionAdapter) GetHostRegionIsHydrationComplete

func (parseHostRegionAdapter *HostRegionAdapter) GetHostRegionIsHydrationComplete() bool

GetHostRegionIsHydrationComplete reports whether hydration has completed for the region.

func (*HostRegionAdapter) GetHostRegionIsRepairPending

func (parseHostRegionAdapter *HostRegionAdapter) GetHostRegionIsRepairPending() bool

GetHostRegionIsRepairPending reports whether repair remount is currently pending.

func (*HostRegionAdapter) GetHostRegionLatestValidVersion

func (parseHostRegionAdapter *HostRegionAdapter) GetHostRegionLatestValidVersion() uint64

GetHostRegionLatestValidVersion reports the highest valid host-side input version observed.

func (*HostRegionAdapter) GetHostRegionRecoveryCoordinator

func (parseHostRegionAdapter *HostRegionAdapter) GetHostRegionRecoveryCoordinator() *RecoveryCoordinator

GetHostRegionRecoveryCoordinator reports the adapter-owned recovery coordinator handle.

func (*HostRegionAdapter) GetHostRegionRepairRemountEpoch

func (parseHostRegionAdapter *HostRegionAdapter) GetHostRegionRepairRemountEpoch() uint64

GetHostRegionRepairRemountEpoch reports the pending repair remount epoch floor.

func (*HostRegionAdapter) GetHostRegionRepairVersionFloor

func (parseHostRegionAdapter *HostRegionAdapter) GetHostRegionRepairVersionFloor() uint64

GetHostRegionRepairVersionFloor reports the pending repair version floor.

func (*HostRegionAdapter) GetHostRegionRoundTripTiming

func (parseHostRegionAdapter *HostRegionAdapter) GetHostRegionRoundTripTiming() HostRegionRoundTripTiming

GetHostRegionRoundTripTiming reports dispatch-to-patch-ready and dispatch-to-commit timing spans.

func (*HostRegionAdapter) GetHostRegionRuntimeStatus

func (parseHostRegionAdapter *HostRegionAdapter) GetHostRegionRuntimeStatus() (HostRegionRuntimeStatus, bool)

GetHostRegionRuntimeStatus reports one host region runtime status snapshot for observability.

func (*HostRegionAdapter) GetHostRegionScheduler

func (parseHostRegionAdapter *HostRegionAdapter) GetHostRegionScheduler() *Scheduler

GetHostRegionScheduler reports the adapter-owned scheduler handle.

func (*HostRegionAdapter) GetHostRegionTransportDowngradeStatus

func (parseHostRegionAdapter *HostRegionAdapter) GetHostRegionTransportDowngradeStatus() HostRegionTransportDowngradeStatus

GetHostRegionTransportDowngradeStatus reports separate snapshot and patch transport tiers plus latest downgrade metadata.

func (*HostRegionAdapter) HandleHostRegionBinaryDecodeFailure

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionBinaryDecodeFailure(parseInputVersion uint64) error

HandleHostRegionBinaryDecodeFailure routes one binary decode failure through recovery.

func (*HostRegionAdapter) HandleHostRegionDOMPatchTransactionFailure

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionDOMPatchTransactionFailure(
	parseFailureKind DOMCommitFailureKind,
	parseInputVersion uint64,
) error

HandleHostRegionDOMPatchTransactionFailure routes one DOM patch-transaction failure through recovery.

func (*HostRegionAdapter) HandleHostRegionDeclaredSourceLookup

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionDeclaredSourceLookup(parseSourceIDs []string) (HostRegionSourceSnapshot, error)

HandleHostRegionDeclaredSourceLookup resolves canonical declared source IDs through the configured host source lookup bridge.

func (*HostRegionAdapter) HandleHostRegionDiagnosticEnvelope

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionDiagnosticEnvelope(parseEnvelope ControlEnvelope) (HostRegionDiagnosticResult, error)

func (*HostRegionAdapter) HandleHostRegionDispose

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionDispose() (HostRegionDisposeResult, error)

HandleHostRegionDispose disposes one mounted host region from coordinator, scheduler, and DOM-index state.

func (*HostRegionAdapter) HandleHostRegionFallbackMirror

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionFallbackMirror() (HostRegionFallbackMirrorResult, error)

HandleHostRegionFallbackMirror mirrors recovery fallback ownership into coordinator and scheduler state.

func (*HostRegionAdapter) HandleHostRegionFallbackOwnershipBegin

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionFallbackOwnershipBegin() (HostRegionFallbackMirrorResult, error)

HandleHostRegionFallbackOwnershipBegin mirrors recovery fallback ownership into coordinator and scheduler state.

func (*HostRegionAdapter) HandleHostRegionHydrationComplete

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionHydrationComplete() error

HandleHostRegionHydrationComplete marks one mounted host region as hydration-complete.

func (*HostRegionAdapter) HandleHostRegionMount

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionMount(parseSpec ParallelRegionSpec, parseEpoch uint64) (HostRegionMountResult, error)

HandleHostRegionMount validates one parallel region spec and mounts scheduler plus coordinator ownership for the adapter region.

func (*HostRegionAdapter) HandleHostRegionOwnerInvalidate

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionOwnerInvalidate() (HostRegionOwnerInvalidateResult, error)

HandleHostRegionOwnerInvalidate clears queued region work after owner-side invalidation.

func (*HostRegionAdapter) HandleHostRegionOwnerRemove

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionOwnerRemove() (HostRegionOwnerRemoveResult, error)

HandleHostRegionOwnerRemove disposes one mounted region and suppresses late worker output.

func (*HostRegionAdapter) HandleHostRegionOwnerRerender

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionOwnerRerender(parseInputVersion uint64) error

HandleHostRegionOwnerRerender records owner-rerender committed precedence for one mounted region.

func (*HostRegionAdapter) HandleHostRegionPatchCommit

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionPatchCommit(parsePatch PatchStreamRaw, parseDOMCommitter *DOMCommitter) (HostRegionWorkerOutputResult, error)

HandleHostRegionPatchCommit parses and commits one typed patch stream into DOM transaction boundaries.

func (*HostRegionAdapter) HandleHostRegionPatchConsume

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionPatchConsume(
	parseTransportTier TransportTier,
	parsePayload []byte,
	parseSharedPatchPage *SharedPatchPage,
	parseDOMCommitter *DOMCommitter,
) (HostPatchConsumeResult, error)

HandleHostRegionPatchConsume decodes one transport-tier patch payload and commits it through host patch orchestration.

func (*HostRegionAdapter) HandleHostRegionPatchReady

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionPatchReady(parseInputVersion uint64) (HostRegionPatchReadyResult, error)

HandleHostRegionPatchReady validates one patch-ready version against fallback and repair ownership gates.

func (*HostRegionAdapter) HandleHostRegionPatchReadyWithVersion

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionPatchReadyWithVersion(parsePatchVersion uint64, parseInputVersion uint64) (HostRegionPatchReadyResult, error)

HandleHostRegionPatchReadyWithVersion validates one patch-ready patch and input version pair against fallback and repair ownership gates.

func (*HostRegionAdapter) HandleHostRegionPostHydrationAttach

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionPostHydrationAttach() (HostRegionHydrationAttachResult, error)

HandleHostRegionPostHydrationAttach enables worker attach only after hydration completes for one mounted region.

func (*HostRegionAdapter) HandleHostRegionPostRenderAttach

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionPostRenderAttach() error

HandleHostRegionPostRenderAttach enables worker attach after client render without hydration-complete requirements.

func (*HostRegionAdapter) HandleHostRegionRegisterHydratedShellAnchor

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionRegisterHydratedShellAnchor(parseNodeID uint64, parseTag string) error

HandleHostRegionRegisterHydratedShellAnchor registers one hydrated shell anchor into the region DOM index.

func (*HostRegionAdapter) HandleHostRegionRepairRemount

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionRepairRemount(parseSpec ParallelRegionSpec) (HostRegionRepairRemountResult, error)

HandleHostRegionRepairRemount applies one healthy remount handshake and clears fallback ownership.

func (*HostRegionAdapter) HandleHostRegionSharedPageDecodeFailure

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionSharedPageDecodeFailure(parseInputVersion uint64) error

HandleHostRegionSharedPageDecodeFailure routes one shared-page decode failure through recovery.

func (*HostRegionAdapter) HandleHostRegionShellIdentityMismatchDetection

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionShellIdentityMismatchDetection(parseMarker SSRShellMarker) (HostRegionShellIdentityMismatchResult, error)

HandleHostRegionShellIdentityMismatchDetection detects region-ID and renderer-ID mismatches for one hydrated shell marker.

func (*HostRegionAdapter) HandleHostRegionShellMismatchFallback

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionShellMismatchFallback(parseInputVersion uint64) (HostRegionShellMismatchFallbackResult, error)

HandleHostRegionShellMismatchFallback enters local fallback ownership after hydration shell identity or anchor mismatch.

func (*HostRegionAdapter) HandleHostRegionShellMissingAnchorDetection

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionShellMissingAnchorDetection() (HostRegionShellAnchorCheckResult, error)

HandleHostRegionShellMissingAnchorDetection reports whether one mounted region is missing hydrated shell anchor registration.

func (*HostRegionAdapter) HandleHostRegionSnapshotFingerprint

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionSnapshotFingerprint(parseSnapshotEnvelope SnapshotEnvelope) (HostRegionSnapshotFingerprintResult, error)

HandleHostRegionSnapshotFingerprint computes and stores one stable snapshot fingerprint for host-side no-change detection.

func (*HostRegionAdapter) HandleHostRegionStructuralRemount

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionStructuralRemount(
	parseSpec ParallelRegionSpec,
	parseIsLocalShellOwned bool,
) (HostRegionStructuralRemountResult, error)

func (*HostRegionAdapter) HandleHostRegionStructuredCloneDecodeFailure

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionStructuredCloneDecodeFailure(parseInputVersion uint64) error

HandleHostRegionStructuredCloneDecodeFailure routes one structured-clone decode failure through recovery.

func (*HostRegionAdapter) HandleHostRegionUpdate

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionUpdate(parseInputVersion uint64) (HostRegionUpdateResult, error)

HandleHostRegionUpdate dispatches one mounted region update through scheduler and coordinator version tracking.

func (*HostRegionAdapter) HandleHostRegionUpdateDispatch

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionUpdateDispatch(parseSpec ParallelRegionSpec, parseInputVersion uint64) (HostRegionUpdateDispatchResult, error)

func (*HostRegionAdapter) HandleHostRegionUpdateDispatchWithPriority

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionUpdateDispatchWithPriority(
	parseSpec ParallelRegionSpec,
	parseInputVersion uint64,
	parseDispatchPriority HostRegionDispatchPriority,
) (HostRegionUpdateDispatchResult, error)

HandleHostRegionUpdateDispatchWithPriority captures one update snapshot and dispatches using the requested host update priority classification. External callers may pass any HostRegionDispatchPriority value; validation runs before delegating to the inner dispatch path.

func (*HostRegionAdapter) HandleHostRegionUpdateDispatchWithTransition

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionUpdateDispatchWithTransition(
	parseSpec ParallelRegionSpec,
	parseInputVersion uint64,
	parseIsTransition bool,
) (HostRegionUpdateDispatchResult, error)

HandleHostRegionUpdateDispatchWithTransition captures one update snapshot and maps transition updates onto deferred dispatch priority. It routes directly to the inner dispatch path with a known-valid priority to avoid ParseHostRegionDispatchPriority overhead on every call.

func (*HostRegionAdapter) HandleHostRegionUpdateDispatchWithTransport

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionUpdateDispatchWithTransport(
	parseSpec ParallelRegionSpec,
	parseInputVersion uint64,
	parseCapabilityReport CapabilityReport,
	parseSharedSnapshotPage *SharedSnapshotPage,
) (HostRegionUpdateDispatchTransportResult, error)

HandleHostRegionUpdateDispatchWithTransport captures one update snapshot, dispatches host scheduling, and selects snapshot transport for scheduled updates.

func (*HostRegionAdapter) HandleHostRegionUpdateDispatchWithTransportPriority

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionUpdateDispatchWithTransportPriority(
	parseSpec ParallelRegionSpec,
	parseInputVersion uint64,
	parseDispatchPriority HostRegionDispatchPriority,
	parseCapabilityReport CapabilityReport,
	parseSharedSnapshotPage *SharedSnapshotPage,
) (HostRegionUpdateDispatchTransportResult, error)

HandleHostRegionUpdateDispatchWithTransportPriority captures one update snapshot, dispatches with explicit priority, and selects snapshot transport for scheduled updates.

func (*HostRegionAdapter) HandleHostRegionUpdateSnapshot

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionUpdateSnapshot(parseSpec ParallelRegionSpec, parseInputVersion uint64) (SnapshotEnvelope, error)

HandleHostRegionUpdateSnapshot captures one update snapshot envelope from normalized props plus declared source lookup.

func (*HostRegionAdapter) HandleHostRegionWorkerDeath

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionWorkerDeath(parseHasReassignSupport bool) (HostRegionWorkerDeathResult, error)

HandleHostRegionWorkerDeath routes dead-worker handling into recovery and sets repair or fallback host ownership state.

func (*HostRegionAdapter) HandleHostRegionWorkerOutput

func (parseHostRegionAdapter *HostRegionAdapter) HandleHostRegionWorkerOutput(parseInputVersion uint64) (HostRegionWorkerOutputResult, error)

HandleHostRegionWorkerOutput applies one worker output commit attempt under owner-rerender precedence rules.

func (*HostRegionAdapter) HasHostRegionHydratedShellAnchor

func (parseHostRegionAdapter *HostRegionAdapter) HasHostRegionHydratedShellAnchor() bool

HasHostRegionHydratedShellAnchor reports whether one hydrated shell anchor has been registered.

func (*HostRegionAdapter) HasHostRegionPostHydrationAttached

func (parseHostRegionAdapter *HostRegionAdapter) HasHostRegionPostHydrationAttached() bool

HasHostRegionPostHydrationAttached reports whether post-hydration worker attach has been enabled.

func (*HostRegionAdapter) IsHostRegionLocalShellOwnership

func (parseHostRegionAdapter *HostRegionAdapter) IsHostRegionLocalShellOwnership() bool

IsHostRegionLocalShellOwnership reports whether the adapter currently marks the region shell as locally owned.

func (*HostRegionAdapter) SetHostRegionPatchTransportTier

func (parseHostRegionAdapter *HostRegionAdapter) SetHostRegionPatchTransportTier(parseTransportTier TransportTier) error

SetHostRegionPatchTransportTier stores one latest patch transport tier selected by worker patch-ready signaling.

func (*HostRegionAdapter) SetHostRegionRoundTripTimingEnabled

func (parseHostRegionAdapter *HostRegionAdapter) SetHostRegionRoundTripTimingEnabled(parseIsEnabled bool)

SetHostRegionRoundTripTimingEnabled enables or disables dispatch-to-patch-ready and commit timing capture for one host region adapter.

func (*HostRegionAdapter) SetHostRegionSourceLookup

func (parseHostRegionAdapter *HostRegionAdapter) SetHostRegionSourceLookup(parseSourceLookup HostRegionSourceLookup) error

SetHostRegionSourceLookup sets the host-side bridge used to look up declared source values and versions.

type HostRegionDiagnosticResult

type HostRegionDiagnosticResult struct {
	HasStored        bool
	HasIgnored       bool
	GetIgnoreReason  string
	GetDiagnostic    ControlEnvelope
	GetDiagnosticLen int
}

HostRegionDiagnosticResult reports whether one worker diagnostic was stored or ignored.

type HostRegionDiagnosticsSnapshot

type HostRegionDiagnosticsSnapshot struct {
	GetRegionInstanceID            RegionInstanceID
	GetDiagnosticEvents            []ControlEnvelope
	GetTransportDowngradeStatus    HostRegionTransportDowngradeStatus
	GetDroppedStalePatchCount      uint64
	GetIgnoredStaleDiagnosticCount uint64
	GetRepairTriggeredRemountCount uint64
}

HostRegionDiagnosticsSnapshot reports one read-only host diagnostics snapshot for redacted events, downgrade accounting, and counters.

type HostRegionDispatchPriority

type HostRegionDispatchPriority string

HostRegionDispatchPriority identifies runtime2 host update dispatch priority classification.

const (
	// HostRegionDispatchPriorityUrgent marks an update that should dispatch immediately.
	HostRegionDispatchPriorityUrgent HostRegionDispatchPriority = "urgent"
	// HostRegionDispatchPriorityDeferred marks an update that may dispatch later under deferred policy.
	HostRegionDispatchPriorityDeferred HostRegionDispatchPriority = "deferred"
)

func ParseHostRegionDispatchPriority

func ParseHostRegionDispatchPriority(parsePriority HostRegionDispatchPriority) (HostRegionDispatchPriority, error)

ParseHostRegionDispatchPriority validates one host update dispatch priority value.

type HostRegionDisposeResult

type HostRegionDisposeResult struct {
	HasCoordinatorDisposed bool
	HasSchedulerDisposed   bool
	GetClearedDOMNodeCount int
}

HostRegionDisposeResult reports host-side dispose outputs for one mounted region.

type HostRegionFallbackMirrorResult

type HostRegionFallbackMirrorResult struct {
	HasCoordinatorFallback bool
	HasSchedulerFallback   bool
}

HostRegionFallbackMirrorResult reports fallback mirroring into coordinator and scheduler state.

type HostRegionHydrationAttachHelper

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

HostRegionHydrationAttachHelper exposes a narrow host-side hydration attach surface without exposing mutable adapter internals.

func BuildHostRegionHydrationAttachHelper

func BuildHostRegionHydrationAttachHelper(parseHostRegionAdapter *HostRegionAdapter) (HostRegionHydrationAttachHelper, error)

BuildHostRegionHydrationAttachHelper builds one hydration helper from one mounted host region adapter.

func (HostRegionHydrationAttachHelper) GetHostRegionInstanceID

func (parseHostRegionHydrationAttachHelper HostRegionHydrationAttachHelper) GetHostRegionInstanceID() RegionInstanceID

GetHostRegionInstanceID reports the helper-owned host region instance ID.

func (HostRegionHydrationAttachHelper) GetHostRegionIsHydrationComplete

func (parseHostRegionHydrationAttachHelper HostRegionHydrationAttachHelper) GetHostRegionIsHydrationComplete() bool

GetHostRegionIsHydrationComplete reports hydration completion from helper-owned adapter state.

func (HostRegionHydrationAttachHelper) HandleHostRegionHydrationComplete

func (parseHostRegionHydrationAttachHelper HostRegionHydrationAttachHelper) HandleHostRegionHydrationComplete() error

HandleHostRegionHydrationComplete marks hydration complete through the helper-owned adapter.

func (HostRegionHydrationAttachHelper) HandleHostRegionPostHydrationAttach

func (parseHostRegionHydrationAttachHelper HostRegionHydrationAttachHelper) HandleHostRegionPostHydrationAttach() (HostRegionHydrationAttachResult, error)

HandleHostRegionPostHydrationAttach performs post-hydration attach through the helper-owned adapter.

func (HostRegionHydrationAttachHelper) HandleHostRegionRegisterHydratedShellAnchor

func (parseHostRegionHydrationAttachHelper HostRegionHydrationAttachHelper) HandleHostRegionRegisterHydratedShellAnchor(parseNodeID uint64, parseTag string) error

HandleHostRegionRegisterHydratedShellAnchor registers one hydrated shell anchor through the helper-owned adapter.

func (HostRegionHydrationAttachHelper) HasHostRegionPostHydrationAttached

func (parseHostRegionHydrationAttachHelper HostRegionHydrationAttachHelper) HasHostRegionPostHydrationAttached() bool

HasHostRegionPostHydrationAttached reports post-hydration attach status from helper-owned adapter state.

type HostRegionHydrationAttachResult

type HostRegionHydrationAttachResult struct {
	HasAttached bool
	HasBlocked  bool
}

HostRegionHydrationAttachResult reports post-hydration worker attach handling outcomes.

type HostRegionMountResult

type HostRegionMountResult struct {
	GetSchedulerJob     SchedulerJob
	GetCoordinatorEntry CoordinatorEntry
}

HostRegionMountResult reports host-side mount outputs for one region mount attempt.

type HostRegionOwnerInvalidateResult

type HostRegionOwnerInvalidateResult struct {
	HasSchedulerCanceled bool
	HasDeferredCleared   bool
}

HostRegionOwnerInvalidateResult reports cleanup actions applied after owner-side invalidation.

type HostRegionOwnerRemoveResult

type HostRegionOwnerRemoveResult struct {
	HasDisposed                   bool
	HasLateWorkerOutputSuppressed bool
}

HostRegionOwnerRemoveResult reports owner-removal handling for one mounted region.

type HostRegionPatchReadyResult

type HostRegionPatchReadyResult struct {
	HasAccepted     bool
	HasIgnored      bool
	GetIgnoreReason string
}

HostRegionPatchReadyResult reports whether one patch-ready result may continue to commit processing.

type HostRegionRepairRemountResult

type HostRegionRepairRemountResult struct {
	HasRemounted       bool
	HasFallbackCleared bool
	GetRemountEpoch    uint64
	GetVersionFloor    uint64
}

HostRegionRepairRemountResult reports repair-driven remount handshake outcomes.

type HostRegionRoundTripTiming

type HostRegionRoundTripTiming struct {
	GetDispatchToPatchReadyNS uint64
	GetDispatchToCommitNS     uint64
	GetPatchReadyToCommitNS   uint64
}

HostRegionRoundTripTiming reports dispatch, patch-ready, and commit timing spans for one region.

type HostRegionRuntimeMode

type HostRegionRuntimeMode string

HostRegionRuntimeMode identifies one runtime-status ownership mode for a host region.

const (
	// HostRegionRuntimeModeLocalShell reports local-shell ownership before worker attach.
	HostRegionRuntimeModeLocalShell HostRegionRuntimeMode = "local-shell"
	// HostRegionRuntimeModeWorkerAttached reports active worker-backed attach.
	HostRegionRuntimeModeWorkerAttached HostRegionRuntimeMode = "worker-attached"
	// HostRegionRuntimeModeFallback reports locally-owned fallback mode.
	HostRegionRuntimeModeFallback HostRegionRuntimeMode = "fallback"
)

type HostRegionRuntimeStatus

type HostRegionRuntimeStatus struct {
	GetRegionInstanceID            RegionInstanceID
	GetRegionMode                  HostRegionRuntimeMode
	GetAssignedWorkerShard         string
	GetRendererID                  RendererID
	GetEpoch                       uint64
	GetIsHydrationComplete         bool
	HasHydratedShellAnchor         bool
	HasPostHydrationAttached       bool
	GetLastSnapshotVersion         uint64
	GetLastDispatchedVersion       uint64
	GetLastCommittedVersion        uint64
	GetTransportTier               TransportTier
	HasSnapshotDowngrade           bool
	GetSnapshotDowngradePath       DiagnosticDowngradePath
	GetSnapshotDowngradeReason     string
	HasPatchDowngrade              bool
	GetPatchDowngradePath          DiagnosticDowngradePath
	GetPatchDowngradeReason        string
	GetDroppedStalePatchCount      uint64
	GetIgnoredStaleDiagnosticCount uint64
	GetFallbackReason              string
}

HostRegionRuntimeStatus reports one host region runtime status snapshot for observability surfaces.

type HostRegionShellAnchorCheckResult

type HostRegionShellAnchorCheckResult struct {
	HasMissingAnchor bool
}

HostRegionShellAnchorCheckResult reports whether one hydrated shell anchor is missing for the mounted region.

type HostRegionShellIdentityMismatchResult

type HostRegionShellIdentityMismatchResult struct {
	HasMismatch           bool
	HasRegionIDMismatch   bool
	HasRendererIDMismatch bool
}

HostRegionShellIdentityMismatchResult reports shell-marker identity mismatches for region or renderer IDs.

type HostRegionShellMismatchFallbackResult

type HostRegionShellMismatchFallbackResult struct {
	HasFallbackEntered  bool
	HasOutputSuppressed bool
	GetRemountEpoch     uint64
	GetVersionFloor     uint64
}

HostRegionShellMismatchFallbackResult reports fallback ownership and remount-floor outcomes after shell mismatch.

type HostRegionSnapshotFingerprintResult

type HostRegionSnapshotFingerprintResult struct {
	GetSnapshotFingerprint string
	HasNoChange            bool
}

HostRegionSnapshotFingerprintResult reports one snapshot fingerprint decision for no-change detection.

type HostRegionSourceLookup

type HostRegionSourceLookup func(parseSourceIDs []string) (map[string]any, map[string]uint64, error)

HostRegionSourceLookup resolves declared source values and versions from shipped runtime state.

type HostRegionSourceSnapshot

type HostRegionSourceSnapshot struct {
	GetSourceValues   map[string]any
	GetSourceVersions map[string]uint64
	GetSourceVersion  uint64
}

HostRegionSourceSnapshot stores source values and source versions returned by host-side source lookup.

type HostRegionStructuralRemountResult

type HostRegionStructuralRemountResult struct {
	HasRendererChanged       bool
	HasShellOwnershipChanged bool
	HasRemounted             bool
	GetRemountEpoch          uint64
}

HostRegionStructuralRemountResult reports renderer or shell-ownership changes and remount decisions.

type HostRegionTransportDowngradeStatus

type HostRegionTransportDowngradeStatus struct {
	GetSnapshotTransportTier TransportTier
	HasSnapshotDowngrade     bool
	GetSnapshotDowngrade     DiagnosticDowngradeReason
	GetPatchTransportTier    TransportTier
	HasPatchDowngrade        bool
	GetPatchDowngrade        DiagnosticDowngradeReason
}

HostRegionTransportDowngradeStatus reports separate snapshot and patch transport downgrade accounting for one region.

type HostRegionUpdateDispatchResult

type HostRegionUpdateDispatchResult struct {
	HasScheduled           bool
	HasNoChange            bool
	HasDeferredQueued      bool
	HasDeferredSuperseded  bool
	HasDeferredCanceled    bool
	GetDispatchPriority    HostRegionDispatchPriority
	GetSchedulerJob        SchedulerJob
	GetSnapshotEnvelope    SnapshotEnvelope
	GetSnapshotFingerprint string
}

HostRegionUpdateDispatchResult reports one host-side update dispatch decision including short-circuit behavior.

type HostRegionUpdateDispatchTransportResult

type HostRegionUpdateDispatchTransportResult struct {
	GetDispatchResult          HostRegionUpdateDispatchResult
	HasSnapshotTransport       bool
	GetSnapshotTransportResult SharedSnapshotTransportResult
}

HostRegionUpdateDispatchTransportResult reports one host update-dispatch result plus selected snapshot transport metadata.

type HostRegionUpdateResult

type HostRegionUpdateResult struct {
	GetSchedulerJob      SchedulerJob
	GetDispatchedVersion uint64
}

HostRegionUpdateResult reports host-side update outputs for one region update dispatch.

type HostRegionWorkerDeathResult

type HostRegionWorkerDeathResult struct {
	HasReassigned      bool
	HasFallbackEntered bool
	IsRepairPending    bool
	GetRemountEpoch    uint64
	GetVersionFloor    uint64
}

HostRegionWorkerDeathResult reports host-side worker death handling outcomes.

type HostRegionWorkerOutputResult

type HostRegionWorkerOutputResult struct {
	HasCommitted bool
	HasIgnored   bool
}

HostRegionWorkerOutputResult reports whether one worker output attempt committed or was ignored.

type HostWorkerRegionUpdateOrchestrationResult

type HostWorkerRegionUpdateOrchestrationResult struct {
	GetDispatchResult     HostRegionUpdateDispatchTransportResult
	GetWorkerUpdateResult WorkerPatchTransportResult
	HasPatchCommitted     bool
	GetPatchConsumeResult HostPatchConsumeResult
}

HostWorkerRegionUpdateOrchestrationResult reports one end-to-end host-worker region update orchestration attempt.

func HandleHostWorkerRegionUpdateOrchestration

func HandleHostWorkerRegionUpdateOrchestration(
	parseHostRegionAdapter *HostRegionAdapter,
	parseWorkerRegionRuntime *WorkerRegionRuntime,
	parseSpec ParallelRegionSpec,
	parseInputVersion uint64,
	parseCapabilityReport CapabilityReport,
	parseSharedSnapshotPage *SharedSnapshotPage,
	parseSharedPatchPage *SharedPatchPage,
	parseDOMCommitter *DOMCommitter,
) (HostWorkerRegionUpdateOrchestrationResult, error)

HandleHostWorkerRegionUpdateOrchestration runs one end-to-end region update flow across host snapshot dispatch, worker update, patch transport, and host commit.

type ParallelRegionSpec

type ParallelRegionSpec struct {
	RendererID       RendererID
	RegionInstanceID RegionInstanceID
	Props            any
	SourceIDs        []string
}

ParallelRegionSpec stores the serializable public input contract for one parallel region instance.

func NormalizeParallelRegionSpec

func NormalizeParallelRegionSpec(parseSpec ParallelRegionSpec) (ParallelRegionSpec, error)

NormalizeParallelRegionSpec validates and canonicalizes a parallel region spec before dispatch.

type PatchIdempotencyTracker

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

PatchIdempotencyTracker tracks duplicate and conflicting patch identities per region.

func BuildPatchIdempotencyTracker

func BuildPatchIdempotencyTracker() *PatchIdempotencyTracker

BuildPatchIdempotencyTracker creates a patch idempotency tracker.

func (*PatchIdempotencyTracker) HandlePatchIdempotency

func (parseTracker *PatchIdempotencyTracker) HandlePatchIdempotency(parseRegionID string, parseEpoch uint64, parsePatchVersion uint64, parsePatchIdentity string) (bool, error)

HandlePatchIdempotency applies idempotency rules and reports whether a patch should be applied.

type PatchInsertOp

type PatchInsertOp struct {
	ParentNodeID uint64
	AnchorNodeID uint64
	Node         RenderNodeRecord
}

PatchInsertOp stores one validated insert patch op.

func ParsePatchInsertOp

func ParsePatchInsertOp(parseRaw PatchInsertOpRaw, parseKnownNodeIDs map[uint64]struct{}) (PatchInsertOp, error)

ParsePatchInsertOp decodes and validates one insert patch op payload.

type PatchInsertOpRaw

type PatchInsertOpRaw struct {
	ParentNodeID uint64
	AnchorNodeID uint64
	Node         RenderNodeRecordRaw
}

PatchInsertOpRaw stores the wire-format payload for one insert patch op.

type PatchKeyedMoveOp

type PatchKeyedMoveOp struct {
	ParentNodeID     uint64
	SourceNodeID     uint64
	DestinationIndex uint32
}

PatchKeyedMoveOp stores one validated keyed-move patch op.

func ParsePatchKeyedMoveOp

func ParsePatchKeyedMoveOp(parseRaw PatchKeyedMoveOpRaw, parseKnownNodeIDs map[uint64]struct{}, parseSiblingCountByParent map[uint64]uint32) (PatchKeyedMoveOp, error)

ParsePatchKeyedMoveOp decodes and validates one keyed-move patch op payload.

type PatchKeyedMoveOpRaw

type PatchKeyedMoveOpRaw struct {
	ParentNodeID     uint64
	SourceNodeID     uint64
	DestinationIndex uint32
}

PatchKeyedMoveOpRaw stores the wire-format payload for one keyed-move patch op.

type PatchOpCode

type PatchOpCode uint8

PatchOpCode identifies one patch operation type in a patch stream.

const (
	PatchOpCodeInsertNode PatchOpCode
	PatchOpCodeRemoveNode
	PatchOpCodeSetText
	PatchOpCodeSetAttr
	PatchOpCodeRemoveAttr
	PatchOpCodeSetStyle
	PatchOpCodeRemoveStyle
	PatchOpCodeMoveKeyedChild
	PatchOpCodeReplaceSubtree
)

func ParsePatchOpCode

func ParsePatchOpCode(parseRaw uint8) (PatchOpCode, error)

ParsePatchOpCode decodes and validates one raw patch op code.

type PatchOrderEntry

type PatchOrderEntry struct {
	OpCode       PatchOpCode
	NodeID       uint64
	ParentNodeID uint64
	SourceNodeID uint64
}

PatchOrderEntry stores the ordering-relevant fields for one patch operation.

type PatchRemoveAttrOp

type PatchRemoveAttrOp struct {
	TargetNodeID uint64
	Key          string
}

PatchRemoveAttrOp stores one validated remove-attr patch op.

func ParsePatchRemoveAttrOp

func ParsePatchRemoveAttrOp(parseRaw PatchRemoveAttrOpRaw, parseKnownNodeIDs map[uint64]struct{}, parseStringTable RenderStringTable, parseRemovedAttrKeys map[patchRemovedAttrKey]struct{}) (PatchRemoveAttrOp, error)

ParsePatchRemoveAttrOp decodes and validates one remove-attr patch op payload.

type PatchRemoveAttrOpRaw

type PatchRemoveAttrOpRaw struct {
	TargetNodeID uint64
	KeyRef       uint32
}

PatchRemoveAttrOpRaw stores the wire-format payload for one remove-attr patch op.

type PatchRemoveOp

type PatchRemoveOp struct {
	TargetNodeID uint64
}

PatchRemoveOp stores one validated remove patch op.

func ParsePatchRemoveOp

func ParsePatchRemoveOp(parseRaw PatchRemoveOpRaw, parseKnownNodeIDs map[uint64]struct{}, parseRemovedNodeIDs map[uint64]struct{}) (PatchRemoveOp, error)

ParsePatchRemoveOp decodes and validates one remove patch op payload.

type PatchRemoveOpRaw

type PatchRemoveOpRaw struct {
	TargetNodeID uint64
}

PatchRemoveOpRaw stores the wire-format payload for one remove patch op.

type PatchRemoveStyleOp

type PatchRemoveStyleOp struct {
	TargetNodeID uint64
}

PatchRemoveStyleOp stores one validated remove-style patch op.

func ParsePatchRemoveStyleOp

func ParsePatchRemoveStyleOp(parseRaw PatchRemoveStyleOpRaw, parseKnownNodeIDs map[uint64]struct{}) (PatchRemoveStyleOp, error)

ParsePatchRemoveStyleOp decodes and validates one remove-style patch op payload.

type PatchRemoveStyleOpRaw

type PatchRemoveStyleOpRaw struct {
	TargetNodeID uint64
}

PatchRemoveStyleOpRaw stores the wire-format payload for one remove-style patch op.

type PatchReplaceSubtreeOp

type PatchReplaceSubtreeOp struct {
	TargetNodeID uint64
	SubtreeIR    CanonicalRenderIR
}

PatchReplaceSubtreeOp stores one validated replace-subtree patch op.

func ParsePatchReplaceSubtreeOp

func ParsePatchReplaceSubtreeOp(parseRaw PatchReplaceSubtreeOpRaw, parseKnownNodeIDs map[uint64]struct{}) (PatchReplaceSubtreeOp, error)

ParsePatchReplaceSubtreeOp decodes and validates one replace-subtree patch op payload.

type PatchReplaceSubtreeOpRaw

type PatchReplaceSubtreeOpRaw struct {
	TargetNodeID uint64                        `json:"target_node_id"`
	Subtree      PatchReplaceSubtreePayloadRaw `json:"subtree"`
}

PatchReplaceSubtreeOpRaw stores the wire-format payload for one replace-subtree patch op.

type PatchReplaceSubtreePayloadRaw

type PatchReplaceSubtreePayloadRaw struct {
	RootNodeID  uint64                `json:"root_node_id"`
	StringTable []string              `json:"string_table,omitempty"`
	NodeRecords []RenderNodeRecordRaw `json:"node_records"`
	PropRecords []RenderPropRecordRaw `json:"prop_records,omitempty"`
}

PatchReplaceSubtreePayloadRaw stores one replacement-subtree payload in wire format.

type PatchSetAttrOp

type PatchSetAttrOp struct {
	TargetNodeID uint64
	Attr         RenderPropRecord
}

PatchSetAttrOp stores one validated set-attr patch op.

func ParsePatchSetAttrOp

func ParsePatchSetAttrOp(parseRaw PatchSetAttrOpRaw, parseKnownNodeIDs map[uint64]struct{}, parseStringTable RenderStringTable) (PatchSetAttrOp, error)

ParsePatchSetAttrOp decodes and validates one set-attr patch op payload.

type PatchSetAttrOpRaw

type PatchSetAttrOpRaw struct {
	TargetNodeID uint64
	Attr         RenderPropRecordRaw
}

PatchSetAttrOpRaw stores the wire-format payload for one set-attr patch op.

type PatchSetStyleOp

type PatchSetStyleOp struct {
	TargetNodeID uint64
	StyleValue   string
}

PatchSetStyleOp stores one validated set-style patch op.

func ParsePatchSetStyleOp

func ParsePatchSetStyleOp(parseRaw PatchSetStyleOpRaw, parseKnownNodeIDs map[uint64]struct{}, parseStringTable RenderStringTable) (PatchSetStyleOp, error)

ParsePatchSetStyleOp decodes and validates one set-style patch op payload.

type PatchSetStyleOpRaw

type PatchSetStyleOpRaw struct {
	TargetNodeID uint64
	StyleRef     uint32
}

PatchSetStyleOpRaw stores the wire-format payload for one set-style patch op.

type PatchSetTextOp

type PatchSetTextOp struct {
	TargetNodeID uint64
	Text         string
}

PatchSetTextOp stores one validated set-text patch op.

func ParsePatchSetTextOp

func ParsePatchSetTextOp(parseRaw PatchSetTextOpRaw, parseKnownNodeIDs map[uint64]struct{}, parseStringTable RenderStringTable) (PatchSetTextOp, error)

ParsePatchSetTextOp decodes and validates one set-text patch op payload.

type PatchSetTextOpRaw

type PatchSetTextOpRaw struct {
	TargetNodeID uint64
	TextRef      uint32
}

PatchSetTextOpRaw stores the wire-format payload for one set-text patch op.

type PatchStreamHeader

type PatchStreamHeader struct {
	ProtocolVersion string
	RegionID        string
	Epoch           uint64
	InputVersion    uint64
	PatchVersion    uint64
}

PatchStreamHeader stores one validated patch-stream header.

func ParsePatchStreamHeader

func ParsePatchStreamHeader(parseRaw PatchStreamHeaderRaw, parseExpectedRegionID string) (PatchStreamHeader, error)

ParsePatchStreamHeader decodes and validates one patch-stream header.

type PatchStreamHeaderRaw

type PatchStreamHeaderRaw struct {
	ProtocolVersion string
	RegionID        string
	Epoch           uint64
	InputVersion    uint64
	PatchVersion    uint64
}

PatchStreamHeaderRaw stores the wire-format header fields for one patch stream.

type PatchStreamOpRaw

type PatchStreamOpRaw struct {
	GetOpCode uint8 `json:"op_code"`

	GetInsertOp         *PatchInsertOpRaw         `json:"insert,omitempty"`
	GetRemoveOp         *PatchRemoveOpRaw         `json:"remove,omitempty"`
	GetSetTextOp        *PatchSetTextOpRaw        `json:"set_text,omitempty"`
	GetSetAttrOp        *PatchSetAttrOpRaw        `json:"set_attr,omitempty"`
	GetSetStyleOp       *PatchSetStyleOpRaw       `json:"set_style,omitempty"`
	GetRemoveAttrOp     *PatchRemoveAttrOpRaw     `json:"remove_attr,omitempty"`
	GetRemoveStyleOp    *PatchRemoveStyleOpRaw    `json:"remove_style,omitempty"`
	GetKeyedMoveOp      *PatchKeyedMoveOpRaw      `json:"move_keyed,omitempty"`
	GetReplaceSubtreeOp *PatchReplaceSubtreeOpRaw `json:"replace_subtree,omitempty"`
}

PatchStreamOpRaw stores one raw patch-op payload with exactly one typed payload body.

type PatchStreamParseResult

type PatchStreamParseResult struct {
	GetHeader      PatchStreamHeader
	GetTransaction RegionPatchTransaction
}

PatchStreamParseResult stores one parsed patch stream plus a commit transaction.

func ParsePatchStreamTransaction

func ParsePatchStreamTransaction(
	parseRaw PatchStreamRaw,
	parseExpectedRegionID string,
	parseExpectedEpoch uint64,
	parseKnownNodeIDs map[uint64]struct{},
	parseSiblingCountByParent map[uint64]uint32,
	parseTracker *PatchIdempotencyTracker,
) (PatchStreamParseResult, bool, error)

ParsePatchStreamTransaction decodes one patch stream, validates patch semantics and idempotency, and returns a commit transaction.

func ParsePatchStreamTransactionWithKeyedMoveHint

func ParsePatchStreamTransactionWithKeyedMoveHint(
	parseRaw PatchStreamRaw,
	parseExpectedRegionID string,
	parseExpectedEpoch uint64,
	parseKnownNodeIDs map[uint64]struct{},
	parseSiblingCountByParent map[uint64]uint32,
	parseTracker *PatchIdempotencyTracker,
	parseHasPatchKeyedMove bool,
) (PatchStreamParseResult, bool, error)

ParsePatchStreamTransactionWithKeyedMoveHint decodes one patch stream using one caller-supplied keyed-move presence hint.

type PatchStreamRaw

type PatchStreamRaw struct {
	GetHeader        PatchStreamHeaderRaw `json:"header"`
	GetStringTable   []string             `json:"string_table,omitempty"`
	GetOps           []PatchStreamOpRaw   `json:"ops,omitempty"`
	GetPatchIdentity string               `json:"patch_identity"`
}

PatchStreamRaw stores one raw patch stream payload for transport and commit parsing.

func BuildCanonicalPatchStream

func BuildCanonicalPatchStream(
	parseRegionID string,
	parseEpoch uint64,
	parseInputVersion uint64,
	parsePatchVersion uint64,
	parsePreviousIR CanonicalRenderIR,
	parseNextIR CanonicalRenderIR,
) (PatchStreamRaw, bool, error)

BuildCanonicalPatchStream diffs previous and next canonical IR and emits one canonical typed patch stream.

func BuildPatchStreamRaw

func BuildPatchStreamRaw(parseHeader PatchStreamHeaderRaw, parseStringTable RenderStringTable, parseOps []PatchStreamOpRaw) (PatchStreamRaw, error)

BuildPatchStreamRaw builds one typed patch stream and computes deterministic idempotency metadata.

func ParseBinaryPatchPayload

func ParseBinaryPatchPayload(parsePayload []byte) (PatchStreamRaw, error)

ParseBinaryPatchPayload decodes one runtime2 binary patch payload frame into a validated patch stream.

func ParseStructuredClonePatchPayloadJSON

func ParseStructuredClonePatchPayloadJSON(parsePayload []byte) (PatchStreamRaw, error)

ParseStructuredClonePatchPayloadJSON decodes one structured-clone patch payload into a validated patch stream.

type ProtocolVersion

type ProtocolVersion string

ProtocolVersion identifies the multithreaded runtime wire-contract version.

const (
	// ProtocolVersionParallelV1 is the first multithreaded runtime protocol version.
	ProtocolVersionParallelV1 ProtocolVersion = "gwc.parallel.v1"
)

func ParseProtocolVersion

func ParseProtocolVersion(parseRaw string) (ProtocolVersion, error)

ParseProtocolVersion validates and normalizes a protocol version string.

type RecoveryCoordinator

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

RecoveryCoordinator tracks region fallback ownership and worker-output suppression rules.

func BuildRecoveryCoordinator

func BuildRecoveryCoordinator() *RecoveryCoordinator

BuildRecoveryCoordinator creates an empty recovery coordinator.

func (*RecoveryCoordinator) ClearRegionLocalFallback

func (parseRecoveryCoordinator *RecoveryCoordinator) ClearRegionLocalFallback(parseRegionID string) bool

ClearRegionLocalFallback clears one region's local-fallback ownership marker.

func (*RecoveryCoordinator) EnterRegionLocalFallback

func (parseRecoveryCoordinator *RecoveryCoordinator) EnterRegionLocalFallback(parseRegionID string, parseReason string, parseEpoch uint64, parseInputVersion uint64)

EnterRegionLocalFallback marks one region as locally owned and records fallback metadata.

func (*RecoveryCoordinator) GetRegionFallbackState

func (parseRecoveryCoordinator *RecoveryCoordinator) GetRegionFallbackState(parseRegionID string) (RegionFallbackState, bool)

GetRegionFallbackState reports one region fallback state when recovery ownership metadata exists.

func (*RecoveryCoordinator) GetRegionLocalVersion

func (parseRecoveryCoordinator *RecoveryCoordinator) GetRegionLocalVersion(parseRegionID string) uint64

GetRegionLocalVersion reports the locally authoritative state version for one region.

func (*RecoveryCoordinator) HandleDOMCommitFailure

func (parseRecoveryCoordinator *RecoveryCoordinator) HandleDOMCommitFailure(parseRegionID string, parseFailureKind DOMCommitFailureKind, parseEpoch uint64, parseInputVersion uint64) error

HandleDOMCommitFailure enters region-local fallback for supported invalid DOM commit states.

func (*RecoveryCoordinator) HandleTransportDecodeFailure

func (parseRecoveryCoordinator *RecoveryCoordinator) HandleTransportDecodeFailure(parseRegionID string, parseFailureKind TransportFailureKind, parseEpoch uint64, parseInputVersion uint64) error

HandleTransportDecodeFailure enters region-local fallback for supported transport decode failures.

func (*RecoveryCoordinator) HandleWorkerDeath

func (parseRecoveryCoordinator *RecoveryCoordinator) HandleWorkerDeath(parseRegionID string, hasReassignSupport bool, parseRemountEpoch uint64, parseInputVersion uint64) (WorkerDeathRecoveryResult, error)

HandleWorkerDeath applies reassignment-or-fallback policy when a worker dies.

func (*RecoveryCoordinator) HandleWorkerDiagnostic

func (parseRecoveryCoordinator *RecoveryCoordinator) HandleWorkerDiagnostic(parseRegionID string, parseEpoch uint64, parseInputVersion uint64) WorkerDiagnosticDecision

HandleWorkerDiagnostic decides whether to ignore worker diagnostics for locally owned fallback regions.

func (*RecoveryCoordinator) HandleWorkerPatch

func (parseRecoveryCoordinator *RecoveryCoordinator) HandleWorkerPatch(parseRegionID string, parseEpoch uint64, parseInputVersion uint64) WorkerPatchDecision

HandleWorkerPatch decides whether to ignore one worker patch based on region fallback ownership.

func (*RecoveryCoordinator) IsRegionLocalOwnership

func (parseRecoveryCoordinator *RecoveryCoordinator) IsRegionLocalOwnership(parseRegionID string) bool

IsRegionLocalOwnership reports whether one region is currently marked as locally owned.

func (*RecoveryCoordinator) SetRegionLocalVersion

func (parseRecoveryCoordinator *RecoveryCoordinator) SetRegionLocalVersion(parseRegionID string, parseInputVersion uint64)

SetRegionLocalVersion records locally authoritative state progress for one region.

type RegionDOMCanonicalSnapshotResult

type RegionDOMCanonicalSnapshotResult struct {
	GetNodeCount int
}

RegionDOMCanonicalSnapshotResult reports one applied canonical DOM snapshot size.

func ApplyRegionDOMCanonicalSnapshot

func ApplyRegionDOMCanonicalSnapshot(
	parseRegionDOMIndex *RegionDOMIndex,
	parseRegionID string,
	parseCanonicalIR CanonicalRenderIR,
) (RegionDOMCanonicalSnapshotResult, error)

ApplyRegionDOMCanonicalSnapshot replaces one region-local DOM index subtree with the provided canonical render IR.

type RegionDOMClearResult

type RegionDOMClearResult struct {
	GetClearedNodeCount int
}

RegionDOMClearResult reports how many region-local DOM node mappings were removed.

type RegionDOMIndex

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

RegionDOMIndex maps region and node identity pairs onto region-local DOM node handles.

func BuildRegionDOMIndex

func BuildRegionDOMIndex() *RegionDOMIndex

BuildRegionDOMIndex creates an empty region-local DOM index.

func (*RegionDOMIndex) ClearRegionDOMNodes

func (parseRegionDOMIndex *RegionDOMIndex) ClearRegionDOMNodes(parseRegionID string, parseNodeIDs []uint64) RegionDOMClearResult

ClearRegionDOMNodes removes region-local DOM node mappings for one region, either fully or by targeted node IDs.

func (*RegionDOMIndex) GetRegionDOMMutationVersion

func (parseRegionDOMIndex *RegionDOMIndex) GetRegionDOMMutationVersion(parseRegionID string) uint64

GetRegionDOMMutationVersion reports one monotonic mutation version for the requested region.

func (*RegionDOMIndex) GetRegionDOMNode

func (parseRegionDOMIndex *RegionDOMIndex) GetRegionDOMNode(parseRegionID string, parseNodeID uint64) (*RegionDOMNode, error)

GetRegionDOMNode resolves one indexed region-local DOM node by region and node ID.

func (*RegionDOMIndex) SetRegionDOMNode

func (parseRegionDOMIndex *RegionDOMIndex) SetRegionDOMNode(parseRegionID string, parseNodeID uint64, parseRegionDOMNode *RegionDOMNode) error

SetRegionDOMNode inserts or replaces one region-local DOM node entry.

type RegionDOMNode

type RegionDOMNode struct {
	GetNodeID       uint64
	GetTag          string
	GetText         string
	GetAttrByKey    map[string]string
	GetChildNodeIDs []uint64
	GetParentNodeID uint64
	GetNodeKey      string
}

RegionDOMNode stores one region-local host node representation for commit and indexing tests.

type RegionFallbackState

type RegionFallbackState struct {
	IsLocalOwnership bool
	GetReason        string
	GetEpoch         uint64
	GetInputVersion  uint64
}

RegionFallbackState stores per-region fallback ownership and version metadata.

type RegionInstanceID

type RegionInstanceID string

RegionInstanceID identifies one mounted region instance.

func ParseRegionInstanceID

func ParseRegionInstanceID(parseRaw string) (RegionInstanceID, error)

ParseRegionInstanceID validates and normalizes a region-instance identifier.

type RegionPatchOp

type RegionPatchOp struct {
	GetKind RegionPatchOpKind

	GetNodeID uint64
	GetText   string

	GetAttrKey    string
	GetAttrValue  string
	GetStyleValue string

	GetParentNodeID     uint64
	GetInsertNode       *RegionDOMNode
	GetBeforeNodeID     uint64
	GetMoveNodeID       uint64
	GetDestinationIndex uint32
	GetReplaceSubtreeIR CanonicalRenderIR
}

RegionPatchOp stores one commit operation payload inside a transaction.

type RegionPatchOpKind

type RegionPatchOpKind string

RegionPatchOpKind identifies one supported commit operation kind in a transaction.

const (
	RegionPatchOpKindSetText        RegionPatchOpKind = "set_text"
	RegionPatchOpKindSetAttr        RegionPatchOpKind = "set_attr"
	RegionPatchOpKindSetStyle       RegionPatchOpKind = "set_style"
	RegionPatchOpKindRemoveAttr     RegionPatchOpKind = "remove_attr"
	RegionPatchOpKindRemoveStyle    RegionPatchOpKind = "remove_style"
	RegionPatchOpKindInsertNode     RegionPatchOpKind = "insert_node"
	RegionPatchOpKindRemoveNode     RegionPatchOpKind = "remove_node"
	RegionPatchOpKindReplaceSubtree RegionPatchOpKind = "replace_subtree"
	RegionPatchOpKindMoveKeyedNode  RegionPatchOpKind = "move_keyed_node"
)

type RegionPatchTransaction

type RegionPatchTransaction struct {
	GetRegionID string
	GetOps      []RegionPatchOp
}

RegionPatchTransaction stores one ordered set of patch ops for a single region.

type RegionPatchTransactionResult

type RegionPatchTransactionResult struct {
	HasFallbackEntered bool
}

RegionPatchTransactionResult reports transaction-level commit outcomes.

type RegionRenderer

type RegionRenderer func()

RegionRenderer identifies a worker-renderable region implementation.

type RenderNodeKeyMetadata

type RenderNodeKeyMetadata struct {
	HasKey  bool
	KeyHash uint64
	KeyText string
}

RenderNodeKeyMetadata reports keyed metadata for one render-node record.

type RenderNodeKind

type RenderNodeKind uint8

RenderNodeKind identifies the node category encoded in render IR.

const (
	RenderNodeKindText RenderNodeKind
	RenderNodeKindHostElement
	RenderNodeKindFragment
)

func ParseRenderNodeKind

func ParseRenderNodeKind(parseRaw uint8) (RenderNodeKind, error)

ParseRenderNodeKind decodes and validates a raw render-node kind value.

type RenderNodeRecord

type RenderNodeRecord struct {
	NodeID     uint64
	Kind       RenderNodeKind
	ChildStart uint32
	ChildCount uint32
	PropStart  uint32
	PropCount  uint32
	TextRef    uint32
	Flags      uint32
	KeyHash    uint64
	KeyText    string
}

RenderNodeRecord stores one validated render-node record.

func ParseRenderNodeRecord

func ParseRenderNodeRecord(parseRaw RenderNodeRecordRaw) (RenderNodeRecord, error)

ParseRenderNodeRecord decodes and validates a raw render-node record.

type RenderNodeRecordRaw

type RenderNodeRecordRaw struct {
	NodeID     uint64
	Kind       uint8
	ChildStart uint32
	ChildCount uint32
	PropStart  uint32
	PropCount  uint32
	TextRef    uint32
	Flags      uint32
	KeyHash    uint64
	KeyText    string
}

RenderNodeRecordRaw stores the wire-format fields for one render-node record.

type RenderNodeTable

type RenderNodeTable struct {
	Records []RenderNodeRecord
}

RenderNodeTable stores the validated render-node records for one region.

func ParseRenderNodeTable

func ParseRenderNodeTable(parseRawRecords []RenderNodeRecordRaw) (RenderNodeTable, error)

ParseRenderNodeTable decodes and validates a region-local render-node table.

func (RenderNodeTable) GetRenderNodeChildOrder

func (parseTable RenderNodeTable) GetRenderNodeChildOrder(parseNodeID uint64) ([]uint64, error)

GetRenderNodeChildOrder resolves one node's child node IDs in table order.

func (RenderNodeTable) GetRenderNodeKeyMetadata

func (parseTable RenderNodeTable) GetRenderNodeKeyMetadata(parseNodeID uint64) (RenderNodeKeyMetadata, error)

GetRenderNodeKeyMetadata resolves one node's keyed metadata.

type RenderPropKind

type RenderPropKind uint8

RenderPropKind identifies the property encoding category in render IR.

const (
	RenderPropKindClass RenderPropKind
	RenderPropKindStyle
	RenderPropKindAria
	RenderPropKindData
	RenderPropKindTextAdjacent
)

func ParseRenderPropKind

func ParseRenderPropKind(parseRaw uint8) (RenderPropKind, error)

ParseRenderPropKind decodes and validates one raw render-prop kind.

type RenderPropRecord

type RenderPropRecord struct {
	Kind  RenderPropKind
	Key   string
	Value string
}

RenderPropRecord stores one validated render prop record.

func ParseRenderPropRecord

func ParseRenderPropRecord(parseRaw RenderPropRecordRaw, parseStringTable RenderStringTable) (RenderPropRecord, error)

ParseRenderPropRecord decodes and validates one render prop record against the string table.

func ParseRenderPropRecords

func ParseRenderPropRecords(parseRawRecords []RenderPropRecordRaw, parseStringTable RenderStringTable) ([]RenderPropRecord, error)

ParseRenderPropRecords decodes, canonicalizes, and validates a list of render prop records.

type RenderPropRecordRaw

type RenderPropRecordRaw struct {
	Kind     uint8
	KeyRef   uint32
	ValueRef uint32
}

RenderPropRecordRaw stores the wire-format fields for one render prop record.

type RenderStringTable

type RenderStringTable struct {
	Entries []string
	// contains filtered or unexported fields
}

RenderStringTable stores canonicalized string entries for render IR.

func BuildRenderStringTable

func BuildRenderStringTable(parseValues []string) RenderStringTable

BuildRenderStringTable builds a deduplicated canonical string table.

func BuildRenderStringTableFromRenderOutput

func BuildRenderStringTableFromRenderOutput(parseRenderOutput any) (RenderStringTable, error)

BuildRenderStringTableFromRenderOutput extracts one canonical string table from one render output tree.

func ParseRenderStringTable

func ParseRenderStringTable(parseEntries []string) (RenderStringTable, error)

ParseRenderStringTable decodes one raw string table and validates canonical ordering plus uniqueness.

func (RenderStringTable) GetRenderStringByRef

func (parseStringTable RenderStringTable) GetRenderStringByRef(parseRef uint32) (string, error)

GetRenderStringByRef resolves one string-table reference.

func (RenderStringTable) GetRenderStringRef

func (parseStringTable RenderStringTable) GetRenderStringRef(parseValue string) (uint32, bool)

GetRenderStringRef returns the table reference for one string value.

type RendererID

type RendererID string

RendererID identifies one registered renderer implementation.

func ParseRendererID

func ParseRendererID(parseRaw string) (RendererID, error)

ParseRendererID validates and normalizes a renderer identifier.

type RendererMetadata

type RendererMetadata struct {
	PropSchemaVersion string
	FeatureFlags      []string
	EventSlotMetadata EventSlotMetadata
}

RendererMetadata stores optional renderer capability metadata.

func ResolveRendererMetadata

func ResolveRendererMetadata(parseRendererID RendererID) (RendererMetadata, error)

ResolveRendererMetadata resolves registered renderer metadata by stable ID.

type Runtime2MetaProvider

Runtime2MetaProvider returns one normalized runtime2 metadata snapshot.

type SSRShellAttachPolicy

type SSRShellAttachPolicy string

SSRShellAttachPolicy identifies runtime2 SSR attach policy modes.

const (
	// SSRShellAttachPolicyLocalOnly keeps runtime2 SSR strictly local-only in the first slice.
	SSRShellAttachPolicyLocalOnly SSRShellAttachPolicy = "local-only"
)

func GetSSRShellAttachPolicy

func GetSSRShellAttachPolicy() SSRShellAttachPolicy

GetSSRShellAttachPolicy reports the runtime2 SSR attach policy for the current slice.

func ParseSSRShellAttachPolicy

func ParseSSRShellAttachPolicy(parseRaw string) (SSRShellAttachPolicy, error)

ParseSSRShellAttachPolicy validates one runtime2 SSR attach policy value.

type SSRShellMarker

type SSRShellMarker struct {
	Version          string           `json:"version"`
	RegionInstanceID RegionInstanceID `json:"region_instance_id"`
	RendererID       RendererID       `json:"renderer_id"`
}

SSRShellMarker stores one runtime2 SSR shell marker payload.

func ParseSSRShellMarkerAttributeValue

func ParseSSRShellMarkerAttributeValue(parsePayload string) (SSRShellMarker, error)

ParseSSRShellMarkerAttributeValue decodes and validates one SSR shell marker attribute payload.

type Scheduler

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

Scheduler routes region jobs onto shard assignments and stores queued work.

func BuildScheduler

func BuildScheduler(parseSchedulerShardIDs []SchedulerShardID) *Scheduler

BuildScheduler creates a scheduler with fixed live shard IDs and empty queue state.

func BuildSchedulerWithQueueLimit

func BuildSchedulerWithQueueLimit(parseSchedulerShardIDs []SchedulerShardID, parseSchedulerQueueLimit int) *Scheduler

BuildSchedulerWithQueueLimit creates a scheduler with fixed live shard IDs and optional queue backpressure.

func (*Scheduler) ClearSchedulerFallbackOwnership

func (parseScheduler *Scheduler) ClearSchedulerFallbackOwnership(parseRegionID string) bool

ClearSchedulerFallbackOwnership clears one region's scheduler fallback ownership marker.

func (*Scheduler) GetSchedulerIsDegraded

func (parseScheduler *Scheduler) GetSchedulerIsDegraded() bool

GetSchedulerIsDegraded reports whether scheduler state is currently degraded.

func (*Scheduler) GetSchedulerQueueDepth

func (parseScheduler *Scheduler) GetSchedulerQueueDepth() int

GetSchedulerQueueDepth reports how many jobs are currently enqueued.

func (*Scheduler) HandleSchedulerCancel

func (parseScheduler *Scheduler) HandleSchedulerCancel(parseRegionID string) bool

HandleSchedulerCancel invalidates queued and in-flight region work by advancing the region cancel generation.

func (*Scheduler) HandleSchedulerDispose

func (parseScheduler *Scheduler) HandleSchedulerDispose(parseRegionID string) bool

HandleSchedulerDispose clears one region assignment from scheduler-managed state.

func (*Scheduler) HandleSchedulerFallback

func (parseScheduler *Scheduler) HandleSchedulerFallback(parseRegionID string) bool

HandleSchedulerFallback marks one mounted region as locally-owned fallback state.

func (*Scheduler) HandleSchedulerKeepalivePong

func (parseScheduler *Scheduler) HandleSchedulerKeepalivePong(parseSchedulerShardID SchedulerShardID, parsePongSequence uint64) error

HandleSchedulerKeepalivePong records one shard pong sequence and restores ready health for the shard.

func (*Scheduler) HandleSchedulerKeepaliveTimeout

func (parseScheduler *Scheduler) HandleSchedulerKeepaliveTimeout(parseSchedulerShardID SchedulerShardID) (SchedulerWorkerHealth, error)

HandleSchedulerKeepaliveTimeout records one missed pong window and degrades or kills shard health after repeated misses.

func (*Scheduler) HandleSchedulerMount

func (parseScheduler *Scheduler) HandleSchedulerMount(parseRegionID string) (SchedulerJob, error)

HandleSchedulerMount assigns a shard for the region and enqueues the first mount job.

func (*Scheduler) HandleSchedulerReplaceWorker

func (parseScheduler *Scheduler) HandleSchedulerReplaceWorker(parseDeadSchedulerShardID SchedulerShardID, parseReplacementSchedulerShardID SchedulerShardID) error

HandleSchedulerReplaceWorker replaces one dead shard with a ready replacement shard and repairs affected regions.

func (*Scheduler) HandleSchedulerUpdate

func (parseScheduler *Scheduler) HandleSchedulerUpdate(parseRegionID string) (SchedulerJob, error)

HandleSchedulerUpdate enqueues an update job on the region's existing shard assignment.

func (*Scheduler) HasSchedulerCommitAllowed

func (parseScheduler *Scheduler) HasSchedulerCommitAllowed(parseRegionID string, parseSchedulerCancelVersion uint64) bool

HasSchedulerCommitAllowed reports whether a worker result generation is current enough to commit.

func (*Scheduler) HasSchedulerFallbackOwnership

func (parseScheduler *Scheduler) HasSchedulerFallbackOwnership(parseRegionID string) bool

HasSchedulerFallbackOwnership reports whether one region is currently marked fallback-owned in the scheduler.

func (*Scheduler) HasSchedulerJobStale

func (parseScheduler *Scheduler) HasSchedulerJobStale(parseSchedulerJob SchedulerJob) bool

HasSchedulerJobStale reports whether a queued job is stale under the current region cancel generation.

func (*Scheduler) SetSchedulerWorkerHealth

func (parseScheduler *Scheduler) SetSchedulerWorkerHealth(parseSchedulerShardID SchedulerShardID, parseSchedulerWorkerHealth SchedulerWorkerHealth) error

SetSchedulerWorkerHealth updates one shard health state for scheduler routing decisions.

type SchedulerAssignmentPolicy

type SchedulerAssignmentPolicy uint8

SchedulerAssignmentPolicy controls when region-to-shard assignments may change.

const (
	SchedulerAssignmentPolicyKeep SchedulerAssignmentPolicy
	SchedulerAssignmentPolicyRebalance
	SchedulerAssignmentPolicyRepair
)

type SchedulerJob

type SchedulerJob struct {
	GetSchedulerJobKind       SchedulerJobKind
	GetSchedulerRegionID      string
	GetSchedulerShardID       SchedulerShardID
	GetSchedulerCancelVersion uint64
}

SchedulerJob stores one scheduler-queued operation for a region and shard pair.

type SchedulerJobKind

type SchedulerJobKind string

SchedulerJobKind identifies the scheduler queue operation kind.

const (
	SchedulerJobKindMount  SchedulerJobKind = "mount"
	SchedulerJobKindUpdate SchedulerJobKind = "update"
)

type SchedulerShardID

type SchedulerShardID string

SchedulerShardID identifies one live scheduler shard assignment.

type SchedulerShardModel

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

SchedulerShardModel tracks stable worker-to-shard identity assignments.

func BuildSchedulerShardModel

func BuildSchedulerShardModel() *SchedulerShardModel

BuildSchedulerShardModel creates a scheduler shard identity model with empty assignments.

func (*SchedulerShardModel) ClearSchedulerRegionShardID

func (parseSchedulerShardModel *SchedulerShardModel) ClearSchedulerRegionShardID(parseRegionID string) bool

ClearSchedulerRegionShardID removes one region-to-shard assignment and reports whether it existed.

func (*SchedulerShardModel) ClearSchedulerShardID

func (parseSchedulerShardModel *SchedulerShardModel) ClearSchedulerShardID(parseWorkerKey string) (SchedulerShardID, bool)

ClearSchedulerShardID removes one worker-to-shard assignment and returns the disposed shard identity.

func (*SchedulerShardModel) GetSchedulerRegionAssignedShardID

func (parseSchedulerShardModel *SchedulerShardModel) GetSchedulerRegionAssignedShardID(parseRegionID string) (SchedulerShardID, bool)

GetSchedulerRegionAssignedShardID looks up the current shard assignment for one region without allocating a new assignment.

func (*SchedulerShardModel) GetSchedulerRegionAssignments

func (parseSchedulerShardModel *SchedulerShardModel) GetSchedulerRegionAssignments() map[string]SchedulerShardID

GetSchedulerRegionAssignments returns a copy of current region-to-shard assignments.

func (*SchedulerShardModel) GetSchedulerRegionShardID

func (parseSchedulerShardModel *SchedulerShardModel) GetSchedulerRegionShardID(parseRegionID string, parseSchedulerShardIDs []SchedulerShardID, parsePolicy SchedulerAssignmentPolicy) (SchedulerShardID, error)

GetSchedulerRegionShardID resolves a deterministic shard assignment for one region based on policy and live shard set.

func (*SchedulerShardModel) GetSchedulerShardID

func (parseSchedulerShardModel *SchedulerShardModel) GetSchedulerShardID(parseWorkerKey string) (SchedulerShardID, error)

GetSchedulerShardID resolves or allocates a stable shard identity for one live worker key.

type SchedulerWorkerHealth

type SchedulerWorkerHealth uint8

SchedulerWorkerHealth identifies scheduler-visible worker health states.

const (
	SchedulerWorkerHealthReady SchedulerWorkerHealth
	SchedulerWorkerHealthDegraded
	SchedulerWorkerHealthRestarting
	SchedulerWorkerHealthDead
)

type ShardSession

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

ShardSession stores one shard-scoped control and payload channel backed by an interop or MessagePort primitive.

func BuildShardSession

func BuildShardSession(parseShardID SchedulerShardID, parseSessionPort ShardSessionPort) (*ShardSession, error)

BuildShardSession creates one shard session backed by one interop or MessagePort-like primitive.

func BuildShardSessionWithQueueLimit

func BuildShardSessionWithQueueLimit(parseShardID SchedulerShardID, parseSessionPort ShardSessionPort, parseQueueLimit int) (*ShardSession, error)

BuildShardSessionWithQueueLimit creates one shard session with one explicit inbound queue bound.

func (*ShardSession) GetShardSessionShardID

func (parseSession *ShardSession) GetShardSessionShardID() SchedulerShardID

GetShardSessionShardID reports the shard identity owned by this session.

func (*ShardSession) HandleShardSessionAcceptControlEnvelope

func (parseSession *ShardSession) HandleShardSessionAcceptControlEnvelope(parseEnvelope ControlEnvelope) error

HandleShardSessionAcceptControlEnvelope validates one control envelope and enforces ready/capabilities handshake before mount/update acceptance.

func (*ShardSession) HandleShardSessionReceiveControlEnvelope

func (parseSession *ShardSession) HandleShardSessionReceiveControlEnvelope() (ControlEnvelope, bool, error)

HandleShardSessionReceiveControlEnvelope drains one inbound payload, parses one control envelope, and applies handshake acceptance rules.

func (*ShardSession) HandleShardSessionReceivePatchPayload

func (parseSession *ShardSession) HandleShardSessionReceivePatchPayload() ([]byte, bool)

HandleShardSessionReceivePatchPayload drains one raw patch payload from this shard session.

func (*ShardSession) HandleShardSessionReceivePatchReadyWithPayload

func (parseSession *ShardSession) HandleShardSessionReceivePatchReadyWithPayload() (ControlEnvelope, []byte, bool, error)

HandleShardSessionReceivePatchReadyWithPayload drains one patch-ready control envelope and one paired raw patch payload from this shard session.

func (*ShardSession) HandleShardSessionReceivePayload

func (parseSession *ShardSession) HandleShardSessionReceivePayload() ([]byte, bool)

HandleShardSessionReceivePayload drains one queued inbound payload from the session port handler.

func (*ShardSession) HandleShardSessionReplacePort

func (parseSession *ShardSession) HandleShardSessionReplacePort(parseSessionPort ShardSessionPort) error

HandleShardSessionReplacePort swaps the backing session port and resets handshake state for one renegotiation pass.

func (*ShardSession) HandleShardSessionSendCancelControlEnvelope

func (parseSession *ShardSession) HandleShardSessionSendCancelControlEnvelope(parseRegionInstanceID RegionInstanceID) error

HandleShardSessionSendCancelControlEnvelope builds and sends one cancel control envelope.

func (*ShardSession) HandleShardSessionSendControlEnvelope

func (parseSession *ShardSession) HandleShardSessionSendControlEnvelope(parseEnvelope ControlEnvelope) error

HandleShardSessionSendControlEnvelope serializes and posts one control envelope through this shard session.

func (*ShardSession) HandleShardSessionSendDisposeControlEnvelope

func (parseSession *ShardSession) HandleShardSessionSendDisposeControlEnvelope(parseRegionInstanceID RegionInstanceID) error

HandleShardSessionSendDisposeControlEnvelope builds and sends one dispose control envelope.

func (*ShardSession) HandleShardSessionSendMountControlEnvelope

func (parseSession *ShardSession) HandleShardSessionSendMountControlEnvelope(parseRendererID RendererID, parseSnapshot SnapshotEnvelope) error

HandleShardSessionSendMountControlEnvelope builds and sends one mount control envelope.

func (*ShardSession) HandleShardSessionSendPatchPayload

func (parseSession *ShardSession) HandleShardSessionSendPatchPayload(parsePayload []byte) error

HandleShardSessionSendPatchPayload posts one raw patch payload through this shard session.

func (*ShardSession) HandleShardSessionSendPatchReadyWithPayload

func (parseSession *ShardSession) HandleShardSessionSendPatchReadyWithPayload(parsePatchReadyEnvelope ControlEnvelope, parsePatchPayload []byte) error

HandleShardSessionSendPatchReadyWithPayload sends one patch-ready control envelope and one paired raw patch payload through this shard session.

func (*ShardSession) HandleShardSessionSendPayload

func (parseSession *ShardSession) HandleShardSessionSendPayload(parsePayload []byte) error

HandleShardSessionSendPayload posts one payload through the backing session port.

func (*ShardSession) HandleShardSessionSendRestartControlEnvelope

func (parseSession *ShardSession) HandleShardSessionSendRestartControlEnvelope(parseRegionInstanceID RegionInstanceID, parseEpoch uint64) error

HandleShardSessionSendRestartControlEnvelope builds and sends one restart control envelope.

func (*ShardSession) HandleShardSessionSendUpdateControlEnvelope

func (parseSession *ShardSession) HandleShardSessionSendUpdateControlEnvelope(parseSnapshot SnapshotEnvelope) error

HandleShardSessionSendUpdateControlEnvelope builds and sends one update control envelope.

func (*ShardSession) HandleShardSessionSendWorkerCapabilitiesControlEnvelope

func (parseSession *ShardSession) HandleShardSessionSendWorkerCapabilitiesControlEnvelope(parseCapabilityReport CapabilityReport) error

HandleShardSessionSendWorkerCapabilitiesControlEnvelope builds and sends one worker capabilities control envelope.

func (*ShardSession) HandleShardSessionSendWorkerDiagnosticControlEnvelope

func (parseSession *ShardSession) HandleShardSessionSendWorkerDiagnosticControlEnvelope(
	parseRegionInstanceID RegionInstanceID,
	parseDiagnosticSpec ControlDiagnosticEnvelopeSpec,
) error

HandleShardSessionSendWorkerDiagnosticControlEnvelope builds and sends one worker diagnostic control envelope.

func (*ShardSession) HandleShardSessionSendWorkerPatchReadyControlEnvelope

func (parseSession *ShardSession) HandleShardSessionSendWorkerPatchReadyControlEnvelope(
	parseRegionInstanceID RegionInstanceID,
	parsePatchVersion uint64,
	parseInputVersion uint64,
	parseTransportTier TransportTier,
) error

HandleShardSessionSendWorkerPatchReadyControlEnvelope builds and sends one worker patch-ready control envelope.

func (*ShardSession) HandleShardSessionSendWorkerPongControlEnvelope

func (parseSession *ShardSession) HandleShardSessionSendWorkerPongControlEnvelope(parseShardID SchedulerShardID, parseSequence uint64) error

HandleShardSessionSendWorkerPongControlEnvelope builds and sends one worker pong control envelope.

func (*ShardSession) HandleShardSessionSendWorkerReadyControlEnvelope

func (parseSession *ShardSession) HandleShardSessionSendWorkerReadyControlEnvelope() error

HandleShardSessionSendWorkerReadyControlEnvelope builds and sends one worker ready control envelope.

func (*ShardSession) HandleShardSessionSendWorkerRestartControlEnvelope

func (parseSession *ShardSession) HandleShardSessionSendWorkerRestartControlEnvelope(parseRegionInstanceID RegionInstanceID, parseEpoch uint64) error

HandleShardSessionSendWorkerRestartControlEnvelope builds and sends one worker restart control envelope.

func (*ShardSession) HandleShardSessionTeardown

func (parseSession *ShardSession) HandleShardSessionTeardown() error

HandleShardSessionTeardown closes one shard session, unbinds inbound handlers, and clears queued state.

func (*ShardSession) HasShardSessionHandshakeComplete

func (parseSession *ShardSession) HasShardSessionHandshakeComplete() bool

HasShardSessionHandshakeComplete reports whether ready and capabilities handshake messages were both accepted.

type ShardSessionPort

type ShardSessionPort interface {
	PostMessage(parsePayload []byte) error
	BindMessageHandler(parseHandler func(parsePayload []byte))
}

ShardSessionPort abstracts one interop worker or MessagePort-like primitive for shard session traffic.

type SharedPatchDowngradeReason

type SharedPatchDowngradeReason string

SharedPatchDowngradeReason identifies why patch transport downgraded from shared buffer to message transport.

const (
	// SharedPatchDowngradeReasonSharedMemoryUnavailable reports shared memory was not usable for this patch dispatch.
	SharedPatchDowngradeReasonSharedMemoryUnavailable SharedPatchDowngradeReason = "shared-memory-unavailable"
	// SharedPatchDowngradeReasonInvalidSharedPage reports shared patch page publication failed and transport downgraded.
	SharedPatchDowngradeReasonInvalidSharedPage SharedPatchDowngradeReason = "invalid-shared-page"
)

type SharedPatchPage

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

SharedPatchPage stores one mutable shared-memory-like page buffer and publication generation state for patch payloads.

func BuildSharedPatchPage

func BuildSharedPatchPage(parseCapacity int) (*SharedPatchPage, error)

BuildSharedPatchPage creates one page buffer used for shared patch payload publication flows.

func (*SharedPatchPage) GetSharedPatchReadPayload

func (parseSharedPatchPage *SharedPatchPage) GetSharedPatchReadPayload() ([]byte, error)

GetSharedPatchReadPayload reads the current completed shared patch payload bytes.

func (*SharedPatchPage) HandleSharedPatchPublishPayload

func (parseSharedPatchPage *SharedPatchPage) HandleSharedPatchPublishPayload(parsePayload []byte) (SharedSnapshotPageHeader, error)

HandleSharedPatchPublishPayload writes one patch payload into the page body and completes one publish generation.

type SharedPatchTransportResult

type SharedPatchTransportResult struct {
	GetRegionInstanceID RegionInstanceID
	GetEpoch            uint64
	GetPatchVersion     uint64
	GetTransportTier    TransportTier
	GetMessagePayload   []byte
	GetSharedGeneration uint64
	GetDowngradeReason  SharedPatchDowngradeReason
}

SharedPatchTransportResult stores one selected patch transport tier and payload metadata.

func BuildSharedPatchTransportResult

func BuildSharedPatchTransportResult(
	parseEnvelope StructuredClonePatchEnvelope,
	parseCapabilityReport CapabilityReport,
	parseSharedPatchPage *SharedPatchPage,
) (SharedPatchTransportResult, error)

BuildSharedPatchTransportResult selects one transport tier for one patch envelope and downgrades when shared-buffer publication is unavailable.

type SharedSnapshotDowngradeReason

type SharedSnapshotDowngradeReason string

SharedSnapshotDowngradeReason identifies why snapshot transport downgraded from shared memory.

const (
	// SharedSnapshotDowngradeReasonSharedMemoryUnavailable reports shared memory was not usable for this dispatch.
	SharedSnapshotDowngradeReasonSharedMemoryUnavailable SharedSnapshotDowngradeReason = "shared-memory-unavailable"
	// SharedSnapshotDowngradeReasonInvalidSharedPage reports shared-page publication failed and transport downgraded.
	SharedSnapshotDowngradeReasonInvalidSharedPage SharedSnapshotDowngradeReason = "invalid-shared-page"
)

func ParseSharedSnapshotDowngradeReason

func ParseSharedSnapshotDowngradeReason(parseRaw string) (SharedSnapshotDowngradeReason, error)

ParseSharedSnapshotDowngradeReason validates one downgrade-reason value.

type SharedSnapshotPage

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

SharedSnapshotPage stores one mutable shared-memory-like page buffer and publication generation state.

func BuildSharedSnapshotPage

func BuildSharedSnapshotPage(parseCapacity int) (*SharedSnapshotPage, error)

BuildSharedSnapshotPage creates one page buffer used for shared snapshot publication flows.

func (*SharedSnapshotPage) GetSharedSnapshotReadPayload

func (parseSharedSnapshotPage *SharedSnapshotPage) GetSharedSnapshotReadPayload() ([]byte, error)

GetSharedSnapshotReadPayload reads the current completed page payload bytes.

func (*SharedSnapshotPage) HandleSharedSnapshotPublishBegin

func (parseSharedSnapshotPage *SharedSnapshotPage) HandleSharedSnapshotPublishBegin(parsePayloadLength uint32) (SharedSnapshotPageHeader, error)

HandleSharedSnapshotPublishBegin starts a new publish generation and writes a writing-status page header.

func (*SharedSnapshotPage) HandleSharedSnapshotPublishComplete

func (parseSharedSnapshotPage *SharedSnapshotPage) HandleSharedSnapshotPublishComplete(parseGeneration uint64) (SharedSnapshotPageHeader, error)

HandleSharedSnapshotPublishComplete finalizes one started publish generation by flipping page status to complete.

func (*SharedSnapshotPage) HandleSharedSnapshotPublishPayload

func (parseSharedSnapshotPage *SharedSnapshotPage) HandleSharedSnapshotPublishPayload(parsePayload []byte) (SharedSnapshotPageHeader, error)

HandleSharedSnapshotPublishPayload writes one payload into the page body and completes the publish generation.

func (*SharedSnapshotPage) HandleSharedSnapshotReadHeader

func (parseSharedSnapshotPage *SharedSnapshotPage) HandleSharedSnapshotReadHeader() (SharedSnapshotPageHeader, error)

HandleSharedSnapshotReadHeader reads and validates the current page header for reader-side consumption.

func (*SharedSnapshotPage) HandleSharedSnapshotReadHeaderAtGeneration

func (parseSharedSnapshotPage *SharedSnapshotPage) HandleSharedSnapshotReadHeaderAtGeneration(parseExpectedGeneration uint64) (SharedSnapshotPageHeader, error)

HandleSharedSnapshotReadHeaderAtGeneration reads one completed page header and enforces expected generation matching.

func (*SharedSnapshotPage) ParseSharedSnapshotEnvelope

func (parseSharedSnapshotPage *SharedSnapshotPage) ParseSharedSnapshotEnvelope() (SnapshotEnvelope, error)

ParseSharedSnapshotEnvelope decodes the current completed shared-page payload back into a validated SnapshotEnvelope.

type SharedSnapshotPageHeader

type SharedSnapshotPageHeader struct {
	Kind          SharedSnapshotPageKind
	Generation    uint64
	PayloadLength uint32
	Status        SharedSnapshotPageStatus
}

SharedSnapshotPageHeader stores decoded shared snapshot page header fields.

func ParseSharedSnapshotPageHeader

func ParseSharedSnapshotPageHeader(parseHeader []byte) (SharedSnapshotPageHeader, error)

ParseSharedSnapshotPageHeader decodes and validates one shared snapshot page header.

type SharedSnapshotPageKind

type SharedSnapshotPageKind uint16

SharedSnapshotPageKind identifies the payload kind stored in one shared snapshot page.

const (
	// SharedSnapshotPageKindSnapshot identifies snapshot payload pages.
	SharedSnapshotPageKindSnapshot SharedSnapshotPageKind = 1
	// SharedSnapshotPageKindPatch identifies patch payload pages.
	SharedSnapshotPageKindPatch SharedSnapshotPageKind = 2
)

type SharedSnapshotPageStatus

type SharedSnapshotPageStatus uint32

SharedSnapshotPageStatus identifies publication status for one shared snapshot page.

const (
	// SharedSnapshotPageStatusWriting marks an in-progress publish.
	SharedSnapshotPageStatusWriting SharedSnapshotPageStatus = 0
	// SharedSnapshotPageStatusComplete marks a fully published payload.
	SharedSnapshotPageStatusComplete SharedSnapshotPageStatus = 1
)

type SharedSnapshotTransportResult

type SharedSnapshotTransportResult struct {
	GetRegionInstanceID RegionInstanceID
	GetEpoch            uint64
	GetInputVersion     uint64
	GetTransportTier    TransportTier
	GetMessagePayload   []byte
	GetSharedGeneration uint64
	GetDowngradeReason  SharedSnapshotDowngradeReason
}

SharedSnapshotTransportResult stores one selected snapshot transport tier and payload metadata.

func BuildSharedSnapshotTransportResult

func BuildSharedSnapshotTransportResult(parseEnvelope SnapshotEnvelope, parseCapabilityReport CapabilityReport, parseSharedSnapshotPage *SharedSnapshotPage) (SharedSnapshotTransportResult, error)

BuildSharedSnapshotTransportResult selects a transport tier for one snapshot envelope and downgrades to message transport when shared memory is unavailable.

type SnapshotEnvelope

type SnapshotEnvelope struct {
	RegionInstanceID RegionInstanceID `json:"region_instance_id"`
	Epoch            uint64           `json:"epoch"`
	InputVersion     uint64           `json:"input_version"`
	SourceVersion    uint64           `json:"source_version,omitempty"`
	Props            any              `json:"props,omitempty"`
	Sources          map[string]any   `json:"sources,omitempty"`
}

SnapshotEnvelope stores one versioned region snapshot for worker dispatch.

func BuildSnapshotEnvelope

func BuildSnapshotEnvelope(parseRegionInstanceID RegionInstanceID, parseEpoch uint64, parseInputVersion uint64, parseProps any, parseSourceIDs []string, parseSourceValues map[string]any, parseSourceVersions map[string]uint64) (SnapshotEnvelope, error)

BuildSnapshotEnvelope validates and builds a coherent snapshot envelope.

func ParseBinarySnapshotBody

func ParseBinarySnapshotBody(parsePayload []byte) (SnapshotEnvelope, error)

ParseBinarySnapshotBody decodes one binary snapshot body into a validated snapshot envelope.

func ParseBinarySnapshotEnvelope

func ParseBinarySnapshotEnvelope(parsePayload []byte) (SnapshotEnvelope, error)

ParseBinarySnapshotEnvelope decodes and validates one binary snapshot envelope payload.

func ParseStructuredCloneSnapshotEnvelopeJSON

func ParseStructuredCloneSnapshotEnvelopeJSON(parsePayload []byte) (SnapshotEnvelope, error)

ParseStructuredCloneSnapshotEnvelopeJSON decodes and validates one structured-clone snapshot envelope payload.

type SourceReactivity

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

SourceReactivity stores declared source bindings and queued region updates.

func BuildSourceReactivity

func BuildSourceReactivity() *SourceReactivity

BuildSourceReactivity creates a source-reactivity tracker with empty bindings and queue state.

func (*SourceReactivity) GetRegionUpdateQueue

func (parseSourceReactivity *SourceReactivity) GetRegionUpdateQueue() []RegionInstanceID

GetRegionUpdateQueue returns coalesced region updates in stable order and clears queued state.

func (*SourceReactivity) HandleSourceChange

func (parseSourceReactivity *SourceReactivity) HandleSourceChange(parseSourceID string) bool

HandleSourceChange enqueues updates for regions that declared one changed source ID.

func (*SourceReactivity) SetRegionDeclaredSources

func (parseSourceReactivity *SourceReactivity) SetRegionDeclaredSources(parseRegionInstanceID RegionInstanceID, parseSourceIDs []string) error

SetRegionDeclaredSources sets or replaces declared source IDs for one region instance.

type Status

type Status struct {
	IsConfigured bool
}

Status reports the current coordinator configuration state.

type StructuredCloneMountEnvelope

type StructuredCloneMountEnvelope struct {
	RegionInstanceID RegionInstanceID `json:"region_instance_id"`
	RendererID       RendererID       `json:"renderer_id"`
	SourceIDs        []string         `json:"source_ids,omitempty"`
	Snapshot         SnapshotEnvelope `json:"snapshot"`
}

StructuredCloneMountEnvelope stores the mount payload encoded over structured-clone transport.

func ParseStructuredCloneMountEnvelopeJSON

func ParseStructuredCloneMountEnvelopeJSON(parsePayload []byte) (StructuredCloneMountEnvelope, error)

ParseStructuredCloneMountEnvelopeJSON decodes and validates one structured-clone mount envelope payload.

type StructuredClonePatchEnvelope

type StructuredClonePatchEnvelope struct {
	RegionInstanceID RegionInstanceID `json:"region_instance_id"`
	Epoch            uint64           `json:"epoch"`
	PatchVersion     uint64           `json:"patch_version"`
	PatchPayload     []byte           `json:"patch_payload"`
}

StructuredClonePatchEnvelope stores one patch payload encoded over structured-clone transport.

func ParseSharedPatchPayloadFromPage

func ParseSharedPatchPayloadFromPage(parseSharedPatchPage *SharedPatchPage) (StructuredClonePatchEnvelope, error)

ParseSharedPatchPayloadFromPage reads and decodes one structured-clone patch envelope from a shared patch page.

func ParseStructuredClonePatchEnvelopeJSON

func ParseStructuredClonePatchEnvelopeJSON(parsePayload []byte) (StructuredClonePatchEnvelope, error)

ParseStructuredClonePatchEnvelopeJSON decodes and validates one structured-clone patch envelope payload.

type StructuredCloneUpdateEnvelope

type StructuredCloneUpdateEnvelope struct {
	RegionInstanceID RegionInstanceID `json:"region_instance_id"`
	InputVersion     uint64           `json:"input_version"`
	Snapshot         SnapshotEnvelope `json:"snapshot"`
}

StructuredCloneUpdateEnvelope stores the update payload encoded over structured-clone transport.

func ParseStructuredCloneUpdateEnvelopeJSON

func ParseStructuredCloneUpdateEnvelopeJSON(parsePayload []byte) (StructuredCloneUpdateEnvelope, error)

ParseStructuredCloneUpdateEnvelopeJSON decodes and validates one structured-clone update envelope payload.

type TransportFailureKind

type TransportFailureKind string

TransportFailureKind identifies one decode-failure trigger that should enter fallback.

const (
	TransportFailureKindMalformedControlPayload   TransportFailureKind = "malformed-control-payload"
	TransportFailureKindMalformedPatchPayload     TransportFailureKind = "malformed-patch-payload"
	TransportFailureKindMalformedSharedMemoryPage TransportFailureKind = "malformed-shared-memory-page"
)

type TransportTier

type TransportTier string

TransportTier identifies the patch or snapshot transport tier.

const (
	// TransportTierStructuredClone identifies structured-clone payload transport.
	TransportTierStructuredClone TransportTier = "structured-clone"
	// TransportTierBinary identifies binary payload transport.
	TransportTierBinary TransportTier = "binary"
	// TransportTierSharedBuffer identifies shared-buffer transport.
	TransportTierSharedBuffer TransportTier = "shared-buffer"
)

func BuildSnapshotTransportPayloadWithFallback

func BuildSnapshotTransportPayloadWithFallback(parseEnvelope SnapshotEnvelope, parseCapabilities CapabilityReport) (TransportTier, []byte, error)

BuildSnapshotTransportPayloadWithFallback encodes one snapshot payload and downgrades to structured-clone when binary encode fails.

func GetSharedSnapshotTransportTier

func GetSharedSnapshotTransportTier(parseCapabilityReport CapabilityReport, parseHasSharedSnapshotPage bool) (TransportTier, error)

GetSharedSnapshotTransportTier selects the preferred snapshot transport tier from the capability contract and shared-page availability.

func ParseTransportTier

func ParseTransportTier(parseRaw string) (TransportTier, error)

ParseTransportTier validates a raw transport-tier value.

func SelectPatchTransportTier

func SelectPatchTransportTier(parseCapabilityReport CapabilityReport, parseHasSharedPatchPage bool) (TransportTier, error)

SelectPatchTransportTier selects the preferred patch transport tier from one capability report.

func SelectSnapshotTransportTier

func SelectSnapshotTransportTier(parseCapabilities CapabilityReport) (TransportTier, error)

SelectSnapshotTransportTier selects the preferred snapshot transport tier from the current capability report.

type WorkerControlDispatchResult

type WorkerControlDispatchResult struct {
	HasMountResult   bool
	HasUpdateResult  bool
	HasEventResult   bool
	HasCancelResult  bool
	HasDisposeResult bool
	HasRestartResult bool

	GetMountState    WorkerRegionState
	GetUpdateResult  WorkerRegionUpdateResult
	GetEventResult   WorkerRegionEventResult
	GetCancelResult  WorkerRegionCancelResult
	GetDisposeResult WorkerRegionDisposeResult
	GetRestartResult WorkerRegionRestartResult
}

WorkerControlDispatchResult reports one worker-side control-envelope dispatch outcome.

func HandleWorkerControlEnvelope

func HandleWorkerControlEnvelope(
	parseWorkerRegionRuntime *WorkerRegionRuntime,
	parseEnvelope ControlEnvelope,
) (WorkerControlDispatchResult, error)

HandleWorkerControlEnvelope validates and routes one worker-side control envelope.

type WorkerDeathFailureKind

type WorkerDeathFailureKind string

WorkerDeathFailureKind identifies one worker-death recovery failure reason.

const (
	WorkerDeathFailureKindRepairFailure WorkerDeathFailureKind = "worker-repair-failure"
	WorkerDeathFailureKindNoReassign    WorkerDeathFailureKind = "worker-death-no-reassign"
)

type WorkerDeathRecoveryResult

type WorkerDeathRecoveryResult struct {
	HasReassigned      bool
	GetRemountEpoch    uint64
	HasFallbackEntered bool
}

WorkerDeathRecoveryResult reports reassignment or fallback decisions after worker death.

type WorkerDiagnosticDecision

type WorkerDiagnosticDecision struct {
	HasIgnored bool
}

WorkerDiagnosticDecision reports whether worker diagnostics should be ignored.

type WorkerPatchDecision

type WorkerPatchDecision struct {
	HasIgnored bool
}

WorkerPatchDecision reports whether worker-originated output should be ignored.

type WorkerPatchTransportResult

type WorkerPatchTransportResult struct {
	GetUpdateResult       WorkerRegionUpdateResult
	HasPatchPayload       bool
	GetPatchPayload       []byte
	GetTransportTier      TransportTier
	HasPatchReadyEnvelope bool
	GetPatchReadyEnvelope ControlEnvelope
}

WorkerPatchTransportResult reports one worker update result plus selected patch transport metadata.

type WorkerRegionCancelResult

type WorkerRegionCancelResult struct {
	HasRegion         bool
	HasCancelRecorded bool
}

WorkerRegionCancelResult reports cancel-state handling for one region.

type WorkerRegionCancelSpec

type WorkerRegionCancelSpec struct {
	RegionID     string
	InputVersion uint64
}

WorkerRegionCancelSpec describes one worker-side cancel request.

type WorkerRegionDisposeResult

type WorkerRegionDisposeResult struct {
	HasStateCleared bool
}

WorkerRegionDisposeResult reports whether dispose cleared any worker-region state.

type WorkerRegionEventResult

type WorkerRegionEventResult struct {
	HasPatchReady bool
	IsNoOp        bool
	PatchIR       PatchStreamRaw
}

WorkerRegionEventResult reports whether a semantic event dispatch produced a patch-ready or explicit no-op outcome.

type WorkerRegionEventSpec

type WorkerRegionEventSpec struct {
	RegionID     string
	InputVersion uint64
	EventSlot    EventSlotDispatch
}

WorkerRegionEventSpec describes one worker-side semantic event dispatch for an existing mounted region.

type WorkerRegionMountSpec

type WorkerRegionMountSpec struct {
	RegionID     string
	RendererID   string
	Epoch        uint64
	InputVersion uint64
	Snapshot     SnapshotEnvelope
	RenderInput  WorkerRenderInput
}

WorkerRegionMountSpec describes one worker-side mount request.

type WorkerRegionRenderer

type WorkerRegionRenderer func(parseMount WorkerRegionMountSpec) (any, error)

WorkerRegionRenderer renders one mounted region snapshot into worker-local render IR.

type WorkerRegionRestartResult

type WorkerRegionRestartResult struct {
	HasEpochAdvanced bool
}

WorkerRegionRestartResult reports whether a restart advanced epoch state for one region.

type WorkerRegionRestartSpec

type WorkerRegionRestartSpec struct {
	RegionID string
	Epoch    uint64
}

WorkerRegionRestartSpec describes one worker-side restart request with a fresh epoch.

type WorkerRegionRuntime

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

WorkerRegionRuntime stores worker-side renderer registrations and mounted region state.

func BuildWorkerRegionRuntime

func BuildWorkerRegionRuntime() *WorkerRegionRuntime

BuildWorkerRegionRuntime creates a worker-region runtime with empty renderer and region state maps.

func (*WorkerRegionRuntime) GetWorkerRegionState

func (parseWorkerRegionRuntime *WorkerRegionRuntime) GetWorkerRegionState(parseRegionID string) (WorkerRegionState, bool)

GetWorkerRegionState reports cached worker region state for one region ID.

func (*WorkerRegionRuntime) HandleWorkerRegionCancel

func (parseWorkerRegionRuntime *WorkerRegionRuntime) HandleWorkerRegionCancel(parseCancel WorkerRegionCancelSpec) (WorkerRegionCancelResult, error)

HandleWorkerRegionCancel records a cancel watermark for one region to suppress stale or canceled patch-ready output.

func (*WorkerRegionRuntime) HandleWorkerRegionDispose

func (parseWorkerRegionRuntime *WorkerRegionRuntime) HandleWorkerRegionDispose(parseRegionID string) WorkerRegionDisposeResult

HandleWorkerRegionDispose clears one region's cached worker state and cancel watermark.

func (*WorkerRegionRuntime) HandleWorkerRegionEvent

func (parseWorkerRegionRuntime *WorkerRegionRuntime) HandleWorkerRegionEvent(parseEvent WorkerRegionEventSpec) (WorkerRegionEventResult, error)

HandleWorkerRegionEvent renders one semantic event-slot dispatch against mounted worker state and reports patch-ready or no-op results.

func (*WorkerRegionRuntime) HandleWorkerRegionMount

func (parseWorkerRegionRuntime *WorkerRegionRuntime) HandleWorkerRegionMount(parseMount WorkerRegionMountSpec) (WorkerRegionState, error)

HandleWorkerRegionMount resolves one renderer, builds initial render IR, and stores worker region state.

func (*WorkerRegionRuntime) HandleWorkerRegionRestart

func (parseWorkerRegionRuntime *WorkerRegionRuntime) HandleWorkerRegionRestart(parseRestart WorkerRegionRestartSpec) (WorkerRegionRestartResult, error)

HandleWorkerRegionRestart advances one region epoch and clears stale worker-side state.

func (*WorkerRegionRuntime) HandleWorkerRegionUpdate

func (parseWorkerRegionRuntime *WorkerRegionRuntime) HandleWorkerRegionUpdate(parseUpdate WorkerRegionUpdateSpec) (WorkerRegionUpdateResult, error)

HandleWorkerRegionUpdate renders one updated region snapshot and reports patch-ready or no-op results.

func (*WorkerRegionRuntime) HandleWorkerRegionUpdateWithPatchTransport

func (parseWorkerRegionRuntime *WorkerRegionRuntime) HandleWorkerRegionUpdateWithPatchTransport(
	parseUpdate WorkerRegionUpdateSpec,
	parseCapabilityReport CapabilityReport,
) (WorkerPatchTransportResult, error)

HandleWorkerRegionUpdateWithPatchTransport runs one worker update and selects patch transport for patch-ready results.

func (*WorkerRegionRuntime) RegisterWorkerRegionRenderer

func (parseWorkerRegionRuntime *WorkerRegionRuntime) RegisterWorkerRegionRenderer(parseRendererID string, parseRender WorkerRegionRenderer) error

RegisterWorkerRegionRenderer registers one worker-side renderer function by stable renderer ID.

func (*WorkerRegionRuntime) RegisterWorkerRegionRendererWithMetadata

func (parseWorkerRegionRuntime *WorkerRegionRuntime) RegisterWorkerRegionRendererWithMetadata(
	parseRendererID string,
	parseRender WorkerRegionRenderer,
	parseMetadata RendererMetadata,
) error

RegisterWorkerRegionRendererWithMetadata registers one worker-side renderer function together with capability metadata.

func (*WorkerRegionRuntime) RegisterWorkerRegionRendererWithRegisteredMetadata

func (parseWorkerRegionRuntime *WorkerRegionRuntime) RegisterWorkerRegionRendererWithRegisteredMetadata(
	parseRendererID string,
	parseRender WorkerRegionRenderer,
) error

RegisterWorkerRegionRendererWithRegisteredMetadata registers one worker-side renderer function using metadata resolved from the shared runtime2 registry.

func (*WorkerRegionRuntime) SetWorkerRegionRendererMetadata

func (parseWorkerRegionRuntime *WorkerRegionRuntime) SetWorkerRegionRendererMetadata(
	parseRendererID string,
	parseMetadata RendererMetadata,
) error

SetWorkerRegionRendererMetadata updates capability metadata for one registered worker renderer.

func (*WorkerRegionRuntime) SetWorkerRegionRendererTrusted

func (parseWorkerRegionRuntime *WorkerRegionRuntime) SetWorkerRegionRendererTrusted(parseRendererID string, parseIsTrusted bool) error

SetWorkerRegionRendererTrusted marks one registered renderer as trusted or untrusted for update-path validation gating.

func (*WorkerRegionRuntime) SetWorkerRegionRendererUpdateValidationEnabled

func (parseWorkerRegionRuntime *WorkerRegionRuntime) SetWorkerRegionRendererUpdateValidationEnabled(parseRendererID string, parseIsEnabled bool) error

SetWorkerRegionRendererUpdateValidationEnabled enables or disables update-path render-output validation for one registered renderer.

func (*WorkerRegionRuntime) SetWorkerRegionUpdateValidationEnabled

func (parseWorkerRegionRuntime *WorkerRegionRuntime) SetWorkerRegionUpdateValidationEnabled(parseIsEnabled bool)

SetWorkerRegionUpdateValidationEnabled enables or disables update-path render-output validation for trusted renderers.

type WorkerRegionState

type WorkerRegionState struct {
	RegionID     string
	RendererID   string
	Epoch        uint64
	InputVersion uint64
	Snapshot     SnapshotEnvelope
	SourceIDs    []string
	RenderIR     CanonicalRenderIR
}

WorkerRegionState stores one mounted worker region and its cached render output.

type WorkerRegionUpdateResult

type WorkerRegionUpdateResult struct {
	HasPatchReady bool
	IsNoOp        bool
	IsCanceled    bool
	PatchIR       PatchStreamRaw
}

WorkerRegionUpdateResult reports whether an update produced a patch-ready or explicit no-op outcome.

type WorkerRegionUpdateSpec

type WorkerRegionUpdateSpec struct {
	RegionID     string
	RendererID   string
	Epoch        uint64
	InputVersion uint64
	Snapshot     SnapshotEnvelope
}

WorkerRegionUpdateSpec describes one worker-side update request for an existing mounted region.

type WorkerRenderInput

type WorkerRenderInput struct {
	GetProps         any
	GetSourceVersion uint64
	GetSourceEntries []WorkerRenderSourceEntry
	GetEventSlot     *EventSlotDispatch
}

WorkerRenderInput stores deterministic worker renderer input derived from one snapshot envelope.

func BuildWorkerRenderInput

func BuildWorkerRenderInput(parseSnapshot SnapshotEnvelope) (WorkerRenderInput, error)

BuildWorkerRenderInput builds deterministic worker renderer input from one validated snapshot envelope.

type WorkerRenderSourceEntry

type WorkerRenderSourceEntry struct {
	GetSourceID    string
	GetSourceValue any
}

WorkerRenderSourceEntry stores one deterministic declared-source entry for worker renderer input.

Source Files

Jump to

Keyboard shortcuts

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