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
- func GetPublicRPC() bool
- func GetVersion() string
- func SetConfigs(config ConfigType, shardID uint32) error
- func SetNetworkType(networkType NetworkType)
- func SetPublicRPC(v bool)
- func SetVersion(ver string)
- type ActionType
- type ConfigType
- func (conf *ConfigType) GetBeaconGroupID() GroupID
- func (conf *ConfigType) GetClientGroupID() GroupID
- func (conf *ConfigType) GetMetricsFlag() bool
- func (conf *ConfigType) GetNetworkType() NetworkType
- func (conf *ConfigType) GetPushgatewayIP() string
- func (conf *ConfigType) GetPushgatewayPort() string
- func (conf *ConfigType) GetShardGroupID() GroupID
- func (conf *ConfigType) GetShardID() uint32
- func (conf *ConfigType) IsClient() bool
- func (conf *ConfigType) Role() Role
- func (conf *ConfigType) SetBeaconGroupID(g GroupID)
- func (conf *ConfigType) SetClientGroupID(g GroupID)
- func (conf *ConfigType) SetIsClient(b bool)
- func (conf *ConfigType) SetMetricsFlag(flag bool)
- func (conf *ConfigType) SetPushgatewayIP(ip string)
- func (conf *ConfigType) SetPushgatewayPort(port string)
- func (conf *ConfigType) SetRole(r Role)
- func (conf *ConfigType) SetShardGroupID(g GroupID)
- func (conf *ConfigType) SetShardID(s uint32)
- func (conf *ConfigType) String() string
- type GroupAction
- type GroupID
- type NetworkType
- type Role
- type ShardID
Constants ¶
const ( Mainnet = "mainnet" Testnet = "testnet" Pangaea = "pangaea" Devnet = "devnet" Localnet = "localnet" )
Constants for NetworkType
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 SetConfigs ¶
func SetConfigs(config ConfigType, shardID uint32) error
SetConfigs set ConfigType in the right index.
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
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 – reviisit when resharding Port string // Port of the node. IP string // IP of the node. MetricsFlag bool // collect and upload metrics flag PushgatewayIP string // metrics pushgateway prometheus ip PushgatewayPort string // metrics pushgateway prometheus port StringRole string StakingPriKey *ecdsa.PrivateKey P2pPriKey p2p_crypto.PrivKey ConsensusPriKey *bls.SecretKey ConsensusPubKey *bls.PublicKey // Database directory DBDir string // 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) 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) GetMetricsFlag ¶
func (conf *ConfigType) GetMetricsFlag() bool
GetMetricsFlag get the metrics flag
func (*ConfigType) GetNetworkType ¶
func (conf *ConfigType) GetNetworkType() NetworkType
GetNetworkType gets the networkType
func (*ConfigType) GetPushgatewayIP ¶
func (conf *ConfigType) GetPushgatewayIP() string
GetPushgatewayIP get the pushgateway ip
func (*ConfigType) GetPushgatewayPort ¶
func (conf *ConfigType) GetPushgatewayPort() string
GetPushgatewayPort get the pushgateway port
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) 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) SetMetricsFlag ¶
func (conf *ConfigType) SetMetricsFlag(flag bool)
SetMetricsFlag set the metrics flag
func (*ConfigType) SetPushgatewayIP ¶
func (conf *ConfigType) SetPushgatewayIP(ip string)
SetPushgatewayIP set the pushgateway ip
func (*ConfigType) SetPushgatewayPort ¶
func (conf *ConfigType) SetPushgatewayPort(port string)
SetPushgatewayPort set the pushgateway port
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) String ¶
func (conf *ConfigType) String() string
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 ¶
NewClientGroupIDByShardID returns a new groupID for a shard's client
func NewGroupIDByShardID ¶
NewGroupIDByShardID returns a new groupID for a shard