tui

package
v1.25.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Connecting msg = iota
	Connected

	Quit
)

Variables

View Source
var ErrInvalidOutputMode = fmt.Errorf("not a valid OutputMode, try [%s]", strings.Join(_OutputModeNames, ", "))

Functions

func OutputModeNames added in v0.1.0

func OutputModeNames() []string

OutputModeNames returns a list of possible string values of OutputMode.

Types

type BlockMessage

type BlockMessage string

type DeltaWrap added in v0.0.14

type DeltaWrap struct {
	Operation string          `json:"op"`
	Ordinal   uint64          `json:"ordinal"`
	Key       string          `json:"key"`
	OldValue  json.RawMessage `json:"old"`
	NewValue  json.RawMessage `json:"new"`
}

type DeltasWrap added in v0.0.14

type DeltasWrap struct {
	Module   string      `json:"@module"`
	BlockNum uint64      `json:"@block,omitempty"`
	Deltas   []DeltaWrap `json:"@deltas"`
}

type OutputMode added in v0.1.0

type OutputMode uint

ENUM(TUI, JSON, JSONL, CLOCK, CURSOR)

const (
	// OutputModeTUI is a OutputMode of type TUI.
	OutputModeTUI OutputMode = iota
	// OutputModeJSON is a OutputMode of type JSON.
	OutputModeJSON
	// OutputModeJSONL is a OutputMode of type JSONL.
	OutputModeJSONL
	// OutputModeCLOCK is a OutputMode of type CLOCK.
	OutputModeCLOCK
	// OutputModeCURSOR is a OutputMode of type CURSOR.
	OutputModeCURSOR
)

func ParseOutputMode added in v0.1.0

func ParseOutputMode(name string) (OutputMode, error)

ParseOutputMode attempts to convert a string to a OutputMode.

func (OutputMode) IsValid added in v1.0.2

func (x OutputMode) IsValid() bool

IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values

func (OutputMode) MarshalText added in v0.1.0

func (x OutputMode) MarshalText() ([]byte, error)

MarshalText implements the text marshaller method.

func (OutputMode) String added in v0.1.0

func (x OutputMode) String() string

String implements the Stringer interface.

func (*OutputMode) UnmarshalText added in v0.1.0

func (x *OutputMode) UnmarshalText(text []byte) error

UnmarshalText implements the text unmarshaller method.

type SessionInitMessage added in v0.1.0

type SessionInitMessage struct {
	TraceID string
}

type SnapshotDeltaWrap added in v0.0.14

type SnapshotDeltaWrap struct {
	Module   string    `json:"@module"`
	Progress string    `json:"@progress"`
	Delta    DeltaWrap `json:"@delta"`
}

type TUI

type TUI struct {
	RequiredProcessedBlocks uint64
	ResolvedStartBlock      uint64
	// contains filtered or unexported fields
}

func New

func New(pkg *pbsubstreams.Package, outputStreamNames []string) (*TUI, error)

func (*TUI) AbortProgress added in v1.22.0

func (ui *TUI) AbortProgress()

AbortProgress closes the backprocessing block when the request ended before a single block came out of it.

The live region renders inline, so every frame it drew stays in the scrollback. Without this the last thing the user reads above the error is "Backprocessing starting…", which reads as output that got cut off rather than as a request that never got going.

func (*TUI) Cancel

func (ui *TUI) Cancel()

func (*TUI) CleanUpTerminal

func (ui *TUI) CleanUpTerminal()

func (*TUI) Connected

func (ui *TUI) Connected()

func (*TUI) Connecting

func (ui *TUI) Connecting()

func (*TUI) HandleBlockScopedData added in v1.16.2

func (ui *TUI) HandleBlockScopedData(ctx context.Context, data *pbsubstreamsrpc.BlockScopedData, isLive *bool, cursor *sink.Cursor) error

func (*TUI) HandleBlockUndoSignal added in v1.16.2

func (ui *TUI) HandleBlockUndoSignal(ctx context.Context, undoSignal *pbsubstreamsrpc.BlockUndoSignal, cursor *sink.Cursor) error

func (*TUI) HandleDebugSnapshotComplete added in v1.16.2

func (ui *TUI) HandleDebugSnapshotComplete(ctx context.Context, complete *pbsubstreamsrpc.InitialSnapshotComplete) error

func (*TUI) HandleDebugSnapshotData added in v1.16.2

func (ui *TUI) HandleDebugSnapshotData(ctx context.Context, debug *pbsubstreamsrpc.InitialSnapshotData) error

func (*TUI) HandleError added in v1.21.0

func (ui *TUI) HandleError(ctx context.Context, err error)

HandleError is called by the sinker when the stream is severed and about to be retried. The session that follows carries a brand new trace ID, so the UI must stop advertising the previous one until we are effectively re-connected.

func (*TUI) HandleProgress added in v1.16.2

func (ui *TUI) HandleProgress(ctx context.Context, progress *pbsubstreamsrpc.ModulesProgress)

func (*TUI) HandleSession added in v1.16.2

func (ui *TUI) HandleSession(ctx context.Context, req *pbsubstreamsrpcv3.Request, session *pbsubstreamsrpc.SessionInit) error

func (*TUI) Init

func (ui *TUI) Init(outputMode string, bytesRepresentation dynamic.BytesRepresentation) error

func (*TUI) Interrupt added in v1.22.0

func (ui *TUI) Interrupt()

Interrupt is called by the live view when the user asks to stop. It cancels the work; the terminal is restored by the tea program shutting down, and the command's normal teardown prints the stats.

func (*TUI) OnTerminated added in v0.1.0

func (ui *TUI) OnTerminated(f func(error))

func (*TUI) SessionWork added in v1.22.0

func (ui *TUI) SessionWork() (total, prepareStores uint64, ok bool)

SessionWork reports the work the server said it had to do, in module-blocks: the total, and the part of it spent preparing the stores before the first block can be sent. ok is false until a session has been established.

func (*TUI) SetEndpoint added in v1.22.0

func (ui *TUI) SetEndpoint(endpoint string)

SetEndpoint records the endpoint the request is sent to, for display purposes only.

func (*TUI) SetInterruptHandler added in v1.22.0

func (ui *TUI) SetInterruptHandler(f func())

SetInterruptHandler registers what to do when the user hits Ctrl-C while the live view owns the terminal.

Bubbletea puts the terminal in raw mode, so Ctrl-C arrives as a key event and the process never sees SIGINT — the command's signal handler does not run. Without this the UI would quit while the request kept streaming, and stopping for real took a second Ctrl-C, which only worked because the first one had released the terminal.

func (*TUI) SetTestRunner added in v1.16.2

func (ui *TUI) SetTestRunner(testRunner *test.Runner)

Jump to

Keyboard shortcuts

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