Documentation ¶
Index ¶
- Constants
- Variables
- func AcceptanceGadget() *acceptance.Gadget
- func AwaitBlockToBeBooked(f func() (*tangle.Block, error), txID utxo.TransactionID, ...) (*tangle.Block, error)
- func AwaitBlockToBeIssued(f func() (*tangle.Block, error), issuer ed25519.PublicKey, ...) (*tangle.Block, error)
- 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 GetLatestEC() (ecRecord *epoch.ECRecord, latestConfirmedEpoch epoch.Index, err 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 GetTotalMana(manaType mana.Type, optionalUpdateTime ...time.Time) (float64, time.Time, error)
- func QueryAllowed() (allowed bool)
- type AllowedPledge
- type ManaParametersDefinition
- type NotarizationParametersDefinition
- type ParametersDefinition
- type RateSetterParametersDefinition
- type SchedulerParametersDefinition
Constants ¶
const (
// NotarizationPluginName is the name of the notarization plugin.
NotarizationPluginName = "Notarization"
)
const (
// PluginName is the name of the mana plugin.
PluginName = "Mana"
)
Variables ¶
var ( // ErrBlockWasNotBookedInTime is returned if a block did not get booked within the defined await time. ErrBlockWasNotBookedInTime = errors.New("block could not be booked in time") // ErrBlockWasNotIssuedInTime is returned if a block did not get issued within the defined await time. ErrBlockWasNotIssuedInTime = errors.New("block 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 blocklayer plugin.
var ( // ManaPlugin is the plugin instance of the mana plugin. ManaPlugin = node.NewPlugin(PluginName, nil, node.Enabled, configureManaPlugin, runManaPlugin) )
var NotarizationParameters = &NotarizationParametersDefinition{}
NotarizationParameters contains the configuration used by the notarization plugin.
var (
NotarizationPlugin *node.Plugin
)
var Parameters = &ParametersDefinition{}
Parameters contains the general configuration used by the blocklayer plugin.
var ( // Plugin is the plugin instance of the blocklayer plugin. Plugin *node.Plugin )
var RateSetterParameters = &RateSetterParametersDefinition{}
RateSetterParameters contains the rate setter configuration used by the blocklayer plugin.
var SchedulerParameters = &SchedulerParametersDefinition{}
SchedulerParameters contains the scheduler configuration used by the blocklayer plugin.
Functions ¶
func AcceptanceGadget ¶
func AcceptanceGadget() *acceptance.Gadget
AcceptanceGadget is the finality gadget instance.
func AwaitBlockToBeBooked ¶
func AwaitBlockToBeBooked(f func() (*tangle.Block, error), txID utxo.TransactionID, maxAwait time.Duration) (*tangle.Block, error)
AwaitBlockToBeBooked awaits maxAwait for the given block to get booked.
func AwaitBlockToBeIssued ¶
func AwaitBlockToBeIssued(f func() (*tangle.Block, error), issuer ed25519.PublicKey, maxAwait time.Duration) (*tangle.Block, error)
AwaitBlockToBeIssued awaits maxAwait for the given block to get issued.
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 GetHighestManaNodesFraction ¶
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 GetLatestEC ¶
GetLatestEC returns the latest commitment that a new block should commit to.
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 ¶
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 ¶
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 GetTotalMana ¶
GetTotalMana returns sum of mana of all nodes in the network.
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 ManaParametersDefinition ¶
type ManaParametersDefinition struct { // 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"` // Number of epochs past the latest committable epoch for which the base mana vector becomes effective. EpochDelay uint `default:"2" usage:"number of epochs past the latest committable epoch for which the base mana vector becomes effective"` }
ManaParametersDefinition contains the definition of the parameters used by the mana plugin.
type NotarizationParametersDefinition ¶
type NotarizationParametersDefinition struct { // MinEpochCommitableAge defines the min age of a commitable epoch. MinEpochCommitableAge time.Duration `default:"1m" usage:"min age of a commitable epoch"` // BootstrapWindow when notarization manager is considered to be bootstrapped BootstrapWindow time.Duration `default:"2m" usage:"when notarization manager is considered to be bootstrapped"` // SnapshotDepth defines how many epoch diffs are stored in the snapshot, starting from the full ledgerstate SnapshotDepth int `default:"5" usage:"defines how many epoch diffs are stored in the snapshot, starting from the full ledgerstate"` }
NotarizationParametersDefinition contains the definition of the parameters used by the notarization plugin.
type ParametersDefinition ¶
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"` // TimeSinceConfirmationThreshold is used to set the limit for which tips with old unconfirmed blocks in its past cone will not be selected. TimeSinceConfirmationThreshold time.Duration `default:"1m" usage:"Time Since Confirmation (TSC) threshold"` // 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 block. GenesisNode string `` /* 138-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:"20m" 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"` // GenesisTime resets the genesis time to the specified value, Unix time in seconds. GenesisTime int64 `default:"0" usage:"resets the genesis time to the specified value, unix time in seconds"` }
ParametersDefinition contains the definition of the parameters used by the blocklayer plugin.
type RateSetterParametersDefinition ¶
type RateSetterParametersDefinition struct { // Initial defines the initial rate of rate setting. Initial float64 `default:"0" usage:"the initial rate of rate setting. Set 0 to automatically estimate the value based on access mana."` // RateSettingPause defines for how long to pause updates after decrease of rate. RateSettingPause time.Duration `default:"1s" usage:"for how long to pause updates after decrease of rate"` // Enable is the flag that enables the rate setting mechanism on node startup. Enable bool `default:"true" usage:"whether to enable rate setter"` }
RateSetterParametersDefinition contains the definition of the parameters used by the Rate Setter.
type SchedulerParametersDefinition ¶
type SchedulerParametersDefinition struct { // MaxBufferSize defines the maximum buffer size (in number of blocks). MaxBufferSize int `default:"300" usage:"maximum buffer size (in number of blocks)"` // 300 blocks // Rate defines the frequency to schedule a block. Rate string `default:"34ms" usage:"block scheduling interval [time duration string]"` // 29.4 blocks per second // ConfirmedBlockThreshold time threshold after which confirmed blocks are not scheduled [time duration string] ConfirmedBlockThreshold string `default:"1m" usage:"time threshold after which confirmed blocks are not scheduled [time duration string]"` }
SchedulerParametersDefinition contains the definition of the parameters used by the Scheduler.