Documentation ¶
Index ¶
- func NewNonceHashConverterMock() *nonceHashConverterMock
- 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 CacherMock
- func (cacher *CacherMock) Clear()
- func (cacher *CacherMock) Close() error
- func (cacher *CacherMock) Get(key []byte) (value interface{}, ok bool)
- func (cacher *CacherMock) Has(key []byte) bool
- func (cacher *CacherMock) HasOrAdd(key []byte, value interface{}, _ int) (has, added bool)
- func (cacher *CacherMock) IsInterfaceNil() bool
- func (cacher *CacherMock) Keys() [][]byte
- func (cacher *CacherMock) Len() int
- func (cacher *CacherMock) MaxSize() int
- func (cacher *CacherMock) Peek(key []byte) (value interface{}, ok bool)
- func (cacher *CacherMock) Put(key []byte, value interface{}, _ int) (evicted bool)
- func (cacher *CacherMock) RegisterHandler(handler func(key []byte, value interface{}), _ string)
- func (cacher *CacherMock) Remove(key []byte)
- func (cacher *CacherMock) SizeInBytesContained() uint64
- func (cacher *CacherMock) UnRegisterHandler(string)
- type HasherMock
- type HasherMock127
- type KeccakMock
- type MarshalizerMock
- type MarshalizerStub
- type MemDbMock
- func (s *MemDbMock) Close() error
- func (s *MemDbMock) Destroy() error
- func (s *MemDbMock) DestroyClosed() error
- func (s *MemDbMock) Get(key []byte) ([]byte, error)
- func (s *MemDbMock) Has(key []byte) error
- func (s *MemDbMock) Init() error
- func (s *MemDbMock) IsInterfaceNil() bool
- func (s *MemDbMock) Put(key, val []byte) error
- func (s *MemDbMock) RangeKeys(handler func(key []byte, value []byte) bool)
- func (s *MemDbMock) Remove(key []byte) error
- type MultipleShardsCoordinatorMock
- func (scm *MultipleShardsCoordinatorMock) CommunicationIdentifier(destShardID uint32) string
- func (scm *MultipleShardsCoordinatorMock) ComputeId(address []byte) uint32
- func (scm *MultipleShardsCoordinatorMock) IsInterfaceNil() bool
- func (scm *MultipleShardsCoordinatorMock) NumberOfShards() uint32
- func (scm *MultipleShardsCoordinatorMock) SameShard(_, _ []byte) bool
- func (scm *MultipleShardsCoordinatorMock) SelfId() uint32
- type ProtobufMarshalizerMock
- type PubkeyConverterStub
- type RequestHandlerStub
- func (rhs *RequestHandlerStub) IsInterfaceNil() bool
- func (rhs *RequestHandlerStub) RequestInterval() time.Duration
- func (rhs *RequestHandlerStub) RequestMetaHeader(hash []byte)
- func (rhs *RequestHandlerStub) RequestMetaHeaderByNonce(nonce uint64)
- func (rhs *RequestHandlerStub) RequestMiniBlock(destShardID uint32, miniblockHash []byte)
- func (rhs *RequestHandlerStub) RequestMiniBlocks(destShardID uint32, miniblocksHashes [][]byte)
- func (rhs *RequestHandlerStub) RequestRewardTransactions(destShardID uint32, txHashes [][]byte)
- func (rhs *RequestHandlerStub) RequestShardHeader(shardID uint32, hash []byte)
- func (rhs *RequestHandlerStub) RequestShardHeaderByNonce(shardID uint32, nonce uint64)
- func (rhs *RequestHandlerStub) RequestStartOfEpochMetaBlock(epoch uint32)
- func (rhs *RequestHandlerStub) RequestTransaction(destShardID uint32, txHashes [][]byte)
- func (rhs *RequestHandlerStub) RequestTrieNodes(destShardID uint32, hashes [][]byte, topic string)
- func (rhs *RequestHandlerStub) RequestUnsignedTransactions(destShardID uint32, txHashes [][]byte)
- func (rhs *RequestHandlerStub) SetEpoch(_ uint32)
- type ShardCoordinatorMock
- func (scm *ShardCoordinatorMock) CommunicationIdentifier(destShardID uint32) string
- func (scm *ShardCoordinatorMock) ComputeId(_ []byte) uint32
- func (scm *ShardCoordinatorMock) IsInterfaceNil() bool
- func (scm *ShardCoordinatorMock) NumberOfShards() uint32
- func (scm *ShardCoordinatorMock) SameShard(_, _ []byte) bool
- func (scm *ShardCoordinatorMock) SelfId() uint32
- func (scm *ShardCoordinatorMock) SetSelfId(_ uint32) error
- type StorerStub
- func (ss *StorerStub) ClearCache()
- func (ss *StorerStub) Close() error
- func (ss *StorerStub) DestroyUnit() error
- func (ss *StorerStub) Get(key []byte) ([]byte, error)
- func (ss *StorerStub) GetBulkFromEpoch(keys [][]byte, epoch uint32) (map[string][]byte, error)
- func (ss *StorerStub) GetFromEpoch(key []byte, epoch uint32) ([]byte, error)
- func (ss *StorerStub) GetOldestEpoch() (uint32, error)
- func (ss *StorerStub) Has(key []byte) error
- func (ss *StorerStub) IsInterfaceNil() bool
- func (ss *StorerStub) Put(key, data []byte) error
- func (ss *StorerStub) PutInEpoch(key, data []byte, epoch uint32) error
- func (ss *StorerStub) RangeKeys(handler func(key []byte, val []byte) bool)
- func (ss *StorerStub) Remove(key []byte) error
- func (ss *StorerStub) SearchFirst(key []byte) ([]byte, error)
- type UpdaterStub
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewNonceHashConverterMock ¶
func NewNonceHashConverterMock() *nonceHashConverterMock
NewNonceHashConverterMock -
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 CacherMock ¶
type CacherMock struct {
// contains filtered or unexported fields
}
CacherMock -
func (*CacherMock) Get ¶
func (cacher *CacherMock) Get(key []byte) (value interface{}, ok bool)
Get -
func (*CacherMock) HasOrAdd ¶
func (cacher *CacherMock) HasOrAdd(key []byte, value interface{}, _ int) (has, added bool)
HasOrAdd -
func (*CacherMock) IsInterfaceNil ¶
func (cacher *CacherMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*CacherMock) Peek ¶
func (cacher *CacherMock) Peek(key []byte) (value interface{}, ok bool)
Peek -
func (*CacherMock) Put ¶
func (cacher *CacherMock) Put(key []byte, value interface{}, _ int) (evicted bool)
Put -
func (*CacherMock) RegisterHandler ¶
func (cacher *CacherMock) RegisterHandler(handler func(key []byte, value interface{}), _ string)
RegisterHandler -
func (*CacherMock) SizeInBytesContained ¶
func (cacher *CacherMock) SizeInBytesContained() uint64
SizeInBytesContained -
func (*CacherMock) UnRegisterHandler ¶
func (cacher *CacherMock) UnRegisterHandler(string)
UnRegisterHandler -
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 HasherMock127 ¶
type HasherMock127 struct { }
HasherMock127 -
func (*HasherMock127) IsInterfaceNil ¶
func (hash *HasherMock127) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
type KeccakMock ¶
type KeccakMock struct { }
KeccakMock is a sha3-Keccak implementation of the hasher interface.
func (KeccakMock) Compute ¶
func (k KeccakMock) Compute(s string) []byte
Compute takes a string, and returns the sha3-Keccak hash of that string
func (KeccakMock) EmptyHash ¶
func (k KeccakMock) EmptyHash() []byte
EmptyHash returns the sha3-Keccak hash of the empty string
func (*KeccakMock) IsInterfaceNil ¶
func (k *KeccakMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (KeccakMock) Size ¶
func (KeccakMock) Size() int
Size returns the size, in number of bytes, of a sha3-Keccak hash
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
func (*MarshalizerMock) Version ¶
func (*MarshalizerMock) Version() string
Version is deprecated and will be removed
type MarshalizerStub ¶
type MarshalizerStub struct { MarshalCalled func(obj interface{}) ([]byte, error) UnmarshalCalled func(obj interface{}, buff []byte) error }
MarshalizerStub -
func (*MarshalizerStub) IsInterfaceNil ¶
func (ms *MarshalizerStub) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*MarshalizerStub) Marshal ¶
func (ms *MarshalizerStub) Marshal(obj interface{}) ([]byte, error)
Marshal -
func (*MarshalizerStub) Unmarshal ¶
func (ms *MarshalizerStub) Unmarshal(obj interface{}, buff []byte) error
Unmarshal -
type MemDbMock ¶
type MemDbMock struct { PutCalled func(key, val []byte) error // contains filtered or unexported fields }
MemDbMock represents the memory database storage. It holds a map of key value pairs and a mutex to handle concurrent accesses to the map
func (*MemDbMock) DestroyClosed ¶
DestroyClosed removes the already closed storage medium stored data
func (*MemDbMock) Has ¶
Has returns true if the given key is present in the persistence medium, false otherwise
func (*MemDbMock) IsInterfaceNil ¶
IsInterfaceNil returns true if there is no value under the interface
type MultipleShardsCoordinatorMock ¶
type MultipleShardsCoordinatorMock struct { ComputeIdCalled func(address []byte) uint32 NoShards uint32 CurrentShard uint32 }
MultipleShardsCoordinatorMock -
func NewMultiShardsCoordinatorMock ¶
func NewMultiShardsCoordinatorMock(nrShard uint32) *MultipleShardsCoordinatorMock
NewMultiShardsCoordinatorMock -
func (*MultipleShardsCoordinatorMock) CommunicationIdentifier ¶
func (scm *MultipleShardsCoordinatorMock) CommunicationIdentifier(destShardID uint32) string
CommunicationIdentifier returns the identifier between current shard ID and destination shard ID identifier is generated such as the first shard from identifier is always smaller than the last
func (*MultipleShardsCoordinatorMock) ComputeId ¶
func (scm *MultipleShardsCoordinatorMock) ComputeId(address []byte) uint32
ComputeId -
func (*MultipleShardsCoordinatorMock) IsInterfaceNil ¶
func (scm *MultipleShardsCoordinatorMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*MultipleShardsCoordinatorMock) NumberOfShards ¶
func (scm *MultipleShardsCoordinatorMock) NumberOfShards() uint32
NumberOfShards -
func (*MultipleShardsCoordinatorMock) SameShard ¶
func (scm *MultipleShardsCoordinatorMock) SameShard(_, _ []byte) bool
SameShard -
func (*MultipleShardsCoordinatorMock) SelfId ¶
func (scm *MultipleShardsCoordinatorMock) SelfId() uint32
SelfId -
type ProtobufMarshalizerMock ¶
type ProtobufMarshalizerMock struct { }
ProtobufMarshalizerMock implements marshaling with protobuf
func (*ProtobufMarshalizerMock) IsInterfaceNil ¶
func (x *ProtobufMarshalizerMock) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*ProtobufMarshalizerMock) Marshal ¶
func (x *ProtobufMarshalizerMock) Marshal(obj interface{}) ([]byte, error)
Marshal does the actual serialization of an object through protobuf
func (*ProtobufMarshalizerMock) Unmarshal ¶
func (x *ProtobufMarshalizerMock) Unmarshal(obj interface{}, buff []byte) error
Unmarshal does the actual deserialization of an object through protobuf
type PubkeyConverterStub ¶
type PubkeyConverterStub struct { LenCalled func() int DecodeCalled func(humanReadable string) ([]byte, error) EncodeCalled func(pkBytes []byte) string }
PubkeyConverterStub -
func (*PubkeyConverterStub) Decode ¶
func (pcs *PubkeyConverterStub) Decode(humanReadable string) ([]byte, error)
Decode -
func (*PubkeyConverterStub) Encode ¶
func (pcs *PubkeyConverterStub) Encode(pkBytes []byte) string
Encode -
func (*PubkeyConverterStub) IsInterfaceNil ¶
func (pcs *PubkeyConverterStub) IsInterfaceNil() bool
IsInterfaceNil -
type RequestHandlerStub ¶
type RequestHandlerStub struct { RequestShardHeaderCalled func(shardID uint32, hash []byte) RequestMetaHeaderCalled func(hash []byte) RequestMetaHeaderByNonceCalled func(nonce uint64) RequestShardHeaderByNonceCalled func(shardID uint32, nonce uint64) RequestTransactionHandlerCalled func(destShardID uint32, txHashes [][]byte) RequestScrHandlerCalled func(destShardID uint32, txHashes [][]byte) RequestRewardTxHandlerCalled func(destShardID uint32, txHashes [][]byte) RequestMiniBlockHandlerCalled func(destShardID uint32, miniblockHash []byte) RequestMiniBlocksHandlerCalled func(destShardID uint32, miniblocksHashes [][]byte) RequestTrieNodesCalled func(destShardID uint32, hashes [][]byte, topic string) RequestStartOfEpochMetaBlockCalled func(epoch uint32) }
RequestHandlerStub -
func (*RequestHandlerStub) IsInterfaceNil ¶
func (rhs *RequestHandlerStub) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*RequestHandlerStub) RequestInterval ¶
func (rhs *RequestHandlerStub) RequestInterval() time.Duration
RequestInterval -
func (*RequestHandlerStub) RequestMetaHeader ¶
func (rhs *RequestHandlerStub) RequestMetaHeader(hash []byte)
RequestMetaHeader -
func (*RequestHandlerStub) RequestMetaHeaderByNonce ¶
func (rhs *RequestHandlerStub) RequestMetaHeaderByNonce(nonce uint64)
RequestMetaHeaderByNonce -
func (*RequestHandlerStub) RequestMiniBlock ¶
func (rhs *RequestHandlerStub) RequestMiniBlock(destShardID uint32, miniblockHash []byte)
RequestMiniBlock -
func (*RequestHandlerStub) RequestMiniBlocks ¶
func (rhs *RequestHandlerStub) RequestMiniBlocks(destShardID uint32, miniblocksHashes [][]byte)
RequestMiniBlocks -
func (*RequestHandlerStub) RequestRewardTransactions ¶
func (rhs *RequestHandlerStub) RequestRewardTransactions(destShardID uint32, txHashes [][]byte)
RequestRewardTransactions -
func (*RequestHandlerStub) RequestShardHeader ¶
func (rhs *RequestHandlerStub) RequestShardHeader(shardID uint32, hash []byte)
RequestShardHeader -
func (*RequestHandlerStub) RequestShardHeaderByNonce ¶
func (rhs *RequestHandlerStub) RequestShardHeaderByNonce(shardID uint32, nonce uint64)
RequestShardHeaderByNonce -
func (*RequestHandlerStub) RequestStartOfEpochMetaBlock ¶
func (rhs *RequestHandlerStub) RequestStartOfEpochMetaBlock(epoch uint32)
RequestStartOfEpochMetaBlock -
func (*RequestHandlerStub) RequestTransaction ¶
func (rhs *RequestHandlerStub) RequestTransaction(destShardID uint32, txHashes [][]byte)
RequestTransaction -
func (*RequestHandlerStub) RequestTrieNodes ¶
func (rhs *RequestHandlerStub) RequestTrieNodes(destShardID uint32, hashes [][]byte, topic string)
RequestTrieNodes -
func (*RequestHandlerStub) RequestUnsignedTransactions ¶
func (rhs *RequestHandlerStub) RequestUnsignedTransactions(destShardID uint32, txHashes [][]byte)
RequestUnsignedTransactions -
type ShardCoordinatorMock ¶
ShardCoordinatorMock -
func (*ShardCoordinatorMock) CommunicationIdentifier ¶
func (scm *ShardCoordinatorMock) CommunicationIdentifier(destShardID uint32) string
CommunicationIdentifier -
func (*ShardCoordinatorMock) ComputeId ¶
func (scm *ShardCoordinatorMock) ComputeId(_ []byte) 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(_, _ []byte) bool
SameShard -
func (*ShardCoordinatorMock) SetSelfId ¶
func (scm *ShardCoordinatorMock) SetSelfId(_ uint32) error
SetSelfId -
type StorerStub ¶
type StorerStub struct { PutCalled func(key, data []byte) error GetCalled func(key []byte) ([]byte, error) GetFromEpochCalled func(key []byte, epoch uint32) ([]byte, error) GetBulkFromEpochCalled func(keys [][]byte, epoch uint32) (map[string][]byte, error) HasCalled func(key []byte) error HasInEpochCalled func(key []byte, epoch uint32) error SearchFirstCalled func(key []byte) ([]byte, error) RemoveCalled func(key []byte) error ClearCacheCalled func() DestroyUnitCalled func() error RangeKeysCalled func(handler func(key []byte, val []byte) bool) PutInEpochCalled func(key, data []byte, epoch uint32) error GetOldestEpochCalled func() (uint32, error) CloseCalled func() error }
StorerStub -
func (*StorerStub) GetBulkFromEpoch ¶
GetBulkFromEpoch -
func (*StorerStub) GetFromEpoch ¶
func (ss *StorerStub) GetFromEpoch(key []byte, epoch uint32) ([]byte, error)
GetFromEpoch -
func (*StorerStub) GetOldestEpoch ¶
func (ss *StorerStub) GetOldestEpoch() (uint32, error)
GetOldestEpoch -
func (*StorerStub) IsInterfaceNil ¶
func (ss *StorerStub) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
func (*StorerStub) PutInEpoch ¶
func (ss *StorerStub) PutInEpoch(key, data []byte, epoch uint32) error
PutInEpoch -
func (*StorerStub) RangeKeys ¶
func (ss *StorerStub) RangeKeys(handler func(key []byte, val []byte) bool)
RangeKeys -
func (*StorerStub) SearchFirst ¶
func (ss *StorerStub) SearchFirst(key []byte) ([]byte, error)
SearchFirst -
type UpdaterStub ¶
UpdaterStub -
func (*UpdaterStub) IsInterfaceNil ¶
func (updater *UpdaterStub) IsInterfaceNil() bool
IsInterfaceNil returns true if there is no value under the interface
Source Files ¶
- appStatusHandlerStub.go
- cacherMock.go
- hasherMock.go
- hasherMock127.go
- keccakMock.go
- marshalizerMock.go
- marshalizerStub.go
- memDbMock.go
- multipleShardsCoordinatorMock.go
- nonceHashConverterMock.go
- protobufMock.go
- pubkeyConverterStub.go
- requestHandlerStub.go
- shardCoordinatorMock.go
- storerStub.go
- updaterStub.go