Documentation ¶
Index ¶
- Variables
- type ChainConfig
- type ChainParameters
- type Manager
- type ManagerConfig
- type MockManager
- func (mm MockManager) AddRegistrant(Registrant)
- func (mm MockManager) Alias(ids.ID, string) error
- func (mm MockManager) Aliases(ids.ID) []string
- func (mm MockManager) CreateChain(ChainParameters)
- func (mm MockManager) ForceCreateChain(ChainParameters)
- func (mm MockManager) IsBootstrapped(ids.ID) bool
- func (mm MockManager) Lookup(s string) (ids.ID, error)
- func (mm MockManager) LookupVM(s string) (ids.ID, error)
- func (mm MockManager) Router() router.Router
- func (mm MockManager) Shutdown()
- func (mm MockManager) SubnetID(ids.ID) (ids.ID, error)
- type Registrant
- type Subnet
Constants ¶
This section is empty.
Variables ¶
View Source
var (
BootstrappedKey = []byte{0x00}
)
Functions ¶
This section is empty.
Types ¶
type ChainConfig ¶
ChainConfig is configuration settings for the current execution. [Config] is the user-provided config blob for the chain. [Upgrade] is a chain-specific blob for coordinating upgrades.
type ChainParameters ¶
type ChainParameters struct { ID ids.ID // The ID of the chain being created SubnetID ids.ID // ID of the subnet that validates this chain GenesisData []byte // The genesis data of this chain's ledger VMAlias string // The ID of the vm this chain is running FxAliases []string // The IDs of the feature extensions this chain is running CustomBeacons validators.Set // Should only be set if the default beacons can't be used. }
ChainParameters defines the chain being created
type Manager ¶
type Manager interface { // Return the router this Manager is using to route consensus messages to chains Router() router.Router // Create a chain in the future CreateChain(ChainParameters) // Create a chain now ForceCreateChain(ChainParameters) // Add a registrant [r]. Every time a chain is // created, [r].RegisterChain([new chain]) is called. AddRegistrant(Registrant) // Given an alias, return the ID of the chain associated with that alias Lookup(string) (ids.ID, error) // Given an alias, return the ID of the VM associated with that alias LookupVM(string) (ids.ID, error) // Return the aliases associated with a chain Aliases(ids.ID) []string // Add an alias to a chain Alias(ids.ID, string) error // Returns the ID of the subnet that is validating the provided chain SubnetID(chainID ids.ID) (ids.ID, error) // Returns true iff the chain with the given ID exists and is finished bootstrapping IsBootstrapped(ids.ID) bool Shutdown() }
Manager manages the chains running on this node. It can:
- Create a chain
- Add a registrant. When a chain is created, each registrant calls RegisterChain with the new chain as the argument.
- Get the aliases associated with a given chain.
- Get the ID of the chain associated with a given alias.
type ManagerConfig ¶
type ManagerConfig struct { StakingEnabled bool // True iff the network has staking enabled Log logging.Logger LogFactory logging.Factory VMManager vms.Manager // Manage mappings from vm ID --> vm DecisionEvents *triggers.EventDispatcher ConsensusEvents *triggers.EventDispatcher DBManager dbManager.Manager Router router.Router // Routes incoming messages to the appropriate chain Net network.Network // Sends consensus messages to other validators ConsensusParams avcon.Parameters // The consensus parameters (alpha, beta, etc.) for new chains EpochFirstTransition time.Time EpochDuration time.Duration Validators validators.Manager // Validators validating on this chain NodeID ids.ShortID // The ID of this node NetworkID uint32 // ID of the network this node is connected to Server *server.Server // Handles HTTP API calls Keystore keystore.Keystore AtomicMemory *atomic.Memory DJTXAssetID ids.ID XChainID ids.ID CriticalChains ids.Set // Chains that can't exit gracefully WhitelistedSubnets ids.Set // Subnets to validate TimeoutManager *timeout.Manager // Manages request timeouts when sending messages to other validators HealthService health.Service RetryBootstrap bool // Should Bootstrap be retried RetryBootstrapMaxAttempts int // Max number of times to retry bootstrap ChainConfigs map[string]ChainConfig // alias -> ChainConfig // If true, shut down the node after the Primary Network has bootstrapped // and use [FetchOnlyFrom] as beacons FetchOnly bool // [FetchOnlyFrom] ignored unless [FetchOnly] is true FetchOnlyFrom validators.Set // ShutdownNodeFunc allows the chain manager to issue a request to shutdown the node ShutdownNodeFunc func(exitCode int) MeterVMEnabled bool // Should each VM be wrapped with a MeterVM // Max Time to spend fetching a container and its // ancestors when responding to a GetAncestors BootstrapMaxTimeGetAncestors time.Duration // Max number of containers in a multiput message sent by this node. BootstrapMultiputMaxContainersSent int // This node will only consider the first [MultiputMaxContainersReceived] // containers in a multiput it receives. BootstrapMultiputMaxContainersReceived int }
type MockManager ¶
type MockManager struct{}
MockManager implements Manager but does nothing. Always returns nil error. To be used only in tests
func (MockManager) AddRegistrant ¶
func (mm MockManager) AddRegistrant(Registrant)
func (MockManager) CreateChain ¶
func (mm MockManager) CreateChain(ChainParameters)
func (MockManager) ForceCreateChain ¶
func (mm MockManager) ForceCreateChain(ChainParameters)
func (MockManager) IsBootstrapped ¶
func (mm MockManager) IsBootstrapped(ids.ID) bool
func (MockManager) Router ¶
func (mm MockManager) Router() router.Router
func (MockManager) Shutdown ¶
func (mm MockManager) Shutdown()
type Registrant ¶
type Registrant interface { // Called when the chain described by [ctx] and [engine] is created // This function is called before the chain starts processing messages // [engine] should be an avalanche.Engine or snowman.Engine RegisterChain(name string, ctx *snow.Context, engine common.Engine) }
Registrant can register the existence of a chain
Click to show internal directories.
Click to hide internal directories.