dashboard

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: Apache-2.0, BSD-2-Clause Imports: 54 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// MsgTypeNodeStatus is the type of the NodeStatus block.
	MsgTypeNodeStatus byte = iota
	// MsgTypeBPSMetric is the type of the block per second (BPS) metric block.
	MsgTypeBPSMetric
	// MsgTypeBlock is the type of the block.
	MsgTypeBlock
	// MsgTypeNeighborMetric is the type of the NeighborMetric block.
	MsgTypeNeighborMetric
	// MsgTypeComponentCounterMetric is the type of the component counter triggered per second.
	MsgTypeComponentCounterMetric
	// MsgTypeTipsMetric is the type of the TipsMetric block.
	MsgTypeTipsMetric
	// MsgTypeVertex defines a vertex block.
	MsgTypeVertex
	// MsgTypeTipInfo defines a tip info block.
	MsgTypeTipInfo
	// MsgTypeManaValue defines a mana value block.
	MsgTypeManaValue
	// MsgTypeManaMapOverall defines a block containing overall mana map.
	MsgTypeManaMapOverall
	// MsgTypeManaMapOnline defines a block containing online mana map.
	MsgTypeManaMapOnline
	// MsgTypeManaAllowedPledge defines a block containing a list of allowed mana pledge nodeIDs.
	MsgTypeManaAllowedPledge
	// MsgTypeManaPledge defines a block that is sent when mana was pledged to the node.
	MsgTypeManaPledge
	// MsgTypeManaInitPledge defines a block that is sent when initial pledge events are sent to the dashboard.
	MsgTypeManaInitPledge
	// MsgTypeManaRevoke defines a block that is sent when mana was revoked from a node.
	MsgTypeManaRevoke
	// MsgTypeManaInitRevoke defines a block that is sent when initial revoke events are sent to the dashboard.
	MsgTypeManaInitRevoke
	// MsgTypeManaInitDone defines a block that is sent when all initial values are sent.
	MsgTypeManaInitDone
	// MsgManaDashboardAddress is the socket address of the dashboard to stream mana from.
	MsgManaDashboardAddress
	// MsgTypeChat defines a chat block.
	MsgTypeChat
	// MsgTypeRateSetterMetric defines rate setter metrics.
	MsgTypeRateSetterMetric
	// MsgTypeConflictsConflictSet defines a websocket message that contains a conflictSet update for the "conflicts" tab.
	MsgTypeConflictsConflictSet
	// MsgTypeConflictsConflict defines a websocket message that contains a conflict update for the "conflicts" tab.
	MsgTypeConflictsConflict
)
View Source
const PluginName = "Dashboard"

PluginName is the name of the dashboard plugin.

Variables

View Source
var ErrForbidden = errors.New("forbidden")

ErrForbidden defines the forbidden error.

View Source
var ErrInternalError = errors.New("internal error")

ErrInternalError defines the internal error.

View Source
var ErrInvalidParameter = errors.New("invalid parameter")

ErrInvalidParameter defines the invalid parameter error.

View Source
var ErrNotFound = errors.New("not found")

ErrNotFound defines the not found error.

View Source
var Parameters = &ParametersDefinition{}

Parameters contains the configuration parameters of the dashboard plugin.

View Source
var (
	// Plugin is the plugin instance of the dashboard plugin.
	Plugin *node.Plugin
)

Functions

func ProcessPayload

func ProcessPayload(p payload.Payload) interface{}

ProcessPayload returns different structs regarding to the payload type.

Types

type AllowedNodeStr added in v0.5.0

type AllowedNodeStr struct {
	ShortID string `json:"shortID"`
	FullID  string `json:"fullID"`
}

AllowedNodeStr contains the short and full nodeIDs of a node.

type AllowedPledgeIDsBlkData added in v0.9.2

type AllowedPledgeIDsBlkData struct {
	Access    PledgeIDFilter `json:"accessFilter"`
	Consensus PledgeIDFilter `json:"consensusFilter"`
}

AllowedPledgeIDsBlkData contains information on the allowed pledge ID configuration of the node.

type Balance

type Balance struct {
	Value uint64 `json:"value"`
	Color string `json:"color"`
}

Balance contains the amount of specific color token

type BasicPayload

type BasicPayload struct {
	ContentTitle string `json:"content_title"`
	Content      []byte `json:"content"`
}

BasicPayload contains content title and bytes It can be reused with different payload that only contains one field.

type BasicStringPayload

type BasicStringPayload struct {
	ContentTitle string `json:"content_title"`
	Content      string `json:"content"`
}

BasicStringPayload contains content title and string content

type Conflict added in v0.3.2

type Conflict struct {
	ID      string `json:"tx_id"`
	Opinion `json:"opinion"`
}

Conflict is a JSON serializable conflictSet.

type Essence added in v0.4.0

type Essence struct {
	Version           uint8                `json:"version"`
	Timestamp         int                  `json:"timestamp"`
	AccessPledgeID    string               `json:"access_pledge_id"`
	ConsensusPledgeID string               `json:"cons_pledge_id"`
	Inputs            []*jsonmodels.Output `json:"inputs"`
	Outputs           []*jsonmodels.Output `json:"outputs"`
	Data              string               `json:"data"`
}

Essence contains the transaction essence information.

type ExplorerAddress

type ExplorerAddress struct {
	Address         string           `json:"address"`
	ExplorerOutputs []ExplorerOutput `json:"explorerOutputs"`
}

ExplorerAddress defines the struct of the ExplorerAddress.

type ExplorerBlock added in v0.9.2

type ExplorerBlock struct {
	// ID is the block ID.
	ID string `json:"id"`
	// SolidificationTimestamp is the timestamp of the block.
	SolidificationTimestamp int64 `json:"solidification_timestamp"`
	// The time when this block was issued
	IssuanceTimestamp int64 `json:"issuance_timestamp"`
	// The issuer's sequence number of this block.
	SequenceNumber uint64 `json:"sequence_number"`
	// The public key of the issuer who issued this block.
	IssuerPublicKey string `json:"issuer_public_key"`
	// The shortID of the issuer.
	IssuerShortID string `json:"issuer_short_id"`
	// The signature of the block.
	Signature string `json:"signature"`
	// ParentsByType is the map of parents group by type
	ParentsByType map[string][]string `json:"parentsByType"`
	// StrongChildren are the strong children of the block.
	StrongChildren []string `json:"strongChildren"`
	// WeakChildren are the weak children of the block.
	WeakChildren []string `json:"weakChildren"`
	// ShallowLikeChildren are the shallow like children of the block.
	ShallowLikeChildren []string `json:"shallowLikeChildren"`
	// Solid defines the solid status of the block.
	Solid                 bool               `json:"solid"`
	ConflictIDs           []string           `json:"conflictIDs"`
	AddedConflictIDs      []string           `json:"addedConflictIDs"`
	SubtractedConflictIDs []string           `json:"subtractedConflictIDs"`
	Scheduled             bool               `json:"scheduled"`
	Booked                bool               `json:"booked"`
	ObjectivelyInvalid    bool               `json:"objectivelyInvalid"`
	SubjectivelyInvalid   bool               `json:"subjectivelyInvalid"`
	ConfirmationState     confirmation.State `json:"confirmationState"`
	ConfirmationStateTime int64              `json:"confirmationStateTime"`
	// PayloadType defines the type of the payload.
	PayloadType uint32 `json:"payload_type"`
	// Payload is the content of the payload.
	Payload interface{} `json:"payload"`

	// Structure details
	Rank          uint64 `json:"rank"`
	PastMarkerGap uint64 `json:"pastMarkerGap"`
	IsPastMarker  bool   `json:"isPastMarker"`
	PastMarkers   string `json:"pastMarkers"`

	// Epoch commitment
	EC                   string `json:"ec"`
	EI                   uint64 `json:"ei"`
	ECR                  string `json:"ecr"`
	PrevEC               string `json:"prevEC"`
	LatestConfirmedEpoch uint64 `json:"latestConfirmedEpoch"`
}

ExplorerBlock defines the struct of the ExplorerBlock.

type ExplorerOutput

type ExplorerOutput struct {
	ID                *jsonmodels.OutputID       `json:"id"`
	Output            *jsonmodels.Output         `json:"output"`
	Metadata          *jsonmodels.OutputMetadata `json:"metadata"`
	TxTimestamp       int                        `json:"txTimestamp"`
	ConfirmationState confirmation.State         `json:"confirmationState"`
}

ExplorerOutput defines the struct of the ExplorerOutput.

type InputContent

type InputContent struct {
	OutputID string    `json:"output_id"`
	Address  string    `json:"address"`
	Balances []Balance `json:"balance"`
}

InputContent contains the inputs of a transaction

type ManaBuffer added in v0.5.0

type ManaBuffer struct {
	// Events store PledgedEvent and RevokedEvent structs in chronological order.
	Events []mana.Event

	ValueBlks []*ManaValueBlkData

	MapOverall map[mana.Type]*ManaNetworkListBlkData

	MapOnline map[mana.Type]*ManaNetworkListBlkData
	// contains filtered or unexported fields
}

ManaBuffer holds recent data related to mana in the dashboard. Used to fill frontend on page load/reload.

func ManaBufferInstance added in v0.6.2

func ManaBufferInstance() *ManaBuffer

ManaBufferInstance is the ManaBuffer singleton.

func NewManaBuffer added in v0.5.0

func NewManaBuffer() *ManaBuffer

NewManaBuffer creates and initializes a new, empty buffer.

func (*ManaBuffer) SendEvents added in v0.5.0

func (m *ManaBuffer) SendEvents(ws *websocket.Conn) error

SendEvents send all events in the buffer through the provided websocket connection.

func (*ManaBuffer) SendMapOnline added in v0.5.0

func (m *ManaBuffer) SendMapOnline(ws *websocket.Conn) error

SendMapOnline sends buffered overall mana maps to the provided websocket connection.

func (*ManaBuffer) SendMapOverall added in v0.5.0

func (m *ManaBuffer) SendMapOverall(ws *websocket.Conn) error

SendMapOverall sends buffered overall mana maps to the provided websocket connection.

func (*ManaBuffer) SendValueBlks added in v0.9.2

func (m *ManaBuffer) SendValueBlks(ws *websocket.Conn) error

SendValueBlks sends all blks in the buffer through the provided websocket connection.

func (*ManaBuffer) StoreEvent added in v0.5.0

func (m *ManaBuffer) StoreEvent(event mana.Event)

StoreEvent stores an event in the buffer. If it is full, drops the oldest event.

func (*ManaBuffer) StoreMapOnline added in v0.5.0

func (m *ManaBuffer) StoreMapOnline(blks ...*ManaNetworkListBlkData)

StoreMapOnline stores network mana map blk data.

func (*ManaBuffer) StoreMapOverall added in v0.5.0

func (m *ManaBuffer) StoreMapOverall(blks ...*ManaNetworkListBlkData)

StoreMapOverall stores network mana map blk data.

func (*ManaBuffer) StoreValueBlk added in v0.9.2

func (m *ManaBuffer) StoreValueBlk(blk *ManaValueBlkData)

StoreValueBlk stores a value blk in the buffer. If it is full, drops the oldest blk.

type ManaNetworkListBlkData added in v0.9.2

type ManaNetworkListBlkData struct {
	ManaType  string         `json:"manaType"`
	TotalMana float64        `json:"totalMana"`
	Nodes     []mana.NodeStr `json:"nodes"`
}

ManaNetworkListBlkData contains a list of mana values for nodes in the network.

type ManaValueBlkData added in v0.9.2

type ManaValueBlkData struct {
	NodeID    string  `json:"nodeID"`
	Access    float64 `json:"access"`
	Consensus float64 `json:"consensus"`
	Time      int64   `json:"time"`
}

ManaValueBlkData contains mana values for a particular node.

type Opinion added in v0.3.2

type Opinion struct {
	Value string `json:"value"`
	Round uint8  `json:"round"`
}

Opinion is a JSON serializable opinion.

type OutputContent

type OutputContent struct {
	OutputID string    `json:"output_id"`
	Address  string    `json:"address"`
	Balances []Balance `json:"balance"`
}

OutputContent contains the outputs of a transaction

type ParametersDefinition added in v0.7.4

type ParametersDefinition struct {
	// BindAddress defines the config flag of the dashboard binding address.
	BindAddress string `default:"127.0.0.1:8081" usage:"the bind address of the dashboard"`

	// Dev defines the config flag of the  dashboard dev mode.
	Dev bool `default:"false" usage:"whether the dashboard runs in dev mode"`

	// DevDashboardAddress defines the address of dashboard running in development mode.
	DevDashboardAddress string `default:"127.0.0.1:9090" usage:"address of the dashboard when running in dev mode, e.g. with yarn start"`

	BasicAuth struct {
		// Enabled defines the config flag of the dashboard basic auth enabler.
		Enabled bool `default:"false" usage:"whether to enable HTTP basic auth"`

		// Username defines the config flag of the dashboard basic auth username.
		Username string `default:"goshimmer" usage:"HTTP basic auth username"`

		// Password defines the config flag of the dashboard basic auth password.
		Password string `default:"goshimmer" usage:"HTTP basic auth password"`
	}

	// Conflicts defines the config flag for the configs tab of the dashboard.
	Conflicts struct {
		// MaxCount defines the max number of conflicts stored on the dashboard.
		MaxCount int `default:"100" usage:"max number of conflicts stored on the dashboard"`
	}
}

ParametersDefinition contains the definition of configuration parameters used by the dashboard plugin.

type PledgeIDFilter added in v0.5.0

type PledgeIDFilter struct {
	Enabled        bool             `json:"enabled"`
	AllowedNodeIDs []AllowedNodeStr `json:"allowedNodeIDs"`
}

PledgeIDFilter defines if the filter is enabled, and what nodeIDs are allowed.

type SearchResult

type SearchResult struct {
	// Block is the *ExplorerBlock.
	Block *ExplorerBlock `json:"block"`
	// Address is the *ExplorerAddress.
	Address *ExplorerAddress `json:"address"`
}

SearchResult defines the struct of the SearchResult.

type Timestamp added in v0.3.2

type Timestamp struct {
	ID      string `json:"blk_id"`
	Opinion `json:"opinion"`
}

Timestamp is a JSON serializable Timestamp.

type TransactionPayload added in v0.4.0

type TransactionPayload struct {
	TxID        string                  `json:"txID"`
	Transaction *jsonmodels.Transaction `json:"transaction"`
}

TransactionPayload contains the transaction information.

Jump to

Keyboard shortcuts

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