nodeconfig

package
v1.3.10 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package nodeconfig includes all the configuration variables for a node. It is a global configuration for node and other services. It will be included in node module, and other modules.

Index

Constants

View Source
const (
	Mainnet   = "mainnet"
	Testnet   = "testnet"
	Pangaea   = "pangaea"
	Partner   = "partner"
	Stressnet = "stressnet"
	Devnet    = "devnet"
	Localnet  = "localnet"
)

Constants for NetworkType

View Source
const (
	Global    = 0
	MaxShards = 32 // maximum number of shards. It is also the maxium number of configs.
)

Global is the index of the global node configuration

Variables

This section is empty.

Functions

func GetPublicRPC

func GetPublicRPC() bool

GetPublicRPC get the boolean value of public RPC access

func GetVersion

func GetVersion() string

GetVersion return the version of the node binary

func SetDefaultRole added in v1.3.0

func SetDefaultRole(r Role)

SetDefaultRole ..

func SetNetworkType

func SetNetworkType(networkType NetworkType)

SetNetworkType set the networkType

func SetPublicRPC

func SetPublicRPC(v bool)

SetPublicRPC set the boolean value of public RPC access

func SetShardingSchedule added in v1.3.0

func SetShardingSchedule(schedule shardingconfig.Schedule)

SetShardingSchedule sets the sharding schedule for all config instances.

func SetVersion

func SetVersion(ver string)

SetVersion set the version of the node binary

Types

type ActionType

type ActionType uint

ActionType lists action on group

const (
	ActionStart ActionType = iota
	ActionPause
	ActionResume
	ActionStop
	ActionUnknown
)

Const of different Action type

func (ActionType) String

func (a ActionType) String() string

type ConfigType

type ConfigType struct {
	ShardID uint32 // ShardID of this node; TODO ek – revisit when resharding

	Port            string // Port of the node.
	IP              string // IP of the node.
	StringRole      string
	P2PPriKey       p2p_crypto.PrivKey
	ConsensusPriKey *multibls.PrivateKey
	ConsensusPubKey *multibls.PublicKey
	// Database directory
	DBDir string

	DNSZone string

	WebHooks struct {
		Hooks *webhooks.Hooks
	}
	// contains filtered or unexported fields
}

ConfigType is the structure of all node related configuration variables

func GetDefaultConfig

func GetDefaultConfig() *ConfigType

GetDefaultConfig returns default config.

func GetShardConfig

func GetShardConfig(shardID uint32) *ConfigType

GetShardConfig return the shard's ConfigType variable

func (*ConfigType) GetArchival added in v1.2.5

func (conf *ConfigType) GetArchival() bool

GetArchival returns archival mode

func (*ConfigType) GetBeaconGroupID

func (conf *ConfigType) GetBeaconGroupID() GroupID

GetBeaconGroupID returns the groupID for beacon group

func (*ConfigType) GetClientGroupID

func (conf *ConfigType) GetClientGroupID() GroupID

GetClientGroupID returns the groupID for client group

func (*ConfigType) GetNetworkType

func (conf *ConfigType) GetNetworkType() NetworkType

GetNetworkType gets the networkType

func (*ConfigType) GetShardGroupID

func (conf *ConfigType) GetShardGroupID() GroupID

GetShardGroupID returns the groupID for shard group

func (*ConfigType) GetShardID

func (conf *ConfigType) GetShardID() uint32

GetShardID returns the shardID.

func (*ConfigType) IsClient

func (conf *ConfigType) IsClient() bool

IsClient returns the isClient configuration

func (*ConfigType) Role

func (conf *ConfigType) Role() Role

Role returns the role

func (*ConfigType) SetArchival added in v1.2.5

func (conf *ConfigType) SetArchival(archival bool)

SetArchival set archival mode

func (*ConfigType) SetBeaconGroupID

func (conf *ConfigType) SetBeaconGroupID(g GroupID)

SetBeaconGroupID set the groupID for beacon group

func (*ConfigType) SetClientGroupID

func (conf *ConfigType) SetClientGroupID(g GroupID)

SetClientGroupID set the groupID for client group

func (*ConfigType) SetIsClient

func (conf *ConfigType) SetIsClient(b bool)

SetIsClient set the isClient configuration

func (*ConfigType) SetRole

func (conf *ConfigType) SetRole(r Role)

SetRole set the role

func (*ConfigType) SetShardGroupID

func (conf *ConfigType) SetShardGroupID(g GroupID)

SetShardGroupID set the groupID for shard group

func (*ConfigType) SetShardID

func (conf *ConfigType) SetShardID(s uint32)

SetShardID set the ShardID

func (*ConfigType) SetShardingSchedule added in v1.3.0

func (conf *ConfigType) SetShardingSchedule(schedule shardingconfig.Schedule)

SetShardingSchedule sets the sharding schedule for this node config.

func (*ConfigType) ShardIDFromConsensusKey added in v1.3.0

func (conf *ConfigType) ShardIDFromConsensusKey() (uint32, error)

ShardIDFromConsensusKey returns the shard ID statically determined from the consensus key.

func (*ConfigType) ShardIDFromKey added in v1.3.8

func (conf *ConfigType) ShardIDFromKey(key *bls.PublicKey) (uint32, error)

ShardIDFromKey returns the shard ID statically determined from the input key

func (*ConfigType) ShardingSchedule added in v1.3.0

func (conf *ConfigType) ShardingSchedule() shardingconfig.Schedule

ShardingSchedule returns the sharding schedule for this node config.

func (*ConfigType) String

func (conf *ConfigType) String() string

func (*ConfigType) ValidateConsensusKeysForSameShard added in v1.3.4

func (conf *ConfigType) ValidateConsensusKeysForSameShard(pubkeys []*bls.PublicKey, sID uint32) error

ValidateConsensusKeysForSameShard checks if all consensus public keys belong to the same shard

type GroupAction

type GroupAction struct {
	Name   GroupID
	Action ActionType
}

GroupAction specify action on corresponding group

func (GroupAction) String

func (g GroupAction) String() string

type GroupID

type GroupID string

GroupID is a multicast group ID.

It is a binary string, conducive to layering and scoped generation using cryptographic hash.

Applications define their own group ID, without central allocation. A cryptographically secure random string of enough length – 32 bytes for example – may be used.

const (
	GroupIDBeacon            GroupID = "%s/0.0.1/node/beacon"
	GroupIDBeaconClient      GroupID = "%s/0.0.1/client/beacon"
	GroupIDShardPrefix       GroupID = "%s/0.0.1/node/shard/%s"
	GroupIDShardClientPrefix GroupID = "%s/0.0.1/client/shard/%s"
	GroupIDGlobal            GroupID = "%s/0.0.1/node/global"
	GroupIDGlobalClient      GroupID = "%s/0.0.1/node/global"
	GroupIDUnknown           GroupID = "%s/B1acKh0lE"
)

Const of group ID

func NewClientGroupIDByShardID

func NewClientGroupIDByShardID(shardID ShardID) GroupID

NewClientGroupIDByShardID returns a new groupID for a shard's client

func NewGroupIDByShardID

func NewGroupIDByShardID(shardID ShardID) GroupID

NewGroupIDByShardID returns a new groupID for a shard

func (GroupID) String

func (id GroupID) String() string

type NetworkType

type NetworkType string

NetworkType describes the type of Harmony network

func (NetworkType) ChainConfig added in v1.3.0

func (t NetworkType) ChainConfig() params.ChainConfig

ChainConfig returns the chain configuration for the network type.

type Role

type Role byte

Role defines a role of a node.

const (
	Unknown Role = iota
	Validator
	ExplorerNode
)

All constants for different node roles.

func (Role) String

func (role Role) String() string

type ShardID

type ShardID uint32

ShardID defines the ID of a shard

Jump to

Keyboard shortcuts

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