config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2019 License: LGPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package config provides DAG configuration helper methods and structs. Most notably, config provides the DagConfig struct, that of which is used to specify supply allocations, the dag identifier, and other metadata.

Package config provides DAG configuration helper methods and structs. Most notably, config provides the DagConfig struct, that of which is used to specify supply allocations, the dag identifier, and other metadata.

Index

Constants

This section is empty.

Variables

View Source
var (
	// DagConfigRequest represents the global dag config request message byte value.
	DagConfigRequest = []byte("dag_config_req")
)
View Source
var (
	// ErrCouldNotDeserializeConfig represents an invalidly serialized dag config--that of which cannot be correctly deserialized.
	ErrCouldNotDeserializeConfig = errors.New("could not deserialize dag config")
)

Functions

This section is empty.

Types

type DagConfig

type DagConfig struct {
	Alloc map[string]float64 `json:"alloc"` // Account balances at genesis

	Identifier string `json:"identifier"` // Dag/network name (e.g. "mainnet_beta", "mainnet_alpha")

	Network uint64 `json:"network"` // Dag version (e.g. 0 => mainnet, 1 => testnet, etc...)
}

DagConfig represents a DAG configuration.

func DagConfigFromBytes

func DagConfigFromBytes(b []byte) *DagConfig

DagConfigFromBytes deserializes a dag config from the given byte array b.

func NewDagConfig

func NewDagConfig(alloc map[string]float64, identifier string, network uint64) *DagConfig

NewDagConfig initializes a new DagConfig from a given set of parameters.

func NewDagConfigFromGenesis

func NewDagConfigFromGenesis(genesisFilePath string) (*DagConfig, error)

NewDagConfigFromGenesis generates a new DagConfig from the given genesis.json file.

func ReadDagConfigFromMemory

func ReadDagConfigFromMemory(identifier string) (*DagConfig, error)

ReadDagConfigFromMemory reads a dag config with the given identifier from persistent memory.

func (*DagConfig) Bytes

func (dagConfig *DagConfig) Bytes() []byte

Bytes serializes a given dag config to a byte array via json.

func (*DagConfig) String

func (dagConfig *DagConfig) String() string

String serializes a given dag config to a string via json.

func (*DagConfig) WriteToMemory

func (dagConfig *DagConfig) WriteToMemory() error

WriteToMemory writes the given dag config to persistent memory.

Jump to

Keyboard shortcuts

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