Documentation ¶
Index ¶
- Constants
- Variables
- func AbsDuration(duration time.Duration) time.Duration
- func CalculateHash(marshalizer marshal.Marshalizer, hasher hashing.Hasher, object interface{}) ([]byte, error)
- func CommunicationIdentifierBetweenShards(shardId1 uint32, shardId2 uint32) string
- func ConvertBytes(bytes uint64) string
- func ConvertShardIDToUint32(shardIDStr string) (uint32, error)
- func ConvertToEvenHex(value int) string
- func ConvertToEvenHexBigInt(value *big.Int) string
- func CreateFile(arg ArgCreateFileArgument) (*os.File, error)
- func DumpGoRoutinesToLog(goRoutinesNumberStart int, log Logger)
- func EmptyChannel(ch chan bool) int
- func EpochStartIdentifier(epoch uint32) string
- func FileExists(path string) bool
- func GetAnonymizedMachineID(appID string) string
- func GetApproximatePercentageOfValue(value *big.Int, percentage float64) *big.Int
- func GetIntTrimmedPercentageOfValue(value *big.Int, percentage float64) *big.Int
- func GetPBFTFallbackThreshold(consensusSize int) int
- func GetPBFTThreshold(consensusSize int) int
- func GetRunningGoRoutines(log Logger) *bytes.Buffer
- func GetShardIDString(shardID uint32) string
- func GetTrimmedPk(pk string) string
- func IsEmptyAddress(address []byte) bool
- func IsInRangeInclusive(value, min, max *big.Int) bool
- func IsInRangeInclusiveFloat64(value, min, max float64) bool
- func IsMetachainIdentifier(identifier []byte) bool
- func IsSmartContractAddress(rcvAddress []byte) bool
- func IsSmartContractOnMetachain(identifier []byte, rcvAddress []byte) bool
- func IsSystemAccountAddress(address []byte) bool
- func IsUnknownEpochIdentifier(identifier []byte) (bool, error)
- func IsValidDCTRole(role string) bool
- func LoadJsonFile(dest interface{}, relativePath string) error
- func LoadSkPkFromPemFile(relativePath string, skIndex int) ([]byte, string, error)
- func LoadTomlFile(dest interface{}, relativePath string) error
- func LoadTomlFileToMap(relativePath string) (map[string]interface{}, error)
- func MaxFloat64(a float64, b float64) float64
- func MaxInt(a int, b int) int
- func MaxInt32(a int32, b int32) int32
- func MaxInt64(a int64, b int64) int64
- func MaxUint32(a uint32, b uint32) uint32
- func MaxUint64(a uint64, b uint64) uint64
- func MinInt(a int, b int) int
- func MinInt32(a int32, b int32) int32
- func MinInt64(a int64, b int64) int64
- func MinUint32(a uint32, b uint32) uint32
- func MinUint64(a uint64, b uint64) uint64
- func OpenFile(relativePath string) (*os.File, error)
- func SafeAddUint64(a, b uint64) (uint64, error)
- func SafeMul(a uint64, b uint64) *big.Int
- func SafeSubUint64(a, b uint64) (uint64, error)
- func SaveSkToPemFile(file *os.File, identifier string, skBytes []byte) error
- func SecondsToHourMinSec(input int) string
- func ShardIdToString(shardId uint32) string
- func UniqueIdentifier() string
- type Accumulator
- type AppStatusHandler
- type ArgCreateFileArgument
- type ConnectedAddressesHandler
- type DCTType
- type EpochNotifier
- type EpochSubscriberHandler
- type GasScheduleNotifier
- type GasScheduleSubscribeHandler
- type KeyLoader
- type KeyValueHolder
- type Logger
- type NodeType
- type NodeTypeProviderHandler
- type OptionalUint32
- type OptionalUint64
- type P2PPeerInfo
- type P2PPeerSubType
- type P2PPeerType
- type PeerID
- type PeerTopicType
- type PubkeyConverter
- type QueryP2PPeerInfo
- type Queue
- type SafeCloser
- type StopWatch
- func (sw *StopWatch) Add(src *StopWatch)
- func (sw *StopWatch) GetMeasurement(identifier string) time.Duration
- func (sw *StopWatch) GetMeasurements() []interface{}
- func (sw *StopWatch) GetMeasurementsMap() map[string]float64
- func (sw *StopWatch) Start(identifier string)
- func (sw *StopWatch) Stop(identifier string)
- type Throttler
- type TimersScheduler
- type WatchdogTimer
Constants ¶
const AllShardId = uint32(0xFFFFFFF0)
AllShardId will be used to identify that a message is for all shards
const BaseOperationCostString = "BaseOperationCost"
BaseOperationCostString represents the field name for base operation costs
const BuiltInCostString = "BuiltInCost"
BuiltInCostString represents the field name for built in operation costs
const BuiltInFunctionChangeOwnerAddress = "ChangeOwnerAddress"
BuiltInFunctionChangeOwnerAddress is the key for the change owner built in function built-in function
const BuiltInFunctionClaimDeveloperRewards = "ClaimDeveloperRewards"
BuiltInFunctionClaimDeveloperRewards is the key for the claim developer rewards built-in function
const BuiltInFunctionDCTBurn = "DCTBurn"
BuiltInFunctionDCTBurn is the key for the Dharitri Core Token burn built-in function
const BuiltInFunctionDCTFreeze = "DCTFreeze"
BuiltInFunctionDCTFreeze is the key for the Dharitri Core Token freeze built-in function
const BuiltInFunctionDCTLocalBurn = "DCTLocalBurn"
BuiltInFunctionDCTLocalBurn is the key for the Dharitri Core Token local burn built-in function
const BuiltInFunctionDCTLocalMint = "DCTLocalMint"
BuiltInFunctionDCTLocalMint is the key for the Dharitri Core Token local mint built-in function
const BuiltInFunctionDCTNFTAddQuantity = "DCTNFTAddQuantity"
BuiltInFunctionDCTNFTAddQuantity is the key for the Dharitri Core Token NFT add quantity built-in function
const BuiltInFunctionDCTNFTAddURI = "DCTNFTAddURI"
BuiltInFunctionDCTNFTAddURI is the key for the Dharitri Core Token NFT add URI built-in function
const BuiltInFunctionDCTNFTBurn = "DCTNFTBurn"
BuiltInFunctionDCTNFTBurn is the key for the Dharitri Core Token NFT burn built-in function
const BuiltInFunctionDCTNFTCreate = "DCTNFTCreate"
BuiltInFunctionDCTNFTCreate is the key for the Dharitri Core Token NFT create built-in function
const BuiltInFunctionDCTNFTCreateRoleTransfer = "DCTNFTCreateRoleTransfer"
BuiltInFunctionDCTNFTCreateRoleTransfer is the key for the Dharitri Core Token create role transfer function
const BuiltInFunctionDCTNFTTransfer = "DCTNFTTransfer"
BuiltInFunctionDCTNFTTransfer is the key for the Dharitri Core Token NFT transfer built-in function
const BuiltInFunctionDCTNFTUpdateAttributes = "DCTNFTUpdateAttributes"
BuiltInFunctionDCTNFTUpdateAttributes is the key for the Dharitri Core Token NFT update attributes built-in function
const BuiltInFunctionDCTPause = "DCTPause"
BuiltInFunctionDCTPause is the key for the Dharitri Core Token pause built-in function
const BuiltInFunctionDCTSetLimitedTransfer = "DCTSetLimitedTransfer"
BuiltInFunctionDCTSetLimitedTransfer is the key for the Dharitri Core Token built-in function which sets the property for the token to be transferable only through accounts with transfer roles
const BuiltInFunctionDCTTransfer = "DCTTransfer"
BuiltInFunctionDCTTransfer is the key for the Dharitri Core Token transfer built-in function
const BuiltInFunctionDCTUnFreeze = "DCTUnFreeze"
BuiltInFunctionDCTUnFreeze is the key for the Dharitri Core Token unfreeze built-in function
const BuiltInFunctionDCTUnPause = "DCTUnPause"
BuiltInFunctionDCTUnPause is the key for the Dharitri Core Token unpause built-in function
const BuiltInFunctionDCTUnSetLimitedTransfer = "DCTUnSetLimitedTransfer"
BuiltInFunctionDCTUnSetLimitedTransfer is the key for the Dharitri Core Token built-in function which unsets the property for the token to be transferable only through accounts with transfer roles
const BuiltInFunctionDCTWipe = "DCTWipe"
BuiltInFunctionDCTWipe is the key for the Dharitri Core Token wipe built-in function
const BuiltInFunctionFreezeAccount = "FreezeAccount"
BuiltInFunctionFreezeAccount is the built-in function key for freezing an account
const BuiltInFunctionMultiDCTNFTTransfer = "MultiDCTNFTTransfer"
BuiltInFunctionMultiDCTNFTTransfer is the key for the Dharitri Core Token multi transfer built-in function
const BuiltInFunctionSaveKeyValue = "SaveKeyValue"
BuiltInFunctionSaveKeyValue is the key for the save key value built-in function
const BuiltInFunctionSetDCTRole = "DCTSetRole"
BuiltInFunctionSetDCTRole is the key for the Dharitri Core Token set built-in function
const BuiltInFunctionSetGuardian = "SetGuardian"
BuiltInFunctionSetGuardian is the key for setting a guardian built-in function
const BuiltInFunctionSetUserName = "SetUserName"
BuiltInFunctionSetUserName is the key for the set user name built-in function
const BuiltInFunctionUnSetDCTRole = "DCTUnSetRole"
BuiltInFunctionUnSetDCTRole is the key for the Dharitri Core Token unset built-in function
const BuiltInFunctionUnfreezeAccount = "UnfreezeAccount"
BuiltInFunctionUnfreezeAccount is the built-in function key for unfreezing an account
const DCTKeyIdentifier = "dct"
DCTKeyIdentifier is the key prefix for dct tokens
const DCTNFTLatestNonceIdentifier = "nonce"
DCTNFTLatestNonceIdentifier is the key prefix for dct latest nonce identifier
const DCTRoleIdentifier = "role"
DCTRoleIdentifier is the key prefix for dct role identifier
const DCTRoleLocalBurn = "DCTRoleLocalBurn"
DCTRoleLocalBurn is the constant string for the local role of burn for DCT tokens
const DCTRoleLocalMint = "DCTRoleLocalMint"
DCTRoleLocalMint is the constant string for the local role of mint for DCT tokens
const DCTRoleNFTAddQuantity = "DCTRoleNFTAddQuantity"
DCTRoleNFTAddQuantity is the constant string for the local role of adding quantity for existing DCT NFT tokens
const DCTRoleNFTAddURI = "DCTRoleNFTAddURI"
DCTRoleNFTAddURI is the constant string for the local role of adding a URI for DCT NFT tokens
const DCTRoleNFTBurn = "DCTRoleNFTBurn"
DCTRoleNFTBurn is the constant string for the local role of burn for DCT NFT tokens
const DCTRoleNFTCreate = "DCTRoleNFTCreate"
DCTRoleNFTCreate is the constant string for the local role of create for DCT NFT tokens
const DCTRoleNFTCreateMultiShard = "DCTRoleNFTCreateMultiShard"
DCTRoleNFTCreateMultiShard is the constant string for the local role of create for DCT NFT tokens multishard
const DCTRoleNFTUpdateAttributes = "DCTRoleNFTUpdateAttributes"
DCTRoleNFTUpdateAttributes is the constant string for the local role of updating attributes for DCT NFT tokens
const DCTRoleTransfer = "DCTTransferRole"
DCTRoleTransfer is the constant string for the local role to transfer DCT, only for special tokens
const DelegationSystemSCKey = "delegation"
DelegationSystemSCKey is the key under which there is data in case of system delegation smart contracts
const DharitriProtectedKeyPrefix = "DHARITRI"
DharitriProtectedKeyPrefix is the key prefix which is protected from writing in the trie - only for special builtin functions
const FileModeReadWrite = 0664
FileModeReadWrite represents the permission for a file which allows reading and writing for user and group and read for others
const FileModeUserReadWrite = 0600
FileModeUserReadWrite represents the permission for a file which allows the user for reading and writing
const FungibleDCT = "FungibleDCT"
FungibleDCT defines the string for the token type of fungible DCT
const GuardiansKeyIdentifier = "guardians"
GuardiansKeyIdentifier is the key prefix for guardians
const MaxBufferSizeToSendTrieNodes = 1 << 18 //256KB
MaxBufferSizeToSendTrieNodes represents max buffer size to send in bytes used when resolving trie nodes Every trie node that has a greater size than this constant is considered a large trie node and should be split in smaller chunks
const MaxLeafSize = uint64(1 << 26) //64MB
MaxLeafSize represents maximum amount of data which can be saved under one leaf
const MaxLenForDCTIssueMint = 100
MaxLenForDCTIssueMint defines the maximum length in bytes for the issued/minted balance
const MaxNumShards = 256
MaxNumShards represents the maximum number of shards possible in the system
const MaxRoyalty = uint32(10000)
MaxRoyalty defines 100% as uint32
const MaxUserNameLength = 32
MaxUserNameLength represents the maximum number of bytes a UserName can have
const MeasurementsLoggerFormat = "%.4fs"
MeasurementsLoggerFormat contains the formatting string to output elapsed time in seconds in a consistent way
const MegabyteSize = 1024 * 1024
MegabyteSize represents the size in bytes of a megabyte
const MetachainShardId = uint32(0xFFFFFFFF)
MetachainShardId will be used to identify a shard ID as metachain
const MinLenArgumentsDCTNFTTransfer = 4
MinLenArgumentsDCTNFTTransfer defines the minimum length for dct nft transfer
const MinLenArgumentsDCTTransfer = 2
MinLenArgumentsDCTTransfer defines the min length of arguments for the DCT transfer
const MinMetaTxExtraGasCost = uint64(1_000_000)
MinMetaTxExtraGasCost is the constant defined for minimum gas value to be sent in meta transaction
const NonFungibleDCT = "NonFungibleDCT"
NonFungibleDCT defines the string for the token type of non fungible DCT
const NumInitCharactersForScAddress = 10
NumInitCharactersForScAddress numbers of characters for smart contract address identifier
const RelayedTransaction = "relayedTx"
RelayedTransaction is the key for the dharitri meta/gassless/relayed transaction standard
const RelayedTransactionV2 = "relayedTxV2"
RelayedTransactionV2 is the key for the optimized dharitri meta/gassless/relayed transaction standard
const SCDeployIdentifier = "SCDeploy"
SCDeployIdentifier is the identifier for a smart contract deploy
const SCDeployInitFunctionName = "_init"
SCDeployInitFunctionName is the key for the function which is called at smart contract deploy time
const SCUpgradeIdentifier = "SCUpgrade"
SCUpgradeIdentifier is the identifier for a smart contract upgrade
const SemiFungibleDCT = "SemiFungibleDCT"
SemiFungibleDCT defines the string for the token type of semi fungible DCT
const ShardIdentiferLen = 2
ShardIdentiferLen number of characters for shard identifier in an address
const VMTypeLen = 2
VMTypeLen number of characters with VMType identifier in an address, these are the last 2 characters from the initial identifier
Variables ¶
var DCTSCAddress = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 255, 255}
DCTSCAddress is the hard-coded address for dct issuing smart contract
var ErrAdditionOverflow = errors.New("uint64 addition overflowed")
ErrAdditionOverflow signals that uint64 addition overflowed
var ErrEmptyFile = errors.New("empty file provided")
ErrEmptyFile signals that a empty file has been provided
var ErrFileLoggingProcessIsClosed = errors.New("file logging process is closed")
ErrFileLoggingProcessIsClosed signals that the file logging process is closed
var ErrInvalidGasScheduleConfig = errors.New("invalid gas schedule config")
ErrInvalidGasScheduleConfig signals that invalid gas schedule config was provided
var ErrInvalidIdentifierForEpochStartBlockRequest = errors.New("invalid identifier for epoch start block request")
ErrInvalidIdentifierForEpochStartBlockRequest signals that an invalid identifier for epoch start block request has been provided
var ErrInvalidIndex = errors.New("invalid private key index")
ErrInvalidIndex signals that an invalid private key index has been provided
var ErrInvalidLogFileMinLifeSpan = errors.New("minimum log file life span is invalid")
ErrInvalidLogFileMinLifeSpan signals that an invalid log file life span was provided
var ErrInvalidPollingInterval = errors.New("invalid polling interval ")
ErrInvalidPollingInterval signals that an invalid polling interval has been provided
var ErrInvalidTransactionVersion = errors.New("invalid transaction version")
ErrInvalidTransactionVersion signals that an invalid transaction version has been provided
var ErrInvalidValue = errors.New("invalid value provided")
ErrInvalidValue signals that a nil value has been provided
var ErrMajorVersionMismatch = errors.New("major version mismatch")
ErrMajorVersionMismatch signals that the major version mismatch
var ErrMinorVersionMismatch = errors.New("minor version mismatch")
ErrMinorVersionMismatch signals that the minor version mismatch
var ErrNilAppStatusHandler = errors.New("appStatusHandler is nil")
ErrNilAppStatusHandler signals that a nil status handler has been provided
var ErrNilEpochStartNotifier = errors.New("nil epoch start notifier")
ErrNilEpochStartNotifier signals that nil epoch start notifier has been provided
var ErrNilFile = errors.New("nil file provided")
ErrNilFile signals that a nil file has been provided
var ErrNilGoRoutineProcessor = errors.New("nil go routine processor")
ErrNilGoRoutineProcessor signals that a nil go routine processor has been provided
var ErrNilHasher = errors.New("nil hasher provided")
ErrNilHasher signals that a nil hasher 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")
ErrNilLogger signals that a nil logger instance has been provided
var ErrNilMarshalizer = errors.New("nil marshalizer provided")
ErrNilMarshalizer signals that a nil marshalizer has been provided
var ErrNilNodesCoordinator = errors.New("nil nodes coordinator")
ErrNilNodesCoordinator signals a nil nodes coordinator has been provided
var ErrNilPemBLock = errors.New("nil pem block")
ErrNilPemBLock signals that the pem block is nil
var ErrNilPubkeyConverter = errors.New("nil pubkey converter")
ErrNilPubkeyConverter signals that a nil public key converter has been provided
var ErrNilShardCoordinator = errors.New("nil shard coordinator")
ErrNilShardCoordinator signals that a nil shard coordinator was provided
var ErrNilSignalChan = errors.New("nil signal channel")
ErrNilSignalChan returns whenever a nil signal channel is provided
var ErrNilStatusTagProvider = errors.New("nil status tag provider")
ErrNilStatusTagProvider signals that a nil status tag provider has been given as parameter
var ErrNilStore = errors.New("nil data storage service")
ErrNilStore signals that the provided storage service is nil
var ErrNilTransactionFeeCalculator = errors.New("nil transaction fee calculator")
ErrNilTransactionFeeCalculator signals that a nil transaction fee calculator has been provided
var ErrNilUrl = errors.New("url is empty")
ErrNilUrl signals that the provided url is empty
var ErrNotPositiveValue = errors.New("the provided value is not positive")
ErrNotPositiveValue signals that a 0 or negative value has been provided
var ErrPemFileIsInvalid = errors.New("pem file is invalid")
ErrPemFileIsInvalid signals that a pem file is invalid
var ErrReleaseVersionMismatch = errors.New("release version mismatch")
ErrReleaseVersionMismatch signals that the release version mismatch
var ErrSubtractionOverflow = errors.New("uint64 subtraction overflowed")
ErrSubtractionOverflow signals that uint64 subtraction overflowed
var ErrSuffixNotPresentOrInIncorrectPosition = errors.New("suffix is not present or the position is incorrect")
ErrSuffixNotPresentOrInIncorrectPosition signals that the suffix is not present in the data field or its position is incorrect
var ErrVersionNumComponents = errors.New("invalid version while checking number of components")
ErrVersionNumComponents signals that a wrong number of components was provided
var SystemAccountAddress = bytes.Repeat([]byte{255}, 32)
SystemAccountAddress is the hard-coded address in which we save global settings on all shards
Functions ¶
func AbsDuration ¶
AbsDuration returns the absolute value of the provided time.Duration parameter
func CalculateHash ¶
func CalculateHash( marshalizer marshal.Marshalizer, hasher hashing.Hasher, object interface{}, ) ([]byte, error)
CalculateHash marshalizes the interface and calculates its hash
func CommunicationIdentifierBetweenShards ¶
CommunicationIdentifierBetweenShards is used to generate the identifier between shardID1 and shardID2 identifier is generated such as the first shard from identifier is always smaller or equal than the last
func ConvertBytes ¶
ConvertBytes converts the input bytes in a readable string using multipliers (k, M, G)
func ConvertShardIDToUint32 ¶
ConvertShardIDToUint32 converts shard id from string to uint32
func ConvertToEvenHex ¶
ConvertToEvenHex converts the provided value in a hex string, even number of characters
func ConvertToEvenHexBigInt ¶
ConvertToEvenHexBigInt converts the provided value in a hex string, even number of characters
func CreateFile ¶
func CreateFile(arg ArgCreateFileArgument) (*os.File, error)
CreateFile opens or creates a file relative to the default path
func DumpGoRoutinesToLog ¶
DumpGoRoutinesToLog will print the currently running go routines in the log
func EpochStartIdentifier ¶
EpochStartIdentifier returns the string for the epoch start identifier
func FileExists ¶
FileExists returns true if the file at the given path exists
func GetAnonymizedMachineID ¶
GetAnonymizedMachineID returns the machine ID anonymized with the provided app ID string
func GetApproximatePercentageOfValue ¶
GetApproximatePercentageOfValue returns the approximate percentage of value the approximation comes from floating point operations, which in case of large numbers has some loss in accuracy and can cause the result to be slightly lower or higher than the actual value
func GetIntTrimmedPercentageOfValue ¶
GetIntTrimmedPercentageOfValue returns the exact percentage of value, that fits into the integer (with loss of division remainder)
func GetPBFTFallbackThreshold ¶
GetPBFTFallbackThreshold returns the pBFT fallback threshold for a given consensus size
func GetPBFTThreshold ¶
GetPBFTThreshold returns the pBFT threshold for a given consensus size
func GetRunningGoRoutines ¶
GetRunningGoRoutines gets the currently running go routines stack trace as a bytes.Buffer
func GetShardIDString ¶
GetShardIDString will return the string representation of the shard id
func GetTrimmedPk ¶
GetTrimmedPk returns a trimmed string to the pkPrefixSize value
func IsEmptyAddress ¶
IsEmptyAddress returns whether an address is empty
func IsInRangeInclusive ¶
IsInRangeInclusive returns true if the provided value is in the given range, including the provided min and max values
func IsInRangeInclusiveFloat64 ¶
IsInRangeInclusiveFloat64 returns true if the provided value is in the given range including the provided min and max values
func IsMetachainIdentifier ¶
IsMetachainIdentifier verifies if the identifier is of type metachain
func IsSmartContractAddress ¶
IsSmartContractAddress verifies if a set address is of type smart contract
func IsSmartContractOnMetachain ¶
IsSmartContractOnMetachain verifies if an address is smart contract on metachain
func IsSystemAccountAddress ¶
IsSystemAccountAddress returns true if given address is system account address
func IsUnknownEpochIdentifier ¶
IsUnknownEpochIdentifier return if the epoch identifier represents unknown epoch
func IsValidDCTRole ¶
IsValidDCTRole returns true if the input string represents a valid DCT role
func LoadJsonFile ¶
LoadJsonFile method to open and decode json file
func LoadSkPkFromPemFile ¶
LoadSkPkFromPemFile loads the secret key and existing public key bytes stored in the file
func LoadTomlFile ¶
LoadTomlFile method to open and decode toml file
func LoadTomlFileToMap ¶
LoadTomlFileToMap opens and decodes a toml file as a map[string]interface{}
func MaxFloat64 ¶
MaxFloat64 returns the maximum of two given numbers
func SafeAddUint64 ¶
SafeAddUint64 performs addition on uint64 and returns an error if the addition overflows
func SafeSubUint64 ¶
SafeSubUint64 performs subtraction on uint64 and returns an error if it overflows
func SaveSkToPemFile ¶
SaveSkToPemFile saves secret key bytes in the file
func SecondsToHourMinSec ¶
SecondsToHourMinSec transform seconds input in a human friendly format
func ShardIdToString ¶
ShardIdToString returns the string according to the shard id
func UniqueIdentifier ¶
func UniqueIdentifier() string
UniqueIdentifier returns a unique string identifier of 32 bytes
Types ¶
type Accumulator ¶
type Accumulator interface { AddData(data interface{}) OutputChannel() <-chan []interface{} Close() error IsInterfaceNil() bool }
Accumulator defines the interface able to accumulate data and periodically evict them
type AppStatusHandler ¶
type AppStatusHandler interface { IsInterfaceNil() bool Increment(key string) AddUint64(key string, val uint64) 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 term-ui or status metrics
type ArgCreateFileArgument ¶
ArgCreateFileArgument will hold the arguments for a new file creation method call
type ConnectedAddressesHandler ¶
type ConnectedAddressesHandler interface {
ConnectedAddresses() []string
}
ConnectedAddressesHandler interface will be used for passing the network component to AppStatusPolling
type EpochNotifier ¶
type EpochNotifier interface { RegisterNotifyHandler(handler EpochSubscriberHandler) IsInterfaceNil() bool }
EpochNotifier can notify upon an epoch change and provide the current epoch
type EpochSubscriberHandler ¶
type EpochSubscriberHandler interface { EpochConfirmed(epoch uint32, timestamp uint64) IsInterfaceNil() bool }
EpochSubscriberHandler defines the behavior of a component that can be notified if a new epoch was confirmed
type GasScheduleNotifier ¶
type GasScheduleNotifier interface { RegisterNotifyHandler(handler GasScheduleSubscribeHandler) LatestGasSchedule() map[string]map[string]uint64 UnRegisterAll() IsInterfaceNil() bool }
GasScheduleNotifier can notify upon a gas schedule change
type GasScheduleSubscribeHandler ¶
type GasScheduleSubscribeHandler interface { GasScheduleChange(gasSchedule map[string]map[string]uint64) IsInterfaceNil() bool }
GasScheduleSubscribeHandler defines the behavior of a component that can be notified if a the gas schedule was changed
type KeyLoader ¶
type KeyLoader struct { }
KeyLoader holds the logic for loading a key from a file and an index
type KeyValueHolder ¶
type KeyValueHolder interface { Key() []byte Value() []byte ValueWithoutSuffix(suffix []byte) ([]byte, error) }
KeyValueHolder is used to hold a key and an associated value
type Logger ¶
type Logger interface { Trace(message string, args ...interface{}) Debug(message string, args ...interface{}) Info(message string, args ...interface{}) Warn(message string, args ...interface{}) Error(message string, args ...interface{}) LogIfError(err error, args ...interface{}) IsInterfaceNil() bool }
Logger defines the behavior of a data logger component
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
type NodeTypeProviderHandler ¶
type NodeTypeProviderHandler interface { SetType(nodeType NodeType) GetType() NodeType IsInterfaceNil() bool }
NodeTypeProviderHandler defines the actions needed for a component that can handle the node type
type OptionalUint32 ¶
OptionalUint32 holds an optional uint32 value
type OptionalUint64 ¶
OptionalUint64 holds an optional uint64 value
type P2PPeerInfo ¶
type P2PPeerInfo struct { PeerType P2PPeerType PeerSubType P2PPeerSubType ShardID uint32 PkBytes []byte }
P2PPeerInfo represents a peer info structure
type P2PPeerSubType ¶
type P2PPeerSubType uint32
P2PPeerSubType defines the subtype of peer (e.g. FullArchive)
const ( // RegularPeer RegularPeer P2PPeerSubType = iota // FullHistoryObserver is a node that syncs the entire history of its shard FullHistoryObserver )
func (P2PPeerSubType) String ¶
func (pst P2PPeerSubType) String() string
String returns the string-ified version of P2PPeerSubType
type P2PPeerType ¶
type P2PPeerType int
P2PPeerType defines the type of a p2p peer
const ( // UnknownPeer defines a peer that is unknown (did not advertise data in any way) UnknownPeer P2PPeerType = iota // ValidatorPeer means that the peer is a validator ValidatorPeer // ObserverPeer means that the peer is an observer ObserverPeer )
func (P2PPeerType) String ¶
func (pt P2PPeerType) String() string
String returns the string-ified version of P2PPeerType
type PeerID ¶
type PeerID string
PeerID is a p2p peer identity.
type PeerTopicType ¶
type PeerTopicType string
PeerTopicType represents the type of a peer in regards to the topic it is used
const ( // IntraShardPeer represents the identifier for intra shard peers to be used in intra shard topics IntraShardPeer PeerTopicType = "intra peer" // CrossShardPeer represents the identifier for intra shard peers to be used in cross shard topics CrossShardPeer PeerTopicType = "cross peer" // FullHistoryPeer represents the identifier for intra shard peers to be used in full history topics FullHistoryPeer PeerTopicType = "full history peer" )
func (PeerTopicType) String ¶
func (pt PeerTopicType) String() string
String returns a string version of the peer topic type
type PubkeyConverter ¶
type PubkeyConverter interface { Len() int Decode(humanReadable string) ([]byte, error) Encode(pkBytes []byte) string IsInterfaceNil() bool }
PubkeyConverter can convert public key bytes to/from a human readable form
type QueryP2PPeerInfo ¶
type QueryP2PPeerInfo struct { IsBlacklisted bool `json:"isblacklisted"` Pid string `json:"pid"` Pk string `json:"pk"` PeerType string `json:"peertype"` PeerSubType string `json:"peersubtype"` Addresses []string `json:"addresses"` }
QueryP2PPeerInfo represents a DTO used in exporting p2p peer info after a query
type Queue ¶
Queue is an interface for queue implementations that evict the first element when the queue is full
type SafeCloser ¶
type SafeCloser interface { Close() ChanClose() <-chan struct{} IsInterfaceNil() bool }
SafeCloser represents a subcomponent used for signaling a closing event. Its Close method is considered to be concurrent safe
type StopWatch ¶
type StopWatch struct {
// contains filtered or unexported fields
}
StopWatch is used to measure duration
func NewStopWatch ¶
func NewStopWatch() *StopWatch
NewStopWatch returns a new stopWatch instance used to measure duration between finished and started events
func (*StopWatch) GetMeasurement ¶
GetMeasurement returns the measurement by identifier
func (*StopWatch) GetMeasurements ¶
func (sw *StopWatch) GetMeasurements() []interface{}
GetMeasurements returns a logger compatible slice of interface{} containing pairs of (identifier, duration)
func (*StopWatch) GetMeasurementsMap ¶
GetMeasurementsMap returns the measurements as a map of (identifier, duration in seconds)
type Throttler ¶
type Throttler interface { CanProcess() bool StartProcessing() EndProcessing() IsInterfaceNil() bool }
Throttler can monitor the number of the currently running go routines
type TimersScheduler ¶
type TimersScheduler interface { Add(callback func(alarmID string), duration time.Duration, alarmID string) Cancel(alarmID string) Close() Reset(alarmID string) IsInterfaceNil() bool }
TimersScheduler exposes functionality for scheduling multiple timers
type WatchdogTimer ¶
type WatchdogTimer interface { Set(callback func(alarmID string), duration time.Duration, alarmID string) SetDefault(duration time.Duration, alarmID string) Stop(alarmID string) Reset(alarmID string) IsInterfaceNil() bool }
WatchdogTimer is used to set alarms for different components