provider

package
v1.1.38 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2021 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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 ErrNilTermuiPresenter = errors.New("nil termui presenter")

ErrNilTermuiPresenter signals that 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(presenter PresenterHandler, nodeURL string, profile *logger.Profile, useWss bool, customLogProfile bool) error

InitLogHandler will open the websocket and set the log level

func StopWebSocket

func StopWebSocket()

StopWebSocket will send notify the node that the app is closed

Types

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