provider

package
v1.6.9 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2024 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyNodeURL = errors.New("empty node URL")

ErrEmptyNodeURL signals that an empty URL for the node has been provided

View Source
var ErrInvalidAddressLength = errors.New("invalid length for the node address")

ErrInvalidAddressLength signals that an invalid length has been provided for the node's address

View Source
var ErrInvalidFetchInterval = errors.New("invalid fetch interval has been provided")

ErrInvalidFetchInterval signals that the duration in seconds between fetches is invalid

View Source
var ErrNilChanNodeIsStarting = errors.New("nil node starting channel")

ErrNilChanNodeIsStarting signals that a nil channel for node starting has been provided

View Source
var ErrNilTermuiPresenter = errors.New("nil termui presenter")

ErrNilTermuiPresenter signals that a nil termui presenter has been provided

View Source
var ErrTypeAssertionFailed = errors.New("type assertion is not possible")

ErrTypeAssertionFailed signals that a value for a metric is not an accepted one

Functions

func InitLogHandler

func InitLogHandler(args LogHandlerArgs) error

InitLogHandler will open the websocket and start listening to logs

func StopWebSocket

func StopWebSocket()

StopWebSocket will send notify the node that the app is closed

Types

type LogHandlerArgs

type LogHandlerArgs struct {
	Presenter          PresenterHandler
	NodeURL            string
	Profile            *logger.Profile
	ChanNodeIsStarting chan struct{}
	UseWss             bool
	CustomLogProfile   bool
}

LogHandlerArgs hold the arguments needed to initialize log handling

type PresenterHandler

type PresenterHandler interface {
	Increment(key string)
	AddUint64(key string, val uint64)
	Decrement(key string)
	SetInt64Value(key string, value int64)
	SetUInt64Value(key string, value uint64)
	SetStringValue(key string, value string)
	Close()
	Write(p []byte) (n int, err error)
	view.Presenter
}

PresenterHandler defines what a component which will handle the presentation of data in the termui should do

type StatusMetricsProvider

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

StatusMetricsProvider is the struct that will handle initializing the presenter and fetching updated metrics from the node

func NewStatusMetricsProvider

func NewStatusMetricsProvider(presenter PresenterHandler, nodeAddress string, fetchInterval int) (*StatusMetricsProvider, error)

NewStatusMetricsProvider will return a new instance of a StatusMetricsProvider

func (*StatusMetricsProvider) StartUpdatingData

func (smp *StatusMetricsProvider) StartUpdatingData()

StartUpdatingData will update data from the API at a given interval

Jump to

Keyboard shortcuts

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