fiowatch

package module
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2020 License: MIT Imports: 34 Imported by: 0

README

fio-watch

fio-watch screenshot

A simple near-real-time (GUI) monitor of FIO transactions. It is not finished or ready for general use.

Installing

  1. install Go v1.14 or later.
  2. get the os-specific dependencies to build a Fyne application
  3. run go install github.com/blockpane/fiowatch/...
  4. launch with ~/go/bin/fio-watch -u http://nodeos.local:8888 -p2p nodeos.local:9876

Why is this special, what's the upside?

This tool uses the P2P protocol for getting the blocks / transactions instead of using the http API, which can overwhelm a remote node. The upside to using P2P is that it is much faster, requires less resources and is less likely to miss transactions vs fetching a block every 500ms via HTTP. It's still necessary to have a nodeos API available for getting LIB, ABIs and so on, but shouldn't flood a node with API calls to keep up with the head.

Known Issues - WIP

  • Need ability to save connection settings.
  • There is a resource leak that can consume a lot of memory after a few thousand transactions.
  • More than a few dozen transactions / block can slow the app down.

Other

  • This was built with the very awesome Fyne Toolkit, a pure-Go windowing toolkit.
  • In theory this should be able to run on Mac, Linux, Windows, Android, and IOS. (Scaling issues need to be worked out.)

Documentation

Index

Constants

View Source
const ActionRows = 32

Variables

View Source
var (
	Abis *abiCache
	Api  *fio.API
)

Functions

func BlockSummarysLen

func BlockSummarysLen(b BlockSummarys) int

func GetHost

func GetHost() (apiUrl string, p2p string)

func GetRandomHost

func GetRandomHost(netType NetType) (nodeos string, p2p string, err error)

func LineChart

func LineChart(summary BlockSummarys, lightTheme bool, w int, h int) []byte

func Pie

func Pie(summary BlockSummarys, w int, h int) image.Image

func SaveHost

func SaveHost(apiUrl string, p2p string)

SaveHost tries to save the connection details for next start, best effort only

func Scale

func Scale() image.Rectangle

func WatchBlocks

func WatchBlocks(summary chan *BlockSummary, details chan *ActionRow, quit chan bool, head chan int, lib chan int, diedChan chan bool, heartBeat chan time.Time, slow chan bool, url string, p2pnode string)

Types

type ActionRow

type ActionRow struct {
	Contract string
	Action   string
	Actor    string
	Info     string
	TxDetail []byte
	Time     time.Time
	TxId     string
	BlockNum uint32
	Used     string
}

func (ActionRow) String

func (t ActionRow) String() string

type ArBuffer

type ArBuffer struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func (*ArBuffer) Len

func (a *ArBuffer) Len() int

func (*ArBuffer) Pop

func (a *ArBuffer) Pop(count int) []*ActionRow

func (*ArBuffer) Push

func (a *ArBuffer) Push(row *ActionRow)

type BlockSummary

type BlockSummary struct {
	Mux     sync.RWMutex
	Actions map[string]int
	Y       float64
	T       time.Time
	Block   int
}

type BlockSummarys

type BlockSummarys []*BlockSummary

func (BlockSummarys) ToValues

func (b BlockSummarys) ToValues() (v []chart.Value)

func (BlockSummarys) ToXY

func (b BlockSummarys) ToXY() (xv []time.Time, yv []float64)

type DetailsContent

type DetailsContent struct {
	L [ActionRows * 5]fyne.CanvasObject
	sync.RWMutex
	Updated time.Time
}

func NewDetailsContent

func NewDetailsContent() *DetailsContent

func (*DetailsContent) Get

func (labels *DetailsContent) Get() []fyne.CanvasObject

func (*DetailsContent) Push

func (labels *DetailsContent) Push(f [5]fyne.CanvasObject)

func (*DetailsContent) UpdateContent

func (labels *DetailsContent) UpdateContent(rows chan *ActionRow, done chan bool, win fyne.Window)

type NetType

type NetType uint8
const (
	Mainnet NetType = iota
	Testnet
)

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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