debug

package
v0.47.1 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 14 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package debug builds the state of an instance for the debugger (DBG-02), reconstructs it at a step of the history (DBG-13), derives the deltas of the live stream (DBG-03) and wakes the live streams of a replica when their instance changed (Hub, DBG-09).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(state model.DebugState, delta model.DebugMessage) model.DebugState

Apply merges a delta into a state, as clients do (CLI-05).

func At

func At(tx *store.Tx, inst store.Instance, seq int64) (model.DebugState, error)

At reconstructs the state after the activity entry seq from the latest snapshot before it and the entries in between (DBG-13); seq 0 selects the latest entry.

func Begin

func Begin(inst model.Instance) model.DebugState

Begin is the state before the first activity entry of an instance, the start of a replay when no snapshot precedes the step.

func Cut

func Cut(state model.DebugState, limit int) model.DebugState

Cut applies the transfer limit to all values of a state; values that are already cut stay so.

func Delta

func Delta(previous model.DebugState, current model.DebugState, activities []model.Activity) model.DebugMessage

Delta derives a message of the live stream from the state sent last and the current one; it carries the new activity entries and what changed (DBG-03). Fast loops are thereby merged into one delta with the latest values (DBG-10).

func Empty

func Empty(delta model.DebugMessage) bool

Empty reports whether a delta carries nothing.

func FirstSeq

func FirstSeq(tx *store.Tx, inst store.Instance) (int64, error)

FirstSeq is the earliest step of an instance that can be reconstructed: the beginning while no entry was evicted, otherwise the oldest snapshot (DBG-14). 0 means none.

func Live

func Live(tx *store.Tx, inst store.Instance, proc *bpmn.Process) (result model.DebugState, err error)

Live builds the current state from the runtime state of an instance. Values are complete; Cut limits them for transfer.

func Replay

func Replay(state model.DebugState, activities []model.Activity) model.DebugState

Replay applies activity entries in order to a state (DBG-13). Values the activity log holds cut stay cut; the snapshots hold them complete (DBG-14).

func Source

Source describes the event source of a description (DBG-02).

func Variable

func Variable(value any, updatedAt time.Time, elementId string, limit int) model.DebugVariable

Variable describes a value; with limit > 0, values whose JSON form is longer are cut (DBG-04).

Types

type Hub

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

Hub tells live debug streams of a replica when their instance changed (DBG-09). The source is the change stream (SYNC-03): Postgres announces changes on commit through LISTEN/NOTIFY, and the outbox is polled as fallback and for SQLite. A wake-up is only a hint; the stream reads the state itself, lost or repeated wake-ups do no harm.

func NewHub

func NewHub(s *store.Store, dsn string, logger *slog.Logger) *Hub

NewHub creates a hub; dsn is the Postgres connection string, empty for SQLite.

func (*Hub) Run

func (this *Hub) Run(ctx context.Context)

Run listens and polls until ctx is done.

func (*Hub) Subscribe

func (this *Hub) Subscribe(instanceId string) (<-chan struct{}, func())

Subscribe returns a channel that receives a signal when the instance changed; signals coalesce while unread. The returned function ends the subscription.

func (*Hub) Wake

func (this *Hub) Wake(instanceId string)

Wake signals the watchers of an instance.

Jump to

Keyboard shortcuts

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