Documentation
¶
Index ¶
- Constants
- Variables
- func GetAccessMana(nodeID identity.ID, optionalUpdateTime ...time.Time) (float64, time.Time, error)
- func GetAllManaMaps(optionalUpdateTime ...time.Time) (map[mana.Type]mana.NodeMap, error)
- func GetConsensusMana(nodeID identity.ID, optionalUpdateTime ...time.Time) (float64, time.Time, error)
- func GetHighestManaNodes(manaType mana.Type, n uint) ([]mana.Node, time.Time, error)
- func GetLoggedEvents(identityIDs []identity.ID, startTime time.Time, endTime time.Time) (map[identity.ID]*EventsLogs, error)
- func GetManaMap(manaType mana.Type, optionalUpdateTime ...time.Time) (mana.NodeMap, time.Time, error)
- func GetNeighborsMana(manaType mana.Type, optionalUpdateTime ...time.Time) (mana.NodeMap, error)
- func GetOnlineNodes(manaType mana.Type) (onlineNodesMana []mana.Node, t time.Time, err error)
- func GetPastConsensusManaVector(t time.Time) (*mana.ConsensusBaseManaVector, []mana.Event, error)
- func GetPastConsensusManaVectorMetadata() *mana.ConsensusBasePastManaVectorMetadata
- func GetPendingMana(value float64, n time.Duration) float64
- func GetWeightedRandomNodes(n uint, manaType mana.Type) (mana.NodeMap, error)
- func OverrideMana(manaType mana.Type, nodeID identity.ID, bm *mana.AccessBaseMana)
- func PendingManaOnOutput(outputID ledgerstate.OutputID) (float64, time.Time)
- func Plugin() *node.Plugin
- func QueryAllowed() (allowed bool)
- type AllowedPledge
- type EventsLogs
Constants ¶
const ( // CfgEmaCoefficient1 defines the coefficient used for Effective Base Mana 1 (moving average) calculation. CfgEmaCoefficient1 = "mana.emaCoefficient1" // CfgEmaCoefficient2 defines the coefficient used for Effective Base Mana 2 (moving average) calculation. CfgEmaCoefficient2 = "mana.emaCoefficient2" // CfgDecay defines the decay coefficient used for Base Mana 2 calculation. CfgDecay = "mana.decay" // CfgAllowedAccessPledge defines the list of nodes that access mana is allowed to be pledged to. CfgAllowedAccessPledge = "mana.allowedAccessPledge" // CfgAllowedAccessFilterEnabled defines if access mana pledge filter is enabled. CfgAllowedAccessFilterEnabled = "mana.allowedAccessFilterEnabled" // CfgAllowedConsensusPledge defines the list of nodes that consensus mana is allowed to be pledged to. CfgAllowedConsensusPledge = "mana.allowedConsensusPledge" // CfgAllowedConsensusFilterEnabled defines if consensus mana pledge filter is enabled. CfgAllowedConsensusFilterEnabled = "mana.allowedConsensusFilterEnabled" // CfgManaEnableResearchVectors determines if research mana vector should be used or not. To use the Mana Research // Grafana Dashboard, this should be set to true. CfgManaEnableResearchVectors = "mana.enableResearchVectors" // CfgPruneConsensusEventLogsInterval defines the interval to check and prune consensus event logs storage. CfgPruneConsensusEventLogsInterval = "mana.pruneConsensusEventLogsInterval" // CfgVectorsCleanupInterval defines the interval to clean empty mana nodes from the base mana vectors. CfgVectorsCleanupInterval = "mana.vectorsCleanupInterval" // CfgDebuggingEnabled defines if the mana plugin responds to queries while not being in sync or not. CfgDebuggingEnabled = "mana.debuggingEnabled" )
const (
PluginName = "Mana"
)
PluginName is the name of the mana plugin.
Variables ¶
var ErrQueryNotAllowed = xerrors.New("mana query not allowed, node is not synced, debug mode disabled")
ErrQueryNotAllowed is returned when the node is not synced and mana debug mode is disabled.
Functions ¶
func GetAccessMana ¶
GetAccessMana returns the access mana of the node specified.
func GetAllManaMaps ¶
GetAllManaMaps returns the full mana maps for comparison with the perception of other nodes.
func GetConsensusMana ¶
func GetConsensusMana(nodeID identity.ID, optionalUpdateTime ...time.Time) (float64, time.Time, error)
GetConsensusMana returns the consensus mana of the node specified.
func GetHighestManaNodes ¶
GetHighestManaNodes returns the n highest type mana nodes in descending order. It also updates the mana values for each node. If n is zero, it returns all nodes.
func GetLoggedEvents ¶
func GetLoggedEvents(identityIDs []identity.ID, startTime time.Time, endTime time.Time) (map[identity.ID]*EventsLogs, error)
GetLoggedEvents gets the events logs for the node IDs and time frame specified. If none is specified, it returns the logs for all nodes.
func GetManaMap ¶
func GetManaMap(manaType mana.Type, optionalUpdateTime ...time.Time) (mana.NodeMap, time.Time, error)
GetManaMap returns type mana perception of the node.
func GetNeighborsMana ¶
GetNeighborsMana returns the type mana of the nodes neighbors
func GetOnlineNodes ¶
GetOnlineNodes gets the list of currently known (and verified) peers in the network, and their respective mana values. Sorted in descending order based on mana. Zero mana nodes are excluded.
func GetPastConsensusManaVector ¶
GetPastConsensusManaVector builds a consensus base mana vector in the past.
func GetPastConsensusManaVectorMetadata ¶
func GetPastConsensusManaVectorMetadata() *mana.ConsensusBasePastManaVectorMetadata
GetPastConsensusManaVectorMetadata gets the past consensus mana vector metadata.
func GetPendingMana ¶
GetPendingMana returns the mana pledged by spending a `value` output that sat for `n` duration.
func GetWeightedRandomNodes ¶
GetWeightedRandomNodes returns a weighted random selection of n nodes.
func OverrideMana ¶
OverrideMana sets the nodes mana to a specific value. It can be useful for debugging, setting faucet mana, initialization, etc.. Triggers ManaUpdated
func PendingManaOnOutput ¶
func PendingManaOnOutput(outputID ledgerstate.OutputID) (float64, time.Time)
PendingManaOnOutput predicts how much mana (bm2) will be pledged to a node if the output specified is spent.
func QueryAllowed ¶
func QueryAllowed() (allowed bool)
QueryAllowed returns if the mana plugin answers queries or not.
Types ¶
type AllowedPledge ¶
AllowedPledge represents the nodes that mana is allowed to be pledged to.
func GetAllowedPledgeNodes ¶
func GetAllowedPledgeNodes(manaType mana.Type) AllowedPledge
GetAllowedPledgeNodes returns the list of nodes that type mana is allowed to be pledged to.
type EventsLogs ¶
type EventsLogs struct {
Pledge []*mana.PledgedEvent `json:"pledge"`
Revoke []*mana.RevokedEvent `json:"revoke"`
}
EventsLogs represents the events logs.