bootstrap

package
v0.0.0-...-5de87d6 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFundPath

func GetFundPath(i int, prefix string) string

GetFundPath generate key file name for composite name

func GetMigrationDaemonPath

func GetMigrationDaemonPath(i int) string

GetMigrationDaemonPath generate key file name for migration daemon

Types

type Config

type Config struct {
	// MembersKeysDir is the root key place.
	MembersKeysDir string `mapstructure:"members_keys_dir" yaml:"members_keys_dir"`
	// DiscoveryKeysDir is a default directory where save keys for discovery nodes.
	DiscoveryKeysDir string `mapstructure:"discovery_keys_dir" yaml:"discovery_keys_dir"`
	// NotDiscoveryKeysDir is a default directory where save keys for discovery nodes.
	NotDiscoveryKeysDir string `mapstructure:"not_discovery_keys_dir" yaml:"not_discovery_keys_dir"`
	// KeysNameFormat is the default key file name format for discovery nodes.
	KeysNameFormat string `mapstructure:"keys_name_format" yaml:"keys_name_format"`
	// ReuseKeys is a flag to reuse discovery nodes keys (don't use if your not understand how it works)
	ReuseKeys bool `mapstructure:"reuse_keys" yaml:"reuse_keys"`

	HeavyGenesisConfigFile string `mapstructure:"heavy_genesis_config_file" yaml:"heavy_genesis_config_file"`
	HeavyGenesisPluginsDir string `mapstructure:"heavy_genesis_plugins_dir" yaml:"heavy_genesis_plugins_dir"`

	// RootBalance is a start balance for the root member's wallet.
	RootBalance string `mapstructure:"root_balance" yaml:"root_balance"`
	// Fee is a transfer from wallet to wallet fee
	Fee string `mapstructure:"fee" yaml:"fee"`
	// MDBalance is a start balance for the migration admin member's wallet.
	MDBalance string `mapstructure:"md_balance" yaml:"md_balance"`
	// VestingPeriodInPulses - interval of count pulses for the full period of partial release.
	VestingPeriodInPulses int64 `mapstructure:"vesting_pulse_period" yaml:"vesting_pulse_period"`
	// VestingPeriodInPulses - interval of count pulses for one step of partial release.
	VestingStepInPulses int64 `mapstructure:"vesting_pulse_step" yaml:"vesting_pulse_step"`
	// LockupPeriodInPulses - interval of count pulses for the full period of hold.
	LockupPeriodInPulses int64 `mapstructure:"lockup_pulse_period" yaml:"lockup_pulse_period"`
	PKShardCount         int   `mapstructure:"pk_shard_count" yaml:"pk_shard_count"`
	MAShardCount         int   `mapstructure:"ma_shard_count" yaml:"ma_shard_count"`
	Contracts            Contracts

	MajorityRule int `mapstructure:"majority_rule" yaml:"majority_rule"`
	MinRoles     struct {
		Virtual       uint `mapstructure:"virtual" yaml:"virtual"`
		HeavyMaterial uint `mapstructure:"heavy_material" yaml:"heavy_material"`
		LightMaterial uint `mapstructure:"light_material" yaml:"light_material"`
	} `mapstructure:"min_roles" yaml:"min_roles"`
	// DiscoveryNodes is a discovery nodes list.
	DiscoveryNodes []Node `mapstructure:"discovery_nodes" yaml:"discovery_nodes"`

	// Nodes is used only by generate_insolar_config.go
	Nodes []Node `mapstructure:"nodes" yaml:"nodes"`

	// PulsarPublicKeys is the pulsar's public keys for pulses validation
	// (not in use, just for future features).
	PulsarPublicKeys []string `mapstructure:"pulsar_public_keys" yaml:"pulsar_public_keys"`
}

Config contains configuration required for bootstrap.

func ParseConfig

func ParseConfig(path string) (*Config, error)

ParseConfig parse bootstrap config.

type Contracts

type Contracts struct {
	// Insgocc is the path to ingocc binary for plugins generation.
	Insgocc string
	// OutDir is the path to directory where plugins so files would be saved.
	OutDir string
}

Contracts contains config for contract's plugins generation.

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

Generator is a component for generating bootstrap files required for discovery nodes bootstrap and heavy genesis.

func NewGenerator

func NewGenerator(configFile, certificatesOutDir string) (*Generator, error)

NewGenerator parses config file and creates new generator on success.

func NewGeneratorWithConfig

func NewGeneratorWithConfig(config *Config, certificatesOutDir string) *Generator

NewGeneratorWithConfig creates new Generator with provided config.

func (*Generator) Run

func (g *Generator) Run(ctx context.Context) error

Run generates bootstrap data.

  1. builds Go plugins for genesis contracts (gone when built-in contracts (INS-2308) would be implemented)
  2. read root keys file and generates keys and certificates for discovery nodes.
  3. generates genesis config for heavy node.

type Node

type Node struct {
	Host string `mapstructure:"host" yaml:"host"`
	Role string `mapstructure:"role" yaml:"role"`
	// KeyName is used for generating keys file for discovery nodes.
	KeyName string `mapstructure:"key_name" yaml:"key_name"`
	// CertName is used for generating cert file for discovery nodes.
	CertName string `mapstructure:"cert_name" yaml:"cert_name"`
	// KeysFile is used to set path to keys file in insolard config for every non-discovery nodes
	// (used only by generate_insolar_config.go).
	KeysFile string `mapstructure:"keys_file" yaml:"keys_file"`
}

Node contains info about discovery nodes.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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