Documentation ¶
Index ¶
- Constants
- Variables
- func CalculateHash(marshalizer marshal.Marshalizer, hasher hashing.Hasher, object interface{}) ([]byte, error)
- func ConvertBytes(bytes uint64) string
- func CreateFile(prefix string, subfolder string, fileExtension string) (*os.File, error)
- func GetTrimmedPk(pk string) string
- func LoadJsonFile(dest interface{}, relativePath string, log *logger.Logger) error
- func LoadP2PConfig(filepath string) (*config.P2PConfig, error)
- func LoadServersPConfig(filepath string) (*config.ServersConfig, error)
- func LoadSkFromPemFile(relativePath string, log *logger.Logger, skIndex int) ([]byte, error)
- func LoadTomlFile(dest interface{}, relativePath string, log *logger.Logger) error
- func Max(a uint32, b uint32) uint32
- func OpenFile(relativePath string, log *logger.Logger) (*os.File, error)
- func SaveSkToPemFile(file *os.File, identifier string, skBytes []byte) error
- func ToB64(buff []byte) string
- func ToHex(buff []byte) string
- type AppStatusHandler
- type ConnectedAddressesHandler
- type NodeType
Constants ¶
const ConsensusTopic = "consensus"
ConsensusTopic is the topic used in consensus algorithm
const GenesisBlockNonce = 0
GenesisBlockNonce is the nonce of the genesis block
const MaxBulkTransactionSize = 2 << 17 //128KB bulks
MaxBulkTransactionSize specifies the maximum size of one bulk with txs which can be send over the network TODO convert this const into a var and read it from config when this code moves to another binary
const MetricAppVersion = "erd_app_version"
MetricAppVersion is the metric for the current app version
const MetricConnectedNodes = "erd_connected_nodes"
MetricConnectedNodes is the metric for monitoring total connected peers on the network
const MetricCountAcceptedBlocks = "erd_count_accepted_blocks"
MetricCountAcceptedBlocks is the metric for monitoring number of blocks that was accepted proposed by a node
const MetricCountConsensus = "erd_count_consensus"
MetricCountConsensus is the metric for monitoring number of rounds when a node was in consensus group
const MetricCountLeader = "erd_count_leader"
MetricCountLeader is the metric for monitoring number of rounds when a node was leader
const MetricCpuLoadPercent = "erd_cpu_load_percent"
MetricCpuLoadPercent is the metric for monitoring CPU load [%]
const MetricCurrentRound = "erd_current_round"
MetricCurrentRound is the metric for monitoring the current round of a node
const MetricIsSyncing = "erd_is_syncing"
MetricIsSyncing is the metric for monitoring if a node is syncing
const MetricLiveValidatorNodes = "erd_max_validator_nodes"
MetricLiveValidatorNodes is the metric for monitoring live validators on the network
const MetricMemLoadPercent = "erd_mem_load_percent"
MetricMemLoadPercent is the metric for monitoring memory load [%]
const MetricNetworkRecvBps = "erd_network_recv_bps"
MetricNetworkRecvBps is the metric for monitoring network received bytes per second
const MetricNetworkRecvBpsPeak = "erd_network_recv_bps_peak"
MetricNetworkRecvBpsPeak is the metric for monitoring network received peak bytes per second
const MetricNetworkRecvPercent = "erd_network_recv_percent"
MetricNetworkRecvPercent is the metric for monitoring network receive load [%]
const MetricNetworkSentBps = "erd_network_sent_bps"
MetricNetworkSentBps is the metric for monitoring network sent bytes per second
const MetricNetworkSentBpsPeak = "erd_network_sent_bps_peak"
MetricNetworkSentBpsPeak is the metric for monitoring network sent peak bytes per second
const MetricNetworkSentPercent = "erd_network_sent_percent"
MetricNetworkSentPercent is the metric for monitoring network sent load [%]
const MetricNodeType = "erd_node_type"
MetricNodeType is the metric for monitoring the type of the node
const MetricNonce = "erd_nonce"
MetricNonce is the metric for monitoring the nonce of a node
const MetricNumConnectedPeers = "erd_num_connected_peers"
MetricNumConnectedPeers is the metric for monitoring the number of connected peers
const MetricProbableHighestNonce = "erd_probable_highest_nonce"
MetricProbableHighestNonce is the metric for monitoring the max speculative nonce received by the node by listening on the network
const MetricPublicKeyBlockSign = "erd_public_key_block_sign"
MetricPublicKeyBlockSign is the metric for monitoring public key of a node used in block signing
const MetricPublicKeyTxSign = "erd_public_key_tx_sign"
MetricPublicKeyTxSign is the metric for monitoring public key of a node used in tx signing (balance account held by the node)
const MetricRoundTime = "erd_round_time"
MetricRoundTime is the metric for round time in seconds
const MetricShardId = "erd_shard_id"
MetricShardId is the metric for monitoring shard id of a node
const MetricSynchronizedRound = "erd_synchronized_round"
MetricSynchronizedRound is the metric for monitoring the synchronized round of a node
const MetricTotalMem = "erd_total_mem"
MetricTotalMem is the metric for monitoring total memory bytes
const MetricTxPoolLoad = "erd_tx_pool_load"
MetricTxPoolLoad is the metric for monitoring number of transactions from pool of a node
const UnVersionedAppString = "undefined"
UnVersionedAppString represents the default app version that indicate that the binary wasn't build by setting the appVersion flag
Variables ¶
var ErrEmptyFile = errors.New("empty file provided")
ErrEmptyFile signals that a empty file has been provided
var ErrInvalidIndex = errors.New("invalid private key index")
ErrInvalidIndex signals that an invalid private key index has been provided
var ErrInvalidValue = errors.New("invalid value provided")
ErrInvalidValue signals that a nil value has been provided
var ErrNilCoordinator = errors.New("nil coordinator provided")
ErrNilCoordinator signals that a nil shardCoordinator has been provided
var ErrNilFile = errors.New("nil file provided")
ErrNilFile signals that a nil file has been provided
var ErrNilHasher = errors.New("nil hashser provided")
ErrNilHasher signals that a nil marshalizer has been provided
var ErrNilInputData = errors.New("nil input data")
ErrNilInputData signals that a nil data has been provided
var ErrNilLogger = errors.New("nil logger provided")
ErrNilLogger signals that a nil logger has been provided
var ErrNilMarshalizer = errors.New("nil marshalizer provided")
ErrNilMarshalizer signals that a nil marshalizer has been provided
var ErrNilUrl = errors.New("url is empty")
ErrNilUrl signals that the provided url is empty
var ErrPemFileIsInvalid = errors.New("pem file is invalid")
ErrPemFileIsInvalid signals that a pem file is invalid
var ErrWrongTypeAssertion = errors.New("wrong type assertion")
ErrWrongTypeAssertion signals that an type assertion failed
Functions ¶
func CalculateHash ¶
func CalculateHash( marshalizer marshal.Marshalizer, hasher hashing.Hasher, object interface{}, ) ([]byte, error)
CalculateHash marshalizes the interface and calculates its hash
func ConvertBytes ¶
ConvertBytes converts the input bytes in a readable string using multipliers (k, M, G)
func CreateFile ¶
CreateFile opens or creates a file relative to the default path
func GetTrimmedPk ¶
GetTrimmedPk returns a trimmed string to the pkPrefixSize value
func LoadJsonFile ¶
LoadJsonFile method to open and decode json file
func LoadP2PConfig ¶
LoadP2PConfig returns a P2PConfig by reading the config file provided
func LoadServersPConfig ¶ added in v1.0.3
func LoadServersPConfig(filepath string) (*config.ServersConfig, error)
LoadServersPConfig returns a ServersConfig by reading the config file provided
func LoadSkFromPemFile ¶ added in v1.0.3
LoadSkFromPemFile loads the secret key bytes stored in the file
func LoadTomlFile ¶
LoadTomlFile method to open and decode toml file
func SaveSkToPemFile ¶
SaveSkToPemFile saves secret key bytes in the file
Types ¶
type AppStatusHandler ¶
type AppStatusHandler interface { IsInterfaceNil() bool Increment(key string) Decrement(key string) SetInt64Value(key string, value int64) SetUInt64Value(key string, value uint64) SetStringValue(key string, value string) Close() }
AppStatusHandler interface will handle different implementations of monitoring tools, such as Prometheus of term-ui
type ConnectedAddressesHandler ¶
type ConnectedAddressesHandler interface {
ConnectedAddresses() []string
}
ConnectedAddressesHandler interface will be used for passing the network component to AppStatusPolling
type NodeType ¶
type NodeType string
NodeType represents the node's role in the network
const NodeTypeObserver NodeType = "observer"
NodeTypeObserver signals that a node is running as observer node
const NodeTypeValidator NodeType = "validator"
NodeTypeValidator signals that a node is running as validator node