dashboard

package
v0.8.18 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2022 License: Apache-2.0, BSD-2-Clause Imports: 52 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MsgTypeNodeStatus is the type of the NodeStatus message.
	MsgTypeNodeStatus byte = iota
	// MsgTypeMPSMetric is the type of the message per second (MPS) metric message.
	MsgTypeMPSMetric
	// MsgTypeMessage is the type of the message.
	MsgTypeMessage
	// MsgTypeNeighborMetric is the type of the NeighborMetric message.
	MsgTypeNeighborMetric
	// MsgTypeComponentCounterMetric is the type of the component counter triggered per second.
	MsgTypeComponentCounterMetric
	// MsgTypeDrng is the type of the dRNG message.
	MsgTypeDrng
	// MsgTypeTipsMetric is the type of the TipsMetric message.
	MsgTypeTipsMetric
	// MsgTypeVertex defines a vertex message.
	MsgTypeVertex
	// MsgTypeTipInfo defines a tip info message.
	MsgTypeTipInfo
	// MsgTypeManaValue defines a mana value message.
	MsgTypeManaValue
	// MsgTypeManaMapOverall defines a message containing overall mana map.
	MsgTypeManaMapOverall
	// MsgTypeManaMapOnline defines a message containing online mana map.
	MsgTypeManaMapOnline
	// MsgTypeManaAllowedPledge defines a message containing a list of allowed mana pledge nodeIDs.
	MsgTypeManaAllowedPledge
	// MsgTypeManaPledge defines a message that is sent when mana was pledged to the node.
	MsgTypeManaPledge
	// MsgTypeManaInitPledge defines a message that is sent when initial pledge events are sent to the dashboard.
	MsgTypeManaInitPledge
	// MsgTypeManaRevoke defines a message that is sent when mana was revoked from a node.
	MsgTypeManaRevoke
	// MsgTypeManaInitRevoke defines a message that is sent when initial revoke events are sent to the dashboard.
	MsgTypeManaInitRevoke
	// MsgTypeManaInitDone defines a message that is sent when all initial values are sent.
	MsgTypeManaInitDone
	// MsgManaDashboardAddress is the socket address of the dashboard to stream mana from.
	MsgManaDashboardAddress
	// MsgTypeMsgOpinionFormed defines a tip info message.
	MsgTypeMsgOpinionFormed
	// MsgTypeChat defines a chat message.
	MsgTypeChat
	// MsgTypeConflictsConflict defines a message that contains a conflict update for the conflict tab.
	MsgTypeConflictsConflict
	// MsgTypeConflictsBranch defines a message that contains a branch update for the conflict tab.
	MsgTypeConflictsBranch
)
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

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

AllowedNodeStr contains the short and full nodeIDs of a node.

type AllowedPledgeIDsMsgData

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

AllowedPledgeIDsMsgData 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

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

Conflict is a JSON serializable conflict.

type DrngCollectiveBeaconPayload

type DrngCollectiveBeaconPayload struct {
	Round   uint64 `json:"round"`
	PrevSig []byte `json:"prev_sig"`
	Sig     []byte `json:"sig"`
	Dpk     []byte `json:"dpk"`
}

DrngCollectiveBeaconPayload is the subpayload of DrngPayload.

type DrngPayload

type DrngPayload struct {
	SubPayloadType byte        `json:"subpayload_type"`
	InstanceID     uint32      `json:"instance_id"`
	SubPayload     interface{} `json:"drngpayload"`
}

DrngPayload contains the subtype of drng payload, instance ID and the subpayload

type Essence

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 ExplorerMessage

type ExplorerMessage struct {
	// ID is the message ID.
	ID string `json:"id"`
	// SolidificationTimestamp is the timestamp of the message.
	SolidificationTimestamp int64 `json:"solidification_timestamp"`
	// The time when this message was issued
	IssuanceTimestamp int64 `json:"issuance_timestamp"`
	// The issuer's sequence number of this message.
	SequenceNumber uint64 `json:"sequence_number"`
	// The public key of the issuer who issued this message.
	IssuerPublicKey string `json:"issuer_public_key"`
	// The shortID of the issuer.
	IssuerShortID string `json:"issuer_short_id"`
	// The signature of the message.
	Signature string `json:"signature"`
	// ParentsByType is the map of parents group by type
	ParentsByType map[string][]string `json:"parentsByType"`
	// StrongApprovers are the strong approvers of the message.
	StrongApprovers []string `json:"strongApprovers"`
	// WeakApprovers are the weak approvers of the message.
	WeakApprovers []string `json:"weakApprovers"`
	// ShallowLikeApprovers are the shallow like approvers of the message.
	ShallowLikeApprovers []string `json:"shallowLikeApprovers"`
	// ShallowDislikeApprovers are the shallow dislike approvers of the message.
	ShallowDislikeApprovers []string `json:"shallowDislikeApprovers"`
	// Solid defines the solid status of the message.
	Solid               bool                `json:"solid"`
	BranchIDs           []string            `json:"branchIDs"`
	AddedBranchIDs      []string            `json:"addedBranchIDs"`
	SubtractedBranchIDs []string            `json:"subtractedBranchIDs"`
	Scheduled           bool                `json:"scheduled"`
	Booked              bool                `json:"booked"`
	ObjectivelyInvalid  bool                `json:"objectivelyInvalid"`
	SubjectivelyInvalid bool                `json:"subjectivelyInvalid"`
	GradeOfFinality     gof.GradeOfFinality `json:"gradeOfFinality"`
	GradeOfFinalityTime int64               `json:"gradeOfFinalityTime"`
	// 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"`
	FutureMarkers string `json:"futureMarkers"`
}

ExplorerMessage defines the struct of the ExplorerMessage.

type ExplorerOutput

type ExplorerOutput struct {
	ID              *jsonmodels.OutputID       `json:"id"`
	Output          *jsonmodels.Output         `json:"output"`
	Metadata        *jsonmodels.OutputMetadata `json:"metadata"`
	TxTimestamp     int                        `json:"txTimestamp"`
	PendingMana     float64                    `json:"pendingMana"`
	GradeOfFinality gof.GradeOfFinality        `json:"gradeOfFinality"`
}

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

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

	ValueMsgs []*ManaValueMsgData

	MapOverall map[mana.Type]*ManaNetworkListMsgData

	MapOnline map[mana.Type]*ManaNetworkListMsgData
	// 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

func ManaBufferInstance() *ManaBuffer

ManaBufferInstance is the ManaBuffer singleton.

func NewManaBuffer

func NewManaBuffer() *ManaBuffer

NewManaBuffer creates and initializes a new, empty buffer.

func (*ManaBuffer) SendEvents

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

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

func (*ManaBuffer) SendMapOnline

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

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

func (*ManaBuffer) SendMapOverall

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

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

func (*ManaBuffer) SendValueMsgs

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

SendValueMsgs sends all msgs in the buffer through the provided websocket connection.

func (*ManaBuffer) StoreEvent

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

func (m *ManaBuffer) StoreMapOnline(msgs ...*ManaNetworkListMsgData)

StoreMapOnline stores network mana map msg data.

func (*ManaBuffer) StoreMapOverall

func (m *ManaBuffer) StoreMapOverall(msgs ...*ManaNetworkListMsgData)

StoreMapOverall stores network mana map msg data.

func (*ManaBuffer) StoreValueMsg

func (m *ManaBuffer) StoreValueMsg(msg *ManaValueMsgData)

StoreValueMsg stores a value msg in the buffer. If it is full, drops the oldest msg.

type ManaNetworkListMsgData

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

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

type ManaValueMsgData

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

ManaValueMsgData contains mana values for a particular node.

type Opinion

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

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

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 {
	// Message is the *ExplorerMessage.
	Message *ExplorerMessage `json:"message"`
	// Address is the *ExplorerAddress.
	Address *ExplorerAddress `json:"address"`
}

SearchResult defines the struct of the SearchResult.

type Timestamp

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

Timestamp is a JSON serializable Timestamp.

type TransactionPayload

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