dashboard

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2022 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WebsocketCmdRegister   = 0
	WebsocketCmdUnregister = 1
)
View Source
const (
	VisualizerInitValuesCount = 3000
	VisualizerCapacity        = 3000
)
View Source
const (
	FeatureDashboardMetrics = "dashboard-metrics/v1"
	FeatureIndexer          = "indexer/v1"
	FeatureParticipation    = "participation/v1"
	FeatureSpammer          = "spammer/v1"

	APIRoute                    = "/api/v2"
	PluginDashboardMetricsRoute = "/api/plugins/" + FeatureDashboardMetrics
	PluginIndexerRoute          = "/api/plugins/" + FeatureIndexer
	PluginParticipationRoute    = "/api/plugins/" + FeatureParticipation
	PluginSpammerRoute          = "/api/plugins/" + FeatureSpammer
)
View Source
const (
	// ParameterBlockID is used to identify a block by its ID.
	ParameterBlockID = "blockID"

	// ParameterTransactionID is used to identify a transaction by its ID.
	ParameterTransactionID = "transactionID"

	// ParameterOutputID is used to identify an output by its ID.
	ParameterOutputID = "outputID"

	// ParameterMilestoneIndex is used to identify a milestone by index.
	ParameterMilestoneIndex = "milestoneIndex"

	// ParameterMilestoneID is used to identify a milestone by its ID.
	ParameterMilestoneID = "milestoneID"

	// ParameterPeerID is used to identify a peer.
	ParameterPeerID = "peerID"

	// RouteInfo is the route for getting the node info.
	// GET returns the node info.
	RouteInfo = APIRoute + "/info"

	// RouteBlock is the route for getting a block by its blockID.
	// GET returns the block based on the given type in the request "Accept" header.
	// MIMEApplicationJSON => json
	// MIMEVendorIOTASerializer => bytes
	RouteBlock = APIRoute + "/blocks/:" + ParameterBlockID

	// RouteBlockMetadata is the route for getting block metadata by its blockID.
	// GET returns block metadata (including info about "promotion/reattachment needed").
	RouteBlockMetadata = APIRoute + "/blocks/:" + ParameterBlockID + "/metadata"

	// RouteTransactionsIncludedBlock is the route for getting the block that was included in the ledger for a given transaction ID.
	// GET returns the block based on the given type in the request "Accept" header.
	// MIMEApplicationJSON => json
	// MIMEVendorIOTASerializer => bytes
	RouteTransactionsIncludedBlock = APIRoute + "/transactions/:" + ParameterTransactionID + "/included-block"

	// RouteMilestoneByID is the route for getting a milestone by its ID.
	// GET returns the milestone.
	// MIMEApplicationJSON => json
	// MIMEVendorIOTASerializer => bytes
	RouteMilestoneByID = APIRoute + "/milestones/:" + ParameterMilestoneID

	// RouteMilestoneByIndex is the route for getting a milestone by its milestoneIndex.
	// GET returns the milestone.
	// MIMEApplicationJSON => json
	// MIMEVendorIOTASerializer => bytes
	RouteMilestoneByIndex = APIRoute + "/milestones/by-index/:" + ParameterMilestoneIndex

	// RouteOutput is the route for getting an output by its outputID (transactionHash + outputIndex).
	// GET returns the output based on the given type in the request "Accept" header.
	// MIMEApplicationJSON => json
	// MIMEVendorIOTASerializer => bytes
	RouteOutput = APIRoute + "/outputs/:" + ParameterOutputID

	// RoutePeer is the route for getting peers by their peerID.
	// GET returns the peer
	// DELETE deletes the peer.
	RoutePeer = APIRoute + "/peers/:" + ParameterPeerID

	// RoutePeers is the route for getting all peers of the node.
	// GET returns a list of all peers.
	// POST adds a new peer.
	RoutePeers = APIRoute + "/peers"
)
View Source
const (
	// ParameterFoundryID is used to identify a foundry by its ID.
	ParameterFoundryID = "foundryID"

	// ParameterAliasID is used to identify an alias by its ID.
	ParameterAliasID = "aliasID"

	// ParameterNFTID is used to identify a nft by its ID.
	ParameterNFTID = "nftID"

	// RouteOutputsBasic is the route for getting basic outputs filtered by the given parameters.
	// GET with query parameter returns all outputIDs that fit these filter criteria.
	// Query parameters: "address", "hasStorageReturnCondition", "storageReturnAddress", "hasExpirationCondition",
	//					 "expiresBefore", "expiresAfter", "expiresBeforeMilestone", "expiresAfterMilestone",
	//					 "hasTimelockCondition", "timelockedBefore", "timelockedAfter", "timelockedBeforeMilestone",
	//					 "timelockedAfterMilestone", "sender", "tag", "createdBefore", "createdAfter"
	// Returns an empty list if no results are found.
	RouteOutputsBasic = PluginIndexerRoute + "/outputs/basic"

	// RouteOutputsAliases is the route for getting aliases filtered by the given parameters.
	// GET with query parameter returns all outputIDs that fit these filter criteria.
	// Query parameters: "stateController", "governor", "issuer", "sender", "createdBefore", "createdAfter"
	// Returns an empty list if no results are found.
	RouteOutputsAliases = PluginIndexerRoute + "/outputs/alias"

	// RouteOutputsAliasByID is the route for getting aliases by their aliasID.
	// GET returns the outputIDs or 404 if no record is found.
	RouteOutputsAliasByID = PluginIndexerRoute + "/outputs/alias/:" + ParameterAliasID

	// RouteOutputsNFTs is the route for getting NFT filtered by the given parameters.
	// Query parameters: "address", "hasStorageReturnCondition", "storageReturnAddress", "hasExpirationCondition",
	//					 "expiresBefore", "expiresAfter", "expiresBeforeMilestone", "expiresAfterMilestone",
	//					 "hasTimelockCondition", "timelockedBefore", "timelockedAfter", "timelockedBeforeMilestone",
	//					 "timelockedAfterMilestone", "issuer", "sender", "tag", "createdBefore", "createdAfter"
	// Returns an empty list if no results are found.
	RouteOutputsNFTs = PluginIndexerRoute + "/outputs/nft"

	// RouteOutputsNFTByID is the route for getting NFT by their nftID.
	// GET returns the outputIDs or 404 if no record is found.
	RouteOutputsNFTByID = PluginIndexerRoute + "/outputs/nft/:" + ParameterNFTID

	// RouteOutputsFoundries is the route for getting foundries filtered by the given parameters.
	// GET with query parameter returns all outputIDs that fit these filter criteria.
	// Query parameters: "aliasAddress", "createdBefore", "createdAfter"
	// Returns an empty list if no results are found.
	RouteOutputsFoundries = PluginIndexerRoute + "/outputs/foundry"

	// RouteOutputsFoundryByID is the route for getting foundries by their foundryID.
	// GET returns the outputIDs or 404 if no record is found.
	RouteOutputsFoundryByID = PluginIndexerRoute + "/outputs/foundry/:" + ParameterFoundryID
)
View Source
const (
	// RouteNodeInfoExtended is the route to get additional info about the node.
	// GET returns the extended info of the node.
	RouteNodeInfoExtended = PluginDashboardMetricsRoute + "/info"

	// RouteDatabaseSizes is the route to get the size of the databases.
	// GET returns the sizes of the databases.
	RouteDatabaseSizes = PluginDashboardMetricsRoute + "/database/sizes"

	// RouteGossipMetrics is the route to get metrics about gossip.
	// GET returns the gossip metrics.
	RouteGossipMetrics = PluginDashboardMetricsRoute + "/gossip"
)
View Source
const (
	// ParameterParticipationEventID is used to identify an event by its ID.
	ParameterParticipationEventID = "eventID"

	// RouteParticipationEvents is the route to list all events, returning their ID, the event name and status.
	// GET returns a list of all events known to the node. Optional query parameter returns filters events by type (query parameters: "type").
	RouteParticipationEvents = PluginParticipationRoute + "/events"

	// RouteParticipationEvent is the route to access a single participation by its ID.
	// GET gives a quick overview of the participation. This does not include the current standings.
	RouteParticipationEvent = PluginParticipationRoute + "/events/:" + ParameterParticipationEventID

	// RouteParticipationEventStatus is the route to access the status of a single participation by its ID.
	// GET returns the amount of tokens participating and accumulated votes for the ballot if the event contains a ballot. Optional query parameter returns the status for the given milestone index (query parameters: "milestoneIndex").
	RouteParticipationEventStatus = PluginParticipationRoute + "/events/:" + ParameterParticipationEventID + "/status"

	// RouteAdminCreateEvent is the route the node operator can use to add events.
	// POST creates a new event to track
	RouteAdminCreateEvent = PluginParticipationRoute + "/admin/events"

	// RouteAdminDeleteEvent is the route the node operator can use to remove events.
	// DELETE removes a tracked participation.
	RouteAdminDeleteEvent = PluginParticipationRoute + "/admin/events/:" + ParameterParticipationEventID
)
View Source
const (
	// RouteSpammerStatus is the route to get the status of the spammer.
	// GET the current status of the spammer.
	RouteSpammerStatus = PluginSpammerRoute + "/status"

	// RouteSpammerStart is the route to start the spammer (with optional changing the settings).
	// POST the settings to change and start the spammer.
	RouteSpammerStart = PluginSpammerRoute + "/start"

	// RouteSpammerStop is the route to stop the spammer.
	// POST to stop the spammer.
	RouteSpammerStop = PluginSpammerRoute + "/stop"
)
View Source
const (
	// MsgTypeSyncStatus is the type of the SyncStatus message.
	MsgTypeSyncStatus byte = iota
	// MsgTypePublicNodeStatus is the type of the PublicNodeStatus message.
	MsgTypePublicNodeStatus = 1
	// MsgTypeNodeInfoExtended is the type of the NodeInfoExtended message.
	MsgTypeNodeInfoExtended = 2
	// MsgTypeGossipMetrics is the type of the GossipMetrics message.
	MsgTypeGossipMetrics = 3
	// MsgTypeMilestone is the type of the Milestone message.
	MsgTypeMilestone = 4
	// MsgTypePeerMetric is the type of the PeerMetric message.
	MsgTypePeerMetric = 5
	// MsgTypeConfirmedMsMetrics is the type of the ConfirmedMsMetrics message.
	MsgTypeConfirmedMsMetrics = 6
	// MsgTypeVisualizerVertex is the type of the Vertex message for the visualizer.
	MsgTypeVisualizerVertex = 7
	// MsgTypeVisualizerSolidInfo is the type of the SolidInfo message for the visualizer.
	MsgTypeVisualizerSolidInfo = 8
	// MsgTypeVisualizerConfirmedInfo is the type of the ConfirmedInfo message for the visualizer.
	MsgTypeVisualizerConfirmedInfo = 9
	// MsgTypeVisualizerMilestoneInfo is the type of the MilestoneInfo message for the visualizer.
	MsgTypeVisualizerMilestoneInfo = 10
	// MsgTypeVisualizerTipInfo is the type of the TipInfo message for the visualizer.
	MsgTypeVisualizerTipInfo = 11
	// MsgTypeDatabaseSizeMetric is the type of the database Size message for the metrics.
	MsgTypeDatabaseSizeMetric = 12
)
View Source
const (
	VisualizerIDLength = 10
)

Variables

This section is empty.

Functions

func ConfirmationCaller

func ConfirmationCaller(handler interface{}, params ...interface{})

func VertexCaller

func VertexCaller(handler interface{}, params ...interface{})

Types

type BlockMetadata

type BlockMetadata struct {
	BlockId        iotago.BlockID
	Parents        iotago.BlockIDs
	IsSolid        bool
	IsReferenced   bool
	IsConflicting  bool
	ShouldPromote  bool
	ShouldReattach bool
}

type Dashboard

type Dashboard struct {
	// the logger used to log events.
	*logger.WrappedLogger
	// contains filtered or unexported fields
}

func New

func New(
	log *logger.Logger,
	daemon hivedaemon.Daemon,
	bindAddress string,
	authUserName string,
	authPasswordHash string,
	authPasswordSalt string,
	authSessionTimeout time.Duration,
	identityFilePath string,
	identityPrivateKey string,
	developerMode bool,
	developerModeURL string,
	nodeBridge *nodebridge.NodeBridge,
	hub *websockethub.Hub) *Dashboard

func (*Dashboard) Init

func (d *Dashboard) Init()

func (*Dashboard) Run

func (d *Dashboard) Run()

type DatabaseSizesMetric

type DatabaseSizesMetric struct {
	Tangle int64 `json:"tangle"`
	UTXO   int64 `json:"utxo"`
	Total  int64 `json:"total"`
	Time   int64 `json:"ts"`
}

DatabaseSizesMetric represents database size metrics.

type GossipMetrics

type GossipMetrics struct {
	Incoming uint32 `json:"incoming"`
	New      uint32 `json:"new"`
	Outgoing uint32 `json:"outgoing"`
}

GossipMetrics represents a websocket message.

type MetricsClient

type MetricsClient struct {
	*nodeclient.Client
}

MetricsClient is an API wrapper over the dashboard metrics node API.

func NewMetricsClient

func NewMetricsClient(client *nodeclient.Client) *MetricsClient

NewMetricsClient returns a new dashboard metrics node API instance.

func (*MetricsClient) DatabaseSizes

func (client *MetricsClient) DatabaseSizes(ctx context.Context) (*DatabaseSizesMetric, error)

func (*MetricsClient) GossipMetrics

func (client *MetricsClient) GossipMetrics(ctx context.Context) (*GossipMetrics, error)

func (*MetricsClient) NodeInfoExtended

func (client *MetricsClient) NodeInfoExtended(ctx context.Context) (*NodeInfoExtended, error)

type Milestone

type Milestone struct {
	MilestoneID string `json:"milestoneId"`
	Index       uint32 `json:"index"`
}

Milestone represents a milestone for the livefeed.

type Msg

type Msg struct {
	Type byte        `json:"type"`
	Data interface{} `json:"data"`
}

Msg represents a websocket message.

type NodeInfoExtended

type NodeInfoExtended struct {
	Version       string `json:"version"`
	LatestVersion string `json:"latestVersion"`
	Uptime        int64  `json:"uptime"`
	NodeID        string `json:"nodeId"`
	NodeAlias     string `json:"nodeAlias"`
	MemoryUsage   int64  `json:"memUsage"`
}

NodeInfoExtended represents extended information about the node.

type PublicNodeStatus

type PublicNodeStatus struct {
	PruningIndex uint32 `json:"pruningIndex"`
	IsHealthy    bool   `json:"isHealthy"`
	IsSynced     bool   `json:"isSynced"`
}

PublicNodeStatus represents the public node status.

type SyncStatus

type SyncStatus struct {
	CMI uint32 `json:"cmi"`
	LMI uint32 `json:"lmi"`
}

SyncStatus represents the node sync status.

type Visualizer

type Visualizer struct {
	sync.RWMutex

	Events *VisualizerEvents
	// contains filtered or unexported fields
}

func NewVisualizer

func NewVisualizer(capacity int) *Visualizer

func (*Visualizer) AddConfirmation

func (v *Visualizer) AddConfirmation(parents iotago.BlockIDs, conflictingBlocks iotago.BlockIDs)

func (*Visualizer) AddVertex

func (v *Visualizer) AddVertex(block *iotago.Block)

func (*Visualizer) ForEachCreated

func (v *Visualizer) ForEachCreated(consumer func(vertex *VisualizerVertex) bool, elementsCount ...int)

func (*Visualizer) SetIsConflicting

func (v *Visualizer) SetIsConflicting(blockID iotago.BlockID)

func (*Visualizer) SetIsReferenced

func (v *Visualizer) SetIsReferenced(blockID iotago.BlockID)

func (*Visualizer) SetIsSolid

func (v *Visualizer) SetIsSolid(blockID iotago.BlockID)

type VisualizerConfirmationInfo

type VisualizerConfirmationInfo struct {
	IDs         []string `json:"ids"`
	ExcludedIDs []string `json:"excludedIds"`
}

VisualizerConfirmationInfo signals confirmation of a milestone block with a list of exluded blocks in the past cone.

type VisualizerEvents

type VisualizerEvents struct {
	VertexCreated      *events.Event
	VertexSolidUpdated *events.Event
	VertexTipUpdated   *events.Event
	Confirmation       *events.Event
}

type VisualizerMetaInfo

type VisualizerMetaInfo struct {
	ID string `json:"id"`
}

VisualizerMetaInfo signals that metadata of a given block changed.

type VisualizerTipInfo

type VisualizerTipInfo struct {
	ID    string `json:"id"`
	IsTip bool   `json:"isTip"`
}

tipinfo holds information about whether a given block is a tip or not.

type VisualizerVertex

type VisualizerVertex struct {
	ID            string   `json:"id"`
	Parents       []string `json:"parents"`
	IsSolid       bool     `json:"isSolid"`
	IsReferenced  bool     `json:"isReferenced"`
	IsConflicting bool     `json:"isConflicting"`
	IsTransaction bool     `json:"isTransaction"`
	IsMilestone   bool     `json:"isMilestone"`
	IsTip         bool     `json:"isTip"`
	// contains filtered or unexported fields
}

VisualizerVertex defines a vertex in a DAG.

Jump to

Keyboard shortcuts

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