inspector

package
v1.2.23 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Copyright Consensys Software Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

SPDX-License-Identifier: Apache-2.0

Index

Constants

View Source
const DEFAULT_MODE = 0

DEFAULT_MODE sets the default command bar, and allows the user to navigate the trace.

View Source
const NUMERIC_INPUT_MODE = 1

NUMERIC_INPUT_MODE is where the user is entering a numberic value (e.g. to specify the row for a goto command).

View Source
const STATUS_MODE = 3

STATUS_MODE means the commandbar is notifying the user with a message for a short period of time.

View Source
const TEXT_INPUT_MODE = 2

TEXT_INPUT_MODE is where the user is entering a text value (e.g. for a column filter).

Variables

This section is empty.

Functions

func NewFormatter

func NewFormatter() view.TraceFormatting

NewFormatter constructs a new cell formatter

Types

type InputHandler

type InputHandler[T any] interface {
	// Convert attempts to convert the input string into a valid value.
	Convert(string) (T, error)
	// Apply the given input, which will activate some kind of callback.
	Apply(T) termio.FormattedText
}

InputHandler provides a generic way of handling input, including a mechanism for checking that input is well formed.

type InputMode

type InputMode[T any] struct {
	// contains filtered or unexported fields
}

InputMode is where the user is entering some information (e.g. row for executing a goto command).

func (*InputMode[T]) Activate

func (p *InputMode[T]) Activate(parent *Inspector)

Activate navigation mode by setting the command bar to show the navigation commands.

func (*InputMode[T]) Clock

func (p *InputMode[T]) Clock(parent *Inspector)

Clock navitation mode, which does nothing at this time.

func (*InputMode[T]) KeyPressed

func (p *InputMode[T]) KeyPressed(parent *Inspector, key uint16) bool

KeyPressed in input mode simply updates the input, or exits the mode if either "ESC" or enter are pressed.

type Inspector

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

Inspector provides the necessary package

func NewInspector

func NewInspector(term *termio.Terminal, trace view.TraceView) *Inspector

NewInspector constructs a new inspector on given terminal.

func (*Inspector) CellAt

func (p *Inspector) CellAt(col, row uint) termio.FormattedText

CellAt returns the contents of a given cell in the main table of the inspector.

func (*Inspector) Clock

func (p *Inspector) Clock() error

Clock the inspector

func (*Inspector) Close

func (p *Inspector) Close() error

Close the inspector.

func (*Inspector) ColumnWidth

func (p *Inspector) ColumnWidth(col uint) uint

ColumnWidth gets the width of a given column in the main table of the inspector. Note that columns here are table columns, not trace columns.

func (*Inspector) CurrentModule

func (p *Inspector) CurrentModule() *ModuleState

CurrentModule returns the currently selected module

func (*Inspector) Dimensions

func (p *Inspector) Dimensions() (uint, uint)

Dimensions implementation for the TableSource interface

func (*Inspector) EnterMode

func (p *Inspector) EnterMode(mode Mode)

EnterMode pushes a new mode onto the mode stack.

func (*Inspector) KeyPressed

func (p *Inspector) KeyPressed(key uint16) bool

KeyPressed allows the inspector to react to a key being pressed by the user.

func (*Inspector) Render

func (p *Inspector) Render() error

Render the inspector to the given terminal

func (*Inspector) SetStatus

func (p *Inspector) SetStatus(msg termio.FormattedText)

SetStatus puts a message on the status bar. Messages remain visible for some number of clock cycles.

func (*Inspector) Start

func (p *Inspector) Start() []error

Start provides a read / update / render loop.

type Mode

type Mode interface {
	// Activate is called when this mode becomes active.  This happens when the
	// mode is first entered, but can also happen subsequently when a child mode
	// exits and results in this mode being reactivated.
	Activate(*Inspector)
	// Clock is called on every clock tick.  This gives the mode an opportunity
	// to do something if it wishes to.
	Clock(*Inspector)
	// KeyPressed in the inspector and received by this mode.
	KeyPressed(*Inspector, uint16) bool
}

Mode identifies a mode in which the inspector is operating. The default mode is for navigating the trace, but other modes are available for receiving input from the user or displaying error messages, etc.

type ModuleState

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

ModuleState provides state regarding how to display the trace for a given module, including related aspects like filter histories, etc.

type NavigationMode struct {
}

NavigationMode is the default mode of the inspector. In this mode, the user is navigating the trace in the normal fashion.

func (p *NavigationMode) Activate(parent *Inspector)

Activate navigation mode by setting the command bar to show the navigation commands.

func (p *NavigationMode) Clock(parent *Inspector)

Clock navitation mode, which does nothing at this time.

func (p *NavigationMode) KeyPressed(parent *Inspector, key uint16) bool

KeyPressed in navigation mode, which either adjusts our view of the trace table or fires off some command.

type Query

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

Query represents a boolean expression which can be evaluated over a given set of columns.

func (*Query) Add

func (p *Query) Add(queries ...*Query) *Query

Add constructs the sum of one or more queries

func (*Query) And

func (p *Query) And(queries ...*Query) *Query

And constructs a conjunction of queries.

func (*Query) Equals

func (p *Query) Equals(rhs *Query) *Query

Equals constructs an equality between two queries.

func (*Query) Eval

func (p *Query) Eval(row uint, env QueryEnv) (big.Int, bool)

Eval evaluates the given query in the given environment.

func (*Query) LessThan

func (p *Query) LessThan(rhs *Query) *Query

LessThan constructs a (strict) inequality between two queries.

func (*Query) LessThanEquals

func (p *Query) LessThanEquals(rhs *Query) *Query

LessThanEquals constructs a (non-strict) inequality between two queries.

func (*Query) Mul

func (p *Query) Mul(queries ...*Query) *Query

Mul constructs the product of one or more queries

func (*Query) NotEquals

func (p *Query) NotEquals(rhs *Query) *Query

NotEquals constructs a non-equality between two queries.

func (*Query) Number

func (p *Query) Number(number big.Int) *Query

Number constructs a number with the given value

func (*Query) Or

func (p *Query) Or(queries ...*Query) *Query

Or constructs a disjunction of queries.

func (*Query) String

func (p *Query) String() string

String produces a parseable string from this query.

func (*Query) Sub

func (p *Query) Sub(queries ...*Query) *Query

Sub constructs the subtraction of one or more queries

func (*Query) Truth

func (p *Query) Truth(val bool) *Query

Truth constructs a logical truth

func (*Query) Variable

func (p *Query) Variable(name string) *Query

Variable constructs a variable of the given name.

type QueryEnv

type QueryEnv = func(string, uint) (big.Int, bool)

QueryEnv abstracts the notion of an environment for evaluating a query. Specifically, the environment provides a mapping from variable names to their values on a given row.

type SourceColumnFilter

type SourceColumnFilter struct {
	// Regex filters columns based on whether their name matches the regex or
	// not.
	Regex *regexp.Regexp
	// Computed filters columns based on whether they are computed.
	Computed bool
	// UserDefined filters columns based on whether they are non-computed columns.
	UserDefined bool
	// Register mappin
	Mapping register.Map
}

SourceColumnFilter packages up everything needed for filtering columns in a given module.

func (*SourceColumnFilter) Column

func (p *SourceColumnFilter) Column(col view.SourceColumn) bool

Column matches this filter against a given column.

func (*SourceColumnFilter) Range

func (p *SourceColumnFilter) Range() (start, end uint)

Range imoplementation for ModuleFilter interface.

Jump to

Keyboard shortcuts

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