Documentation ¶
Index ¶
- Constants
- Variables
- func AwaitMessageToBeBooked(f func() (*tangle.Message, error), txID ledgerstate.TransactionID, ...) (*tangle.Message, error)
- func AwaitMessageToBeIssued(f func() (*tangle.Message, error), issuer ed25519.PublicKey, ...) (*tangle.Message, error)
- func FinalityGadget() finality.Gadget
- func GetAccessMana(nodeID identity.ID, optionalUpdateTime ...time.Time) (float64, time.Time, error)
- func GetAllManaMaps(optionalUpdateTime ...time.Time) (map[mana.Type]mana.NodeMap, error)
- func GetCMana() map[identity.ID]float64
- 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 GetHighestManaNodesFraction(manaType mana.Type, p float64) ([]mana.Node, time.Time, error)
- func GetManaMap(manaType mana.Type, optionalUpdateTime ...time.Time) (mana.NodeMap, time.Time, error)
- func GetNeighborsMana(manaType mana.Type, neighbors []*gossip.Neighbor, ...) (mana.NodeMap, error)
- func GetOnlineNodes(manaType mana.Type) (onlineNodesMana []mana.Node, t time.Time, err error)
- func GetPendingMana(value float64, n time.Duration) float64
- func GetTotalMana(manaType mana.Type, optionalUpdateTime ...time.Time) (float64, time.Time, error)
- func OverrideMana(manaType mana.Type, nodeID identity.ID, bm *mana.AccessBaseMana)
- func PendingManaOnOutput(outputID ledgerstate.OutputID) (float64, time.Time)
- func QueryAllowed() (allowed bool)
- type AllowedPledge
- type ManaParametersDefinition
- type ParametersDefinition
- type RateSetterParametersDefinition
- type SchedulerParametersDefinition
Constants ¶
const (
// PluginName is the name of the mana plugin.
PluginName = "Mana"
)
Variables ¶
var ( // ErrMessageWasNotBookedInTime is returned if a message did not get booked within the defined await time. ErrMessageWasNotBookedInTime = errors.New("message could not be booked in time") // ErrMessageWasNotIssuedInTime is returned if a message did not get issued within the defined await time. ErrMessageWasNotIssuedInTime = errors.New("message could not be issued in time") )
var ErrQueryNotAllowed = errors.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.
var ManaParameters = &ManaParametersDefinition{}
ManaParameters contains the mana configuration used by the messagelayer plugin.
var ( // ManaPlugin is the plugin instance of the mana plugin. ManaPlugin = node.NewPlugin(PluginName, nil, node.Enabled, configureManaPlugin, runManaPlugin) )
var Parameters = &ParametersDefinition{}
Parameters contains the general configuration used by the messagelayer plugin.
var ( // Plugin is the plugin instance of the messagelayer plugin. Plugin *node.Plugin )
var RateSetterParameters = &RateSetterParametersDefinition{}
RateSetterParameters contains the rate setter configuration used by the messagelayer plugin.
var SchedulerParameters = &SchedulerParametersDefinition{}
SchedulerParameters contains the scheduler configuration used by the messagelayer plugin.
Functions ¶
func AwaitMessageToBeBooked ¶ added in v0.4.0
func AwaitMessageToBeBooked(f func() (*tangle.Message, error), txID ledgerstate.TransactionID, maxAwait time.Duration) (*tangle.Message, error)
AwaitMessageToBeBooked awaits maxAwait for the given message to get booked.
func AwaitMessageToBeIssued ¶ added in v0.6.2
func AwaitMessageToBeIssued(f func() (*tangle.Message, error), issuer ed25519.PublicKey, maxAwait time.Duration) (*tangle.Message, error)
AwaitMessageToBeIssued awaits maxAwait for the given message to get issued.
func FinalityGadget ¶ added in v0.8.0
FinalityGadget is the finality gadget instance.
func GetAccessMana ¶ added in v0.5.5
GetAccessMana returns the access mana of the node specified.
func GetAllManaMaps ¶ added in v0.5.5
GetAllManaMaps returns the full mana maps for comparison with the perception of other nodes.
func GetConsensusMana ¶ added in v0.5.5
func GetConsensusMana(nodeID identity.ID, optionalUpdateTime ...time.Time) (float64, time.Time, error)
GetConsensusMana returns the consensus mana of the node specified.
func GetHighestManaNodes ¶ added in v0.5.5
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 GetHighestManaNodesFraction ¶ added in v0.5.5
GetHighestManaNodesFraction returns the highest mana that own 'p' percent of total mana. It also updates the mana values for each node. If p is zero or greater than one, it returns all nodes.
func GetManaMap ¶ added in v0.5.5
func GetManaMap(manaType mana.Type, optionalUpdateTime ...time.Time) (mana.NodeMap, time.Time, error)
GetManaMap returns type mana perception of the node.
func GetNeighborsMana ¶ added in v0.5.5
func GetNeighborsMana(manaType mana.Type, neighbors []*gossip.Neighbor, optionalUpdateTime ...time.Time) (mana.NodeMap, error)
GetNeighborsMana returns the type mana of the nodes neighbors.
func GetOnlineNodes ¶ added in v0.5.5
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 GetPendingMana ¶ added in v0.5.5
GetPendingMana returns the mana pledged by spending a `value` output that sat for `n` duration.
func GetTotalMana ¶ added in v0.6.2
GetTotalMana returns sum of mana of all nodes in the network.
func OverrideMana ¶ added in v0.5.5
OverrideMana sets the nodes mana to a specific value. It can be useful for debugging, setting faucet mana, initialization, etc.. Triggers ManaUpdated.
func PendingManaOnOutput ¶ added in v0.5.5
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 ¶ added in v0.5.5
func QueryAllowed() (allowed bool)
QueryAllowed returns if the mana plugin answers queries or not.
Types ¶
type AllowedPledge ¶ added in v0.5.5
AllowedPledge represents the nodes that mana is allowed to be pledged to.
func GetAllowedPledgeNodes ¶ added in v0.5.5
func GetAllowedPledgeNodes(manaType mana.Type) AllowedPledge
GetAllowedPledgeNodes returns the list of nodes that type mana is allowed to be pledged to.
type ManaParametersDefinition ¶ added in v0.7.4
type ManaParametersDefinition struct { // EmaCoefficient1 defines the coefficient used for Effective Base Mana 1 (moving average) calculation. EmaCoefficient1 float64 `default:"0.00003209" usage:"coefficient used for Effective Base Mana 1 (moving average) calculation"` // EmaCoefficient2 defines the coefficient used for Effective Base Mana 2 (moving average) calculation. EmaCoefficient2 float64 `default:"0.0057762265" usage:"coefficient used for Effective Base Mana 1 (moving average) calculation"` // Decay defines the decay coefficient used for Base Mana 2 calculation. Decay float64 `default:"0.00003209" usage:"decay coefficient used for Base Mana 2 calculation"` // AllowedAccessPledge defines the list of nodes that access mana is allowed to be pledged to. AllowedAccessPledge []string `usage:"list of nodes that access mana is allowed to be pledged to"` // AllowedAccessFilterEnabled defines if access mana pledge filter is enabled. AllowedAccessFilterEnabled bool `default:"false" usage:"list of nodes that consensus mana is allowed to be pledge to"` // AllowedConsensusPledge defines the list of nodes that consensus mana is allowed to be pledged to. AllowedConsensusPledge []string `usage:"list of nodes that consensus mana is allowed to be pledge to"` // AllowedConsensusFilterEnabled defines if consensus mana pledge filter is enabled. AllowedConsensusFilterEnabled bool `default:"false" usage:"if filtering on consensus mana pledge nodes is enabled"` // EnableResearchVectors determines if research mana vector should be used or not. To use the Mana Research // Grafana Dashboard, this should be set to true. EnableResearchVectors bool `default:"false" usage:"enable mana research vectors"` // PruneConsensusEventLogsInterval defines the interval to check and prune consensus event logs storage. PruneConsensusEventLogsInterval time.Duration `default:"5m" usage:"interval to check and prune consensus event storage"` // VectorsCleanupInterval defines the interval to clean empty mana nodes from the base mana vectors. VectorsCleanupInterval time.Duration `default:"30m" usage:"interval to cleanup empty mana nodes from the mana vectors"` // DebuggingEnabled defines if the mana plugin responds to queries while not being in sync or not. DebuggingEnabled bool `default:"false" usage:"if mana plugin responds to queries while not in sync"` // SnapshotResetTime defines if the aMana Snapshot should be reset to the current Time. SnapshotResetTime bool `default:"false" usage:"when loading snapshot reset to current time when true"` }
ManaParametersDefinition contains the definition of the parameters used by the mana plugin.
type ParametersDefinition ¶ added in v0.7.4
type ParametersDefinition struct { // TangleWidth can be used to specify the number of tips the Tangle tries to maintain. TangleWidth int `default:"0" usage:"the width of the Tangle"` // Snapshot contains snapshots related configuration parameters. Snapshot struct { // File is the path to the snapshot file. File string `default:"./snapshot.bin" usage:"the path to the snapshot file"` // GenesisNode is the identity of the node that is allowed to attach to the Genesis message. GenesisNode string `` /* 140-byte string literal not displayed */ } // TangleTimeWindow defines the time window in which the node considers itself as synced according to TangleTime. TangleTimeWindow time.Duration `default:"2m" usage:"the time window in which the node considers itself as synced according to TangleTime"` // StartSynced defines if the node should start as synced. StartSynced bool `default:"false" usage:"start as synced"` }
ParametersDefinition contains the definition of the parameters used by the messagelayer plugin.
type RateSetterParametersDefinition ¶ added in v0.7.4
type RateSetterParametersDefinition struct { // Initial defines the initial rate of rate setting. Initial float64 `default:"100000" usage:"the initial rate of rate setting"` }
RateSetterParametersDefinition contains the definition of the parameters used by the Rate Setter.
type SchedulerParametersDefinition ¶ added in v0.7.4
type SchedulerParametersDefinition struct { // MaxBufferSize defines the maximum buffer size (in bytes). MaxBufferSize int `default:"100000000" usage:"maximum buffer size (in bytes)"` // 100 MB // Rate defines the frequency to schedule a message. `default:"5ms" usage:"message scheduling interval [time duration string]"` Rate string `default:"5ms" usage:"message scheduling interval [time duration string]"` // ConfirmedMessageThreshold time threshold after which confirmed messages are not scheduled [time duration string] ConfirmedMessageThreshold string `default:"1m" usage:"time threshold after which confirmed messages are not scheduled [time duration string]"` }
SchedulerParametersDefinition contains the definition of the parameters used by the Scheduler.