dashboard

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2023 License: Apache-2.0, BSD-2-Clause Imports: 61 Imported by: 0

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
	// MsgManaDashboardAddress is the socket address of the dashboard to stream mana from.
	MsgManaDashboardAddress
	// 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
	// MsgTypeSlotInfo defines a websocket message that contains a conflict update for the "conflicts" tab.
	MsgTypeSlotInfo
)
View Source
const PluginName = "Dashboard"

PluginName is the name of the dashboard plugin.

Variables

View Source
var ErrForbidden = echo.ErrForbidden

ErrForbidden defines the forbidden error.

View Source
var ErrInternalError = echo.ErrInternalServerError

ErrInternalError defines the internal error.

View Source
var ErrInvalidParameter = echo.NewHTTPError(http.StatusBadRequest, "invalid parameter")

ErrInvalidParameter defines the invalid parameter error.

View Source
var ErrNotFound = echo.ErrNotFound

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 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 conflictSet.

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 ExplorerBlock

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 groups 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"`
	// LikedInsteadChildren are the shallow like children of the block.
	LikedInsteadChildren []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"`
	Orphaned               bool     `json:"orphaned"`
	ObjectivelyInvalid     bool     `json:"objectivelyInvalid"`
	SubjectivelyInvalid    bool     `json:"subjectivelyInvalid"`
	Acceptance             bool     `json:"acceptance"`
	AcceptanceTime         int64    `json:"acceptanceTime"`
	Confirmation           bool     `json:"confirmation"`
	ConfirmationTime       int64    `json:"confirmationTime"`
	ConfirmationBySlot     bool     `json:"confirmationBySlot"`
	ConfirmationBySlotTime int64    `json:"confirmationBySlotTime"`
	// PayloadType defines the type of the payload.
	PayloadType payload.Type `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"`

	// Slot commitment
	CommitmentID         string `json:"ec"`
	EI                   uint64 `json:"ei"`
	CommitmentRootsID    string `json:"ecr"`
	PreviousCommitmentID string `json:"prevEC"`
	CumulativeWeight     int64  `json:"cumulativeWeight"`
	LatestConfirmedSlot  uint64 `json:"latestConfirmedSlot"`
}

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

type ManaBuffer struct {
	ValueBlks []*ManaValueBlkData

	MapOverall map[manamodels.Type]*ManaNetworkListBlkData

	MapOnline map[manamodels.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

func ManaBufferInstance() *ManaBuffer

ManaBufferInstance is the ManaBuffer singleton.

func NewManaBuffer

func NewManaBuffer() *ManaBuffer

NewManaBuffer creates and initializes a new, empty buffer.

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) SendValueBlks

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

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

func (*ManaBuffer) StoreMapOnline

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

StoreMapOnline stores network mana map blk data.

func (*ManaBuffer) StoreMapOverall

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

StoreMapOverall stores network mana map blk data.

func (*ManaBuffer) StoreValueBlk

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

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

type ManaNetworkListBlkData

type ManaNetworkListBlkData struct {
	ManaType  string                 `json:"manaType"`
	TotalMana int64                  `json:"totalMana"`
	Issuers   []manamodels.IssuerStr `json:"nodes"`
}

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

type ManaValueBlkData

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

ManaValueBlkData contains mana values for a particular issuer.

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:"zipp" usage:"HTTP basic auth username"`
		// Password defines the config flag of the dashboard basic auth password.
		Password string `default:"zipp" 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 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 SlotInfo

type SlotInfo struct {
	Index slot.Index `json:"index"`
	ID    string     `json:"id"`
}

type Timestamp

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

Timestamp is a JSON serializable Timestamp.

type TipsResponse

type TipsResponse struct {
	Tips []string `json:"tips"`
}

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