Documentation ¶
Index ¶
- Variables
- type AppStatusHandlerStub
- func (ashs *AppStatusHandlerStub) AddUint64(key string, value uint64)
- func (ashs *AppStatusHandlerStub) Close()
- func (ashs *AppStatusHandlerStub) Decrement(key string)
- func (ashs *AppStatusHandlerStub) Increment(key string)
- func (ashs *AppStatusHandlerStub) IsInterfaceNil() bool
- func (ashs *AppStatusHandlerStub) SetInt64Value(key string, value int64)
- func (ashs *AppStatusHandlerStub) SetStringValue(key string, value string)
- func (ashs *AppStatusHandlerStub) SetUInt64Value(key string, value uint64)
- type ChainStorerMock
- func (bc *ChainStorerMock) AddStorer(key dataRetriever.UnitType, s storage.Storer)
- func (bc *ChainStorerMock) Destroy() error
- func (bc *ChainStorerMock) Get(unitType dataRetriever.UnitType, key []byte) ([]byte, error)
- func (bc *ChainStorerMock) GetAll(unitType dataRetriever.UnitType, keys [][]byte) (map[string][]byte, error)
- func (bc *ChainStorerMock) GetStorer(unitType dataRetriever.UnitType) storage.Storer
- func (bc *ChainStorerMock) Has(unitType dataRetriever.UnitType, key []byte) (bool, error)
- func (bc *ChainStorerMock) Put(unitType dataRetriever.UnitType, key []byte, value []byte) error
- type ConnectedAddressesMock
- type DatabaseWriterStub
- type HasherMock
- type MarshalizerMock
- type ShardCoordinatorMock
- func (scm ShardCoordinatorMock) CommunicationIdentifier(destShardID uint32) string
- func (scm ShardCoordinatorMock) ComputeId(_ state.AddressContainer) uint32
- func (scm ShardCoordinatorMock) IsInterfaceNil() bool
- func (scm ShardCoordinatorMock) NumberOfShards() uint32
- func (scm ShardCoordinatorMock) SameShard(_, _ state.AddressContainer) bool
- func (scm ShardCoordinatorMock) SelfId() uint32
- func (scm ShardCoordinatorMock) SetSelfId(_ uint32) error
- type ShardStatisticsMock
- func (ss *ShardStatisticsMock) AverageBlockTxCount() uint32
- func (ss *ShardStatisticsMock) AverageTPS() *big.Int
- func (ss *ShardStatisticsMock) CurrentBlockNonce() uint64
- func (ss *ShardStatisticsMock) IsInterfaceNil() bool
- func (ss *ShardStatisticsMock) LastBlockTxCount() uint32
- func (ss *ShardStatisticsMock) LiveTPS() float64
- func (ss *ShardStatisticsMock) PeakTPS() float64
- func (ss *ShardStatisticsMock) ShardID() uint32
- func (ss *ShardStatisticsMock) TotalProcessedTxCount() *big.Int
- type StableTagProviderStub
- type TpsBenchmarkMock
- func (s *TpsBenchmarkMock) ActiveNodes() uint32
- func (s *TpsBenchmarkMock) AverageBlockTxCount() *big.Int
- func (s *TpsBenchmarkMock) BlockNumber() uint64
- func (s *TpsBenchmarkMock) IsInterfaceNil() bool
- func (s *TpsBenchmarkMock) LastBlockTxCount() uint32
- func (s *TpsBenchmarkMock) LiveTPS() float64
- func (s *TpsBenchmarkMock) NrOfShards() uint32
- func (s *TpsBenchmarkMock) PeakTPS() float64
- func (s *TpsBenchmarkMock) RoundNumber() uint64
- func (s *TpsBenchmarkMock) RoundTime() uint64
- func (s *TpsBenchmarkMock) ShardStatistic(shardID uint32) statistics.ShardStatistic
- func (s *TpsBenchmarkMock) ShardStatistics() map[uint32]statistics.ShardStatistic
- func (s *TpsBenchmarkMock) TotalProcessedTxCount() *big.Int
- func (s *TpsBenchmarkMock) Update(mb data.HeaderHandler)
- func (s *TpsBenchmarkMock) UpdateWithShardStats(mb *block.MetaBlock)
Constants ¶
This section is empty.
Variables ¶
var ErrMockMarshalizer = errors.New("MarshalizerMock generic error")
ErrMockMarshalizer -
var ErrNilObjectToMarshal = errors.New("nil object to serialize from")
ErrNilObjectToMarshal -
Functions ¶
This section is empty.
Types ¶
type AppStatusHandlerStub ¶
type AppStatusHandlerStub struct { AddUint64Handler func(key string, value uint64) IncrementHandler func(key string) DecrementHandler func(key string) SetUInt64ValueHandler func(key string, value uint64) SetInt64ValueHandler func(key string, value int64) SetStringValueHandler func(key string, value string) CloseHandler func() }
AppStatusHandlerStub is a stub implementation of AppStatusHandler
func (*AppStatusHandlerStub) AddUint64 ¶
func (ashs *AppStatusHandlerStub) AddUint64(key string, value uint64)
AddUint64 will call the handler of the stub for incrementing
func (*AppStatusHandlerStub) Close ¶
func (ashs *AppStatusHandlerStub) Close()
Close will call the handler of the stub for closing
func (*AppStatusHandlerStub) Decrement ¶
func (ashs *AppStatusHandlerStub) Decrement(key string)
Decrement will call the handler of the stub for decrementing
func (*AppStatusHandlerStub) Increment ¶
func (ashs *AppStatusHandlerStub) Increment(key string)
Increment will call the handler of the stub for incrementing
func (*AppStatusHandlerStub) IsInterfaceNil ¶
func (ashs *AppStatusHandlerStub) IsInterfaceNil() bool
IsInterfaceNil -
func (*AppStatusHandlerStub) SetInt64Value ¶
func (ashs *AppStatusHandlerStub) SetInt64Value(key string, value int64)
SetInt64Value will call the handler of the stub for setting an int64 value
func (*AppStatusHandlerStub) SetStringValue ¶
func (ashs *AppStatusHandlerStub) SetStringValue(key string, value string)
SetStringValue will call the handler of the stub for setting an string value
func (*AppStatusHandlerStub) SetUInt64Value ¶
func (ashs *AppStatusHandlerStub) SetUInt64Value(key string, value uint64)
SetUInt64Value will call the handler of the stub for setting an uint64 value
type ChainStorerMock ¶
type ChainStorerMock struct { AddStorerCalled func(key dataRetriever.UnitType, s storage.Storer) GetStorerCalled func(unitType dataRetriever.UnitType) storage.Storer HasCalled func(unitType dataRetriever.UnitType, key []byte) (bool, error) GetCalled func(unitType dataRetriever.UnitType, key []byte) ([]byte, error) PutCalled func(unitType dataRetriever.UnitType, key []byte, value []byte) error GetAllCalled func(unitType dataRetriever.UnitType, keys [][]byte) (map[string][]byte, error) DestroyCalled func() error }
ChainStorerMock is a mock implementation of the ChianStorer interface
func (*ChainStorerMock) AddStorer ¶
func (bc *ChainStorerMock) AddStorer(key dataRetriever.UnitType, s storage.Storer)
AddStorer will add a new storer to the chain map
func (*ChainStorerMock) Destroy ¶
func (bc *ChainStorerMock) Destroy() error
Destroy removes the underlying files/resources used by the storage service
func (*ChainStorerMock) Get ¶
func (bc *ChainStorerMock) Get(unitType dataRetriever.UnitType, key []byte) ([]byte, error)
Get returns the value for the given key if found in the selected storage unit, nil otherwise. It can return an error if the provided unit type is not supported or if the storage unit underlying implementation reports an error
func (*ChainStorerMock) GetAll ¶
func (bc *ChainStorerMock) GetAll(unitType dataRetriever.UnitType, keys [][]byte) (map[string][]byte, error)
GetAll gets all the elements with keys in the keys array, from the selected storage unit It can report an error if the provided unit type is not supported, if there is a missing key in the unit, or if the underlying implementation of the storage unit reports an error.
func (*ChainStorerMock) GetStorer ¶
func (bc *ChainStorerMock) GetStorer(unitType dataRetriever.UnitType) storage.Storer
GetStorer returns the storer from the chain map or nil if the storer was not found
func (*ChainStorerMock) Has ¶
func (bc *ChainStorerMock) Has(unitType dataRetriever.UnitType, key []byte) (bool, error)
Has returns true if the key is found in the selected Unit or false otherwise It can return an error if the provided unit type is not supported or if the underlying implementation of the storage unit reports an error.
func (*ChainStorerMock) Put ¶
func (bc *ChainStorerMock) Put(unitType dataRetriever.UnitType, key []byte, value []byte) error
Put stores the key, value pair in the selected storage unit It can return an error if the provided unit type is not supported or if the storage unit underlying implementation reports an error
type ConnectedAddressesMock ¶
type ConnectedAddressesMock struct { }
ConnectedAddressesMock represents a mock implementation of the ConnectedAddresses
func (*ConnectedAddressesMock) ConnectedAddresses ¶
func (cam *ConnectedAddressesMock) ConnectedAddresses() []string
ConnectedAddresses returns an empty slice of string
type DatabaseWriterStub ¶
type DatabaseWriterStub struct { DoRequestCalled func(req *esapi.IndexRequest) error DoBulkRequestCalled func(buff *bytes.Buffer, index string) error }
DatabaseWriterStub --
func (*DatabaseWriterStub) CheckAndCreateIndex ¶
func (dwm *DatabaseWriterStub) CheckAndCreateIndex(_ string, _ io.Reader) error
CheckAndCreateIndex --
func (*DatabaseWriterStub) DoBulkRequest ¶
func (dwm *DatabaseWriterStub) DoBulkRequest(buff *bytes.Buffer, index string) error
DoBulkRequest --
func (*DatabaseWriterStub) DoRequest ¶
func (dwm *DatabaseWriterStub) DoRequest(req *esapi.IndexRequest) error
DoRequest --
type HasherMock ¶
type HasherMock struct { }
HasherMock that will be used for testing
func (HasherMock) Compute ¶
func (sha HasherMock) Compute(s string) []byte
Compute will output the SHA's equivalent of the input string
func (HasherMock) EmptyHash ¶
func (sha HasherMock) EmptyHash() []byte
EmptyHash will return the equivalent of empty string SHA's
func (HasherMock) IsInterfaceNil ¶
func (sha HasherMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
type MarshalizerMock ¶
type MarshalizerMock struct {
Fail bool
}
MarshalizerMock that will be used for testing
func (*MarshalizerMock) IsInterfaceNil ¶
func (mm *MarshalizerMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*MarshalizerMock) Marshal ¶
func (mm *MarshalizerMock) Marshal(obj interface{}) ([]byte, error)
Marshal converts the input object in a slice of bytes
func (*MarshalizerMock) Unmarshal ¶
func (mm *MarshalizerMock) Unmarshal(obj interface{}, buff []byte) error
Unmarshal applies the serialized values over an instantiated object
type ShardCoordinatorMock ¶
type ShardCoordinatorMock struct { }
ShardCoordinatorMock -
func (ShardCoordinatorMock) CommunicationIdentifier ¶
func (scm ShardCoordinatorMock) CommunicationIdentifier(destShardID uint32) string
CommunicationIdentifier -
func (ShardCoordinatorMock) ComputeId ¶
func (scm ShardCoordinatorMock) ComputeId(_ state.AddressContainer) uint32
ComputeId -
func (ShardCoordinatorMock) IsInterfaceNil ¶
func (scm ShardCoordinatorMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (ShardCoordinatorMock) NumberOfShards ¶
func (scm ShardCoordinatorMock) NumberOfShards() uint32
NumberOfShards -
func (ShardCoordinatorMock) SameShard ¶
func (scm ShardCoordinatorMock) SameShard(_, _ state.AddressContainer) bool
SameShard -
func (ShardCoordinatorMock) SetSelfId ¶
func (scm ShardCoordinatorMock) SetSelfId(_ uint32) error
SetSelfId -
type ShardStatisticsMock ¶
type ShardStatisticsMock struct {
// contains filtered or unexported fields
}
ShardStatisticsMock will hold the tps statistics for each shard
func (*ShardStatisticsMock) AverageBlockTxCount ¶
func (ss *ShardStatisticsMock) AverageBlockTxCount() uint32
AverageBlockTxCount returns an average transaction count for
func (*ShardStatisticsMock) AverageTPS ¶
func (ss *ShardStatisticsMock) AverageTPS() *big.Int
AverageTPS returns an average tps for all processed blocks in a shard
func (*ShardStatisticsMock) CurrentBlockNonce ¶
func (ss *ShardStatisticsMock) CurrentBlockNonce() uint64
CurrentBlockNonce returns the block nounce of the last processed block in a shard
func (*ShardStatisticsMock) IsInterfaceNil ¶
func (ss *ShardStatisticsMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*ShardStatisticsMock) LastBlockTxCount ¶
func (ss *ShardStatisticsMock) LastBlockTxCount() uint32
LastBlockTxCount returns the number of transactions included in the last block
func (*ShardStatisticsMock) LiveTPS ¶
func (ss *ShardStatisticsMock) LiveTPS() float64
LiveTPS returns tps for the last block
func (*ShardStatisticsMock) PeakTPS ¶
func (ss *ShardStatisticsMock) PeakTPS() float64
PeakTPS returns peak tps for for all the blocks of the current shard
func (*ShardStatisticsMock) ShardID ¶
func (ss *ShardStatisticsMock) ShardID() uint32
ShardID returns the shard id of the current statistic object
func (*ShardStatisticsMock) TotalProcessedTxCount ¶
func (ss *ShardStatisticsMock) TotalProcessedTxCount() *big.Int
TotalProcessedTxCount returns the total number of processed transactions for this shard
type StableTagProviderStub ¶
StableTagProviderStub --
func (*StableTagProviderStub) FetchTagVersion ¶
func (s *StableTagProviderStub) FetchTagVersion() (string, error)
FetchTagVersion --
func (*StableTagProviderStub) IsInterfaceNil ¶
func (s *StableTagProviderStub) IsInterfaceNil() bool
IsInterfaceNil --
type TpsBenchmarkMock ¶
type TpsBenchmarkMock struct {
// contains filtered or unexported fields
}
TpsBenchmarkMock will calculate statistics for the network activity
func (*TpsBenchmarkMock) ActiveNodes ¶
func (s *TpsBenchmarkMock) ActiveNodes() uint32
ActiveNodes returns the number of active nodes
func (*TpsBenchmarkMock) AverageBlockTxCount ¶
func (s *TpsBenchmarkMock) AverageBlockTxCount() *big.Int
AverageBlockTxCount returns an average of the tx/block
func (*TpsBenchmarkMock) BlockNumber ¶
func (s *TpsBenchmarkMock) BlockNumber() uint64
BlockNumber returns the last processed block number
func (*TpsBenchmarkMock) IsInterfaceNil ¶
func (s *TpsBenchmarkMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*TpsBenchmarkMock) LastBlockTxCount ¶
func (s *TpsBenchmarkMock) LastBlockTxCount() uint32
LastBlockTxCount returns the number of transactions processed in the last block
func (*TpsBenchmarkMock) LiveTPS ¶
func (s *TpsBenchmarkMock) LiveTPS() float64
LiveTPS returns tps for the last block
func (*TpsBenchmarkMock) NrOfShards ¶
func (s *TpsBenchmarkMock) NrOfShards() uint32
NrOfShards returns the number of shards
func (*TpsBenchmarkMock) PeakTPS ¶
func (s *TpsBenchmarkMock) PeakTPS() float64
PeakTPS returns tps for the last block
func (*TpsBenchmarkMock) RoundNumber ¶
func (s *TpsBenchmarkMock) RoundNumber() uint64
RoundNumber returns the round index for this benchmark object
func (*TpsBenchmarkMock) RoundTime ¶
func (s *TpsBenchmarkMock) RoundTime() uint64
RoundTime returns the round duration in seconds
func (*TpsBenchmarkMock) ShardStatistic ¶
func (s *TpsBenchmarkMock) ShardStatistic(shardID uint32) statistics.ShardStatistic
ShardStatistic returns the current statistical state for a given shard
func (*TpsBenchmarkMock) ShardStatistics ¶
func (s *TpsBenchmarkMock) ShardStatistics() map[uint32]statistics.ShardStatistic
ShardStatistics returns the current statistical state for a given shard
func (*TpsBenchmarkMock) TotalProcessedTxCount ¶
func (s *TpsBenchmarkMock) TotalProcessedTxCount() *big.Int
TotalProcessedTxCount returns the total number of processed transactions
func (*TpsBenchmarkMock) Update ¶
func (s *TpsBenchmarkMock) Update(mb data.HeaderHandler)
Update receives a metablock and updates all fields accordingly for each shard available in the meta block
func (*TpsBenchmarkMock) UpdateWithShardStats ¶
func (s *TpsBenchmarkMock) UpdateWithShardStats(mb *block.MetaBlock)
UpdateWithShardStats -