Documentation
¶
Index ¶
- Constants
- Variables
- func OutputModeNames() []string
- type BlockMessage
- type DeltaWrap
- type DeltasWrap
- type OutputMode
- type SessionInitMessage
- type SnapshotDeltaWrap
- type TUI
- func (ui *TUI) AbortProgress()
- func (ui *TUI) Cancel()
- func (ui *TUI) CleanUpTerminal()
- func (ui *TUI) Connected()
- func (ui *TUI) Connecting()
- func (ui *TUI) HandleBlockScopedData(ctx context.Context, data *pbsubstreamsrpc.BlockScopedData, isLive *bool, ...) error
- func (ui *TUI) HandleBlockUndoSignal(ctx context.Context, undoSignal *pbsubstreamsrpc.BlockUndoSignal, ...) error
- func (ui *TUI) HandleDebugSnapshotComplete(ctx context.Context, complete *pbsubstreamsrpc.InitialSnapshotComplete) error
- func (ui *TUI) HandleDebugSnapshotData(ctx context.Context, debug *pbsubstreamsrpc.InitialSnapshotData) error
- func (ui *TUI) HandleError(ctx context.Context, err error)
- func (ui *TUI) HandleProgress(ctx context.Context, progress *pbsubstreamsrpc.ModulesProgress)
- func (ui *TUI) HandleSession(ctx context.Context, req *pbsubstreamsrpcv3.Request, ...) error
- func (ui *TUI) Init(outputMode string, bytesRepresentation dynamic.BytesRepresentation) error
- func (ui *TUI) Interrupt()
- func (ui *TUI) OnTerminated(f func(error))
- func (ui *TUI) SessionWork() (total, prepareStores uint64, ok bool)
- func (ui *TUI) SetEndpoint(endpoint string)
- func (ui *TUI) SetInterruptHandler(f func())
- func (ui *TUI) SetTestRunner(testRunner *test.Runner)
Constants ¶
const ( Connecting msg = iota Connected Quit )
Variables ¶
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 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 TUI ¶
type TUI struct {
RequiredProcessedBlocks uint64
ResolvedStartBlock uint64
// contains filtered or unexported fields
}
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) CleanUpTerminal ¶
func (ui *TUI) CleanUpTerminal()
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
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 (*TUI) SessionWork ¶ added in v1.22.0
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
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.