dashboard

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2021 License: Apache-2.0, BSD-2-Clause Imports: 48 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// CfgBindAddress defines the config flag of the dashboard binding address.
	CfgBindAddress = "dashboard.bindAddress"
	// CfgDev defines the config flag of the  dashboard dev mode.
	CfgDev = "dashboard.dev"
	// CfgBasicAuthEnabled defines the config flag of the dashboard basic auth enabler.
	CfgBasicAuthEnabled = "dashboard.basic_auth.enabled"
	// CfgBasicAuthUsername defines the config flag of the dashboard basic auth username.
	CfgBasicAuthUsername = "dashboard.basic_auth.username"
	// CfgBasicAuthPassword defines the config flag of the dashboard basic auth password.
	CfgBasicAuthPassword = "dashboard.basic_auth.password"
)
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
)
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.

Functions

func Plugin

func Plugin() *node.Plugin

Plugin gets the plugin instance.

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 AllowedPledgeIDsMsgData added in v0.5.0

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 added in v0.3.2

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 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 ExplorerInclusionState added in v0.6.2

type ExplorerInclusionState struct {
	Confirmed   bool `json:"confirmed,omitempty"`
	Rejected    bool `json:"rejected,omitempty"`
	Liked       bool `json:"liked,omitempty"`
	Conflicting bool `json:"conflicting,omitempty"`
	Finalized   bool `json:"finalized,omitempty"`
}

ExplorerInclusionState defines the struct for storing inclusion states for ExplorerOutput

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"`
	// StrongParents are the strong parents (references) of the message.
	StrongParents []string `json:"strongParents"`
	// WeakParents are the weak parents (references) of the message.
	WeakParents []string `json:"weakParents"`
	// StrongApprovers are the strong approvers of the message.
	StrongApprovers []string `json:"strongApprovers"`
	// WeakApprovers are the weak approvers of the message.
	WeakApprovers []string `json:"weakApprovers"`
	// Solid defines the solid status of the message.
	Solid     bool   `json:"solid"`
	BranchID  string `json:"branchID"`
	Scheduled bool   `json:"scheduled"`
	Booked    bool   `json:"booked"`
	Eligible  bool   `json:"eligible"`
	Invalid   bool   `json:"invalid"`
	Finalized bool   `json:"finalized"`
	// 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"`
	SequenceID    uint64 `json:"sequenceID"`
	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"`
	InclusionState ExplorerInclusionState     `json:"inclusionState"`
	TxTimestamp    int                        `json:"txTimestamp"`
	PendingMana    float64                    `json:"pendingMana"`
}

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

	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 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) SendValueMsgs added in v0.5.0

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

SendValueMsgs sends all msgs 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(msgs ...*ManaNetworkListMsgData)

StoreMapOnline stores network mana map msg data.

func (*ManaBuffer) StoreMapOverall added in v0.5.0

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

StoreMapOverall stores network mana map msg data.

func (*ManaBuffer) StoreValueMsg added in v0.5.0

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

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

type ManaNetworkListMsgData added in v0.5.0

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 added in v0.5.0

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

SearchResult defines the struct of the SearchResult.

type StatementPayload added in v0.3.2

type StatementPayload struct {
	Conflicts  []Conflict  `json:"conflicts"`
	Timestamps []Timestamp `json:"timestamps"`
}

StatementPayload is a JSON serializable statement payload.

type Timestamp added in v0.3.2

type Timestamp struct {
	ID      string `json:"msg_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