mock

package
v1.0.88 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 14, 2020 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountTrackerStub added in v1.0.3

type AccountTrackerStub struct {
	SaveAccountCalled func(accountHandler state.AccountHandler) error
	JournalizeCalled  func(entry state.JournalEntry)
}

AccountTrackerStub -

func (*AccountTrackerStub) IsInterfaceNil added in v1.0.16

func (ats *AccountTrackerStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*AccountTrackerStub) Journalize added in v1.0.3

func (ats *AccountTrackerStub) Journalize(entry state.JournalEntry)

Journalize -

func (*AccountTrackerStub) SaveAccount added in v1.0.3

func (ats *AccountTrackerStub) SaveAccount(accountHandler state.AccountHandler) error

SaveAccount -

type AccountWrapMock

type AccountWrapMock struct {
	MockValue int

	SetNonceWithJournalCalled    func(nonce uint64) error    `json:"-"`
	SetCodeHashWithJournalCalled func(codeHash []byte) error `json:"-"`
	SetCodeWithJournalCalled     func([]byte) error          `json:"-"`
	// contains filtered or unexported fields
}

AccountWrapMock -

func NewAccountWrapMock

func NewAccountWrapMock(adr state.AddressContainer, tracker state.AccountTracker) *AccountWrapMock

NewAccountWrapMock -

func (*AccountWrapMock) AddressContainer

func (awm *AccountWrapMock) AddressContainer() state.AddressContainer

AddressContainer -

func (*AccountWrapMock) DataTrie

func (awm *AccountWrapMock) DataTrie() data.Trie

DataTrie -

func (*AccountWrapMock) DataTrieTracker

func (awm *AccountWrapMock) DataTrieTracker() state.DataTrieTracker

DataTrieTracker -

func (*AccountWrapMock) GetCode

func (awm *AccountWrapMock) GetCode() []byte

GetCode -

func (*AccountWrapMock) GetCodeHash

func (awm *AccountWrapMock) GetCodeHash() []byte

GetCodeHash -

func (*AccountWrapMock) GetNonce

func (awm *AccountWrapMock) GetNonce() uint64

GetNonce gets the nonce of the account

func (*AccountWrapMock) GetRootHash

func (awm *AccountWrapMock) GetRootHash() []byte

GetRootHash -

func (*AccountWrapMock) IsInterfaceNil

func (awm *AccountWrapMock) IsInterfaceNil() bool

IsInterfaceNil -

func (*AccountWrapMock) SetCode

func (awm *AccountWrapMock) SetCode(code []byte)

SetCode -

func (*AccountWrapMock) SetCodeHash

func (awm *AccountWrapMock) SetCodeHash(codeHash []byte)

SetCodeHash -

func (*AccountWrapMock) SetCodeHashWithJournal added in v1.0.3

func (awm *AccountWrapMock) SetCodeHashWithJournal(codeHash []byte) error

SetCodeHashWithJournal -

func (*AccountWrapMock) SetDataTrie

func (awm *AccountWrapMock) SetDataTrie(trie data.Trie)

SetDataTrie -

func (*AccountWrapMock) SetDataTrieTracker added in v1.0.3

func (awm *AccountWrapMock) SetDataTrieTracker(tracker state.DataTrieTracker)

SetDataTrieTracker -

func (*AccountWrapMock) SetNonce added in v1.0.3

func (awm *AccountWrapMock) SetNonce(nonce uint64)

SetNonce saves the nonce to the account

func (*AccountWrapMock) SetNonceWithJournal added in v1.0.3

func (awm *AccountWrapMock) SetNonceWithJournal(nonce uint64) error

SetNonceWithJournal sets the account's nonce, saving the old nonce before changing

func (*AccountWrapMock) SetRootHash

func (awm *AccountWrapMock) SetRootHash(rootHash []byte)

SetRootHash -

type AccountsFactoryStub

type AccountsFactoryStub struct {
	CreateAccountCalled func(address state.AddressContainer, tracker state.AccountTracker) (state.AccountHandler, error)
}

AccountsFactoryStub -

func (*AccountsFactoryStub) CreateAccount

func (afs *AccountsFactoryStub) CreateAccount(address state.AddressContainer, tracker state.AccountTracker) (state.AccountHandler, error)

CreateAccount -

func (*AccountsFactoryStub) IsInterfaceNil

func (afs *AccountsFactoryStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

type AddressConverterMock

type AddressConverterMock struct {
	Fail                                          bool
	CreateAddressFromPublicKeyBytesRetErrForValue []byte
}

AddressConverterMock -

func (*AddressConverterMock) AddressLen

func (acm *AddressConverterMock) AddressLen() int

AddressLen -

func (*AddressConverterMock) ConvertToHex

func (acm *AddressConverterMock) ConvertToHex(addressContainer state.AddressContainer) (string, error)

ConvertToHex -

func (*AddressConverterMock) CreateAddressFromHex

func (acm *AddressConverterMock) CreateAddressFromHex(hexAddress string) (state.AddressContainer, error)

CreateAddressFromHex -

func (*AddressConverterMock) CreateAddressFromPublicKeyBytes

func (acm *AddressConverterMock) CreateAddressFromPublicKeyBytes(pubKey []byte) (state.AddressContainer, error)

CreateAddressFromPublicKeyBytes -

func (*AddressConverterMock) IsInterfaceNil

func (acm *AddressConverterMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*AddressConverterMock) PrepareAddressBytes

func (acm *AddressConverterMock) PrepareAddressBytes(addressBytes []byte) ([]byte, error)

PrepareAddressBytes -

type AddressDummy

type AddressDummy struct {
	// contains filtered or unexported fields
}

AddressDummy -

func NewAddressDummy

func NewAddressDummy(bytes, hash []byte) *AddressDummy

NewAddressDummy -

func (*AddressDummy) Bytes

func (ad *AddressDummy) Bytes() []byte

Bytes -

func (*AddressDummy) Hash

func (ad *AddressDummy) Hash() []byte

Hash -

func (*AddressDummy) IsInterfaceNil

func (ad *AddressDummy) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

type AddressMock

type AddressMock struct {
	// contains filtered or unexported fields
}

AddressMock implements a mock address generator used in testing

func NewAddressMock

func NewAddressMock() *AddressMock

NewAddressMock generates a new address

func NewAddressMockFromBytes

func NewAddressMockFromBytes(buff []byte) *AddressMock

NewAddressMockFromBytes generates a new address

func (*AddressMock) Bytes

func (address *AddressMock) Bytes() []byte

Bytes returns the address' bytes

func (*AddressMock) IsInterfaceNil

func (address *AddressMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

type CacherStub added in v1.0.3

type CacherStub struct {
	ClearCalled           func()
	PutCalled             func(key []byte, value interface{}) (evicted bool)
	GetCalled             func(key []byte) (value interface{}, ok bool)
	HasCalled             func(key []byte) bool
	PeekCalled            func(key []byte) (value interface{}, ok bool)
	HasOrAddCalled        func(key []byte, value interface{}) (ok, evicted bool)
	RemoveCalled          func(key []byte)
	RemoveOldestCalled    func()
	KeysCalled            func() [][]byte
	LenCalled             func() int
	MaxSizeCalled         func() int
	RegisterHandlerCalled func(func(key []byte))
}

CacherStub -

func (*CacherStub) Clear added in v1.0.3

func (cs *CacherStub) Clear()

Clear -

func (*CacherStub) Get added in v1.0.3

func (cs *CacherStub) Get(key []byte) (value interface{}, ok bool)

Get -

func (*CacherStub) Has added in v1.0.3

func (cs *CacherStub) Has(key []byte) bool

Has -

func (*CacherStub) HasOrAdd added in v1.0.3

func (cs *CacherStub) HasOrAdd(key []byte, value interface{}) (ok, evicted bool)

HasOrAdd -

func (*CacherStub) IsInterfaceNil added in v1.0.16

func (cs *CacherStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*CacherStub) Keys added in v1.0.3

func (cs *CacherStub) Keys() [][]byte

Keys -

func (*CacherStub) Len added in v1.0.3

func (cs *CacherStub) Len() int

Len -

func (*CacherStub) MaxSize added in v1.0.33

func (cs *CacherStub) MaxSize() int

MaxSize -

func (*CacherStub) Peek added in v1.0.3

func (cs *CacherStub) Peek(key []byte) (value interface{}, ok bool)

Peek -

func (*CacherStub) Put added in v1.0.3

func (cs *CacherStub) Put(key []byte, value interface{}) (evicted bool)

Put -

func (*CacherStub) RegisterHandler added in v1.0.3

func (cs *CacherStub) RegisterHandler(handler func(key []byte))

RegisterHandler -

func (*CacherStub) Remove added in v1.0.3

func (cs *CacherStub) Remove(key []byte)

Remove -

func (*CacherStub) RemoveOldest added in v1.0.3

func (cs *CacherStub) RemoveOldest()

RemoveOldest -

type DataTrieTrackerStub

type DataTrieTrackerStub struct {
	ClearDataCachesCalled func()
	DirtyDataCalled       func() map[string][]byte
	OriginalValueCalled   func(key []byte) []byte
	RetrieveValueCalled   func(key []byte) ([]byte, error)
	SaveKeyValueCalled    func(key []byte, value []byte)
	SetDataTrieCalled     func(tr data.Trie)
	DataTrieCalled        func() data.Trie
}

DataTrieTrackerStub -

func (*DataTrieTrackerStub) ClearDataCaches

func (dtts *DataTrieTrackerStub) ClearDataCaches()

ClearDataCaches -

func (*DataTrieTrackerStub) DataTrie

func (dtts *DataTrieTrackerStub) DataTrie() data.Trie

DataTrie -

func (*DataTrieTrackerStub) DirtyData

func (dtts *DataTrieTrackerStub) DirtyData() map[string][]byte

DirtyData -

func (*DataTrieTrackerStub) IsInterfaceNil

func (dtts *DataTrieTrackerStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*DataTrieTrackerStub) OriginalValue

func (dtts *DataTrieTrackerStub) OriginalValue(key []byte) []byte

OriginalValue -

func (*DataTrieTrackerStub) RetrieveValue

func (dtts *DataTrieTrackerStub) RetrieveValue(key []byte) ([]byte, error)

RetrieveValue -

func (*DataTrieTrackerStub) SaveKeyValue

func (dtts *DataTrieTrackerStub) SaveKeyValue(key []byte, value []byte)

SaveKeyValue -

func (*DataTrieTrackerStub) SetDataTrie

func (dtts *DataTrieTrackerStub) SetDataTrie(tr data.Trie)

SetDataTrie -

type EvictionWaitingList

type EvictionWaitingList struct {
	Cache       map[string]data.ModifiedHashes
	CacheSize   uint
	Db          storage.Persister
	Marshalizer marshal.Marshalizer
}

EvictionWaitingList is a structure that caches keys that need to be removed from a certain database. If the cache is full, the keys will be stored in the underlying database. Writing at the same key in cacher and db will overwrite the previous values. This structure is not concurrent safe.

func NewEvictionWaitingList

func NewEvictionWaitingList(size uint, db storage.Persister, marshalizer marshal.Marshalizer) (*EvictionWaitingList, error)

NewEvictionWaitingList creates a new instance of evictionWaitingList

func (*EvictionWaitingList) Evict

func (ewl *EvictionWaitingList) Evict(rootHash []byte) (data.ModifiedHashes, error)

Evict returns and removes from the waiting list all the hashes from the position given by the root hash

func (*EvictionWaitingList) GetSize added in v1.0.77

func (ewl *EvictionWaitingList) GetSize() uint

GetSize returns the size of the cache

func (*EvictionWaitingList) IsInterfaceNil

func (ewl *EvictionWaitingList) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*EvictionWaitingList) PresentInNewHashes

func (ewl *EvictionWaitingList) PresentInNewHashes(hash string) (bool, error)

func (*EvictionWaitingList) Put

func (ewl *EvictionWaitingList) Put(rootHash []byte, hashes data.ModifiedHashes) error

Put stores the given hashes in the eviction waiting list, in the position given by the root hash

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

func (HasherMock) Size

func (HasherMock) Size() int

Size return the required size in bytes

type HasherMock127

type HasherMock127 struct {
}

HasherMock127 -

func (HasherMock127) Compute

func (HasherMock127) Compute(s string) []byte

Compute -

func (HasherMock127) EmptyHash

func (HasherMock127) EmptyHash() []byte

EmptyHash -

func (*HasherMock127) IsInterfaceNil

func (hash *HasherMock127) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (HasherMock127) Size

func (HasherMock127) Size() int

Size -

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 MemDbMock

type MemDbMock struct {
	// 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 NewMemDbMock

func NewMemDbMock() *MemDbMock

NewMemDbMock creates a new memorydb object

func (*MemDbMock) Close

func (s *MemDbMock) Close() error

Close closes the files/resources associated to the storage medium

func (*MemDbMock) Destroy

func (s *MemDbMock) Destroy() error

Destroy removes the storage medium stored data

func (*MemDbMock) DestroyClosed

func (s *MemDbMock) DestroyClosed() error

DestroyClosed removes the already closed storage medium stored data

func (*MemDbMock) Get

func (s *MemDbMock) Get(key []byte) ([]byte, error)

Get gets the value associated to the key, or reports an error

func (*MemDbMock) Has

func (s *MemDbMock) Has(key []byte) error

Has returns true if the given key is present in the persistence medium, false otherwise

func (*MemDbMock) Init

func (s *MemDbMock) Init() error

Init initializes the storage medium and prepares it for usage

func (*MemDbMock) IsInterfaceNil

func (s *MemDbMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*MemDbMock) Put

func (s *MemDbMock) Put(key, val []byte) error

Put adds the value to the (key, val) storage medium

func (*MemDbMock) Remove

func (s *MemDbMock) Remove(key []byte) error

Remove removes the data associated to the given key

type MultipleShardsCoordinatorMock

type MultipleShardsCoordinatorMock struct {
	ComputeIdCalled func(address state.AddressContainer) 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

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(firstAddress, secondAddress state.AddressContainer) bool

SameShard -

func (*MultipleShardsCoordinatorMock) SelfId

func (scm *MultipleShardsCoordinatorMock) SelfId() uint32

SelfId -

func (*MultipleShardsCoordinatorMock) SetNoShards

func (scm *MultipleShardsCoordinatorMock) SetNoShards(noShards uint32)

SetNoShards -

func (*MultipleShardsCoordinatorMock) SetSelfId

func (scm *MultipleShardsCoordinatorMock) SetSelfId(shardId uint32) error

SetSelfId -

type NodesCoordinatorMock

type NodesCoordinatorMock struct {
	Validators                          map[uint32][]sharding.Validator
	ShardConsensusSize                  uint32
	MetaConsensusSize                   uint32
	ShardId                             uint32
	NbShards                            uint32
	GetOwnPublicKeyCalled               func() []byte
	GetSelectedPublicKeysCalled         func(selection []byte, shardId uint32) (publicKeys []string, err error)
	GetValidatorsPublicKeysCalled       func(randomness []byte, round uint64, shardId uint32) ([]string, error)
	GetValidatorsRewardsAddressesCalled func(randomness []byte, round uint64, shardId uint32) ([]string, error)
	LoadNodesPerShardsCalled            func(nodes map[uint32][]sharding.Validator) error
	ComputeValidatorsGroupCalled        func(randomness []byte, round uint64, shardId uint32) (validatorsGroup []sharding.Validator, err error)
	GetValidatorWithPublicKeyCalled     func(publicKey []byte) (validator sharding.Validator, shardId uint32, err error)
}

NodesCoordinatorMock defines the behaviour of a struct able to do validator group selection

func NewNodesCoordinatorMock added in v1.0.20

func NewNodesCoordinatorMock() *NodesCoordinatorMock

NewNodesCoordinatorMock -

func (*NodesCoordinatorMock) ComputeValidatorsGroup added in v1.0.20

func (ncm *NodesCoordinatorMock) ComputeValidatorsGroup(
	randomess []byte,
	round uint64,
	shardId uint32,
) ([]sharding.Validator, error)

ComputeValidatorsGroup -

func (*NodesCoordinatorMock) ConsensusGroupSize

func (ncm *NodesCoordinatorMock) ConsensusGroupSize(uint32) int

ConsensusGroupSize -

func (*NodesCoordinatorMock) GetAllValidatorsPublicKeys added in v1.0.20

func (ncm *NodesCoordinatorMock) GetAllValidatorsPublicKeys() map[uint32][][]byte

GetAllValidatorsPublicKeys -

func (*NodesCoordinatorMock) GetOwnPublicKey

func (ncm *NodesCoordinatorMock) GetOwnPublicKey() []byte

GetOwnPublicKey -

func (*NodesCoordinatorMock) GetSelectedPublicKeys

func (ncm *NodesCoordinatorMock) GetSelectedPublicKeys(selection []byte, shardId uint32) (publicKeys []string, err error)

GetSelectedPublicKeys -

func (*NodesCoordinatorMock) GetValidatorWithPublicKey

func (ncm *NodesCoordinatorMock) GetValidatorWithPublicKey(publicKey []byte) (sharding.Validator, uint32, error)

GetValidatorWithPublicKey -

func (*NodesCoordinatorMock) GetValidatorsIndexes

func (ncm *NodesCoordinatorMock) GetValidatorsIndexes(publicKeys []string) []uint64

GetValidatorsIndexes -

func (*NodesCoordinatorMock) GetValidatorsPublicKeys added in v1.0.20

func (ncm *NodesCoordinatorMock) GetValidatorsPublicKeys(
	randomness []byte,
	round uint64,
	shardId uint32,
) ([]string, error)

GetValidatorsPublicKeys -

func (*NodesCoordinatorMock) GetValidatorsRewardsAddresses added in v1.0.20

func (ncm *NodesCoordinatorMock) GetValidatorsRewardsAddresses(
	randomness []byte,
	round uint64,
	shardId uint32,
) ([]string, error)

GetValidatorsRewardsAddresses -

func (*NodesCoordinatorMock) IsInterfaceNil

func (ncm *NodesCoordinatorMock) IsInterfaceNil() bool

IsInterfaceNil -

func (*NodesCoordinatorMock) SetNodesPerShards

func (ncm *NodesCoordinatorMock) SetNodesPerShards(nodes map[uint32][]sharding.Validator) error

SetNodesPerShards -

type PathManagerStub

type PathManagerStub struct {
	PathForEpochCalled  func(shardId string, epoch uint32, identifier string) string
	PathForStaticCalled func(shardId string, identifier string) string
}

PathManagerStub -

func (*PathManagerStub) IsInterfaceNil

func (p *PathManagerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*PathManagerStub) PathForEpoch

func (p *PathManagerStub) PathForEpoch(shardId string, epoch uint32, identifier string) string

PathForEpoch -

func (*PathManagerStub) PathForStatic

func (p *PathManagerStub) PathForStatic(shardId string, identifier string) string

PathForStatic -

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 ShardCoordinatorMock

type ShardCoordinatorMock struct {
	SelfID     uint32
	NrOfShards uint32
}

ShardCoordinatorMock -

func (ShardCoordinatorMock) CommunicationIdentifier

func (scm ShardCoordinatorMock) CommunicationIdentifier(destShardID uint32) string

CommunicationIdentifier -

func (ShardCoordinatorMock) ComputeId

func (scm ShardCoordinatorMock) ComputeId(address 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(firstAddress, secondAddress state.AddressContainer) bool

SameShard -

func (ShardCoordinatorMock) SelfId

func (scm ShardCoordinatorMock) SelfId() uint32

SelfId -

func (ShardCoordinatorMock) SetSelfId

func (scm ShardCoordinatorMock) SetSelfId(shardId uint32) error

SetSelfId -

type ShardedDataStub

type ShardedDataStub struct {
	RegisterHandlerCalled         func(func(key []byte))
	ShardDataStoreCalled          func(cacheId string) (c storage.Cacher)
	AddDataCalled                 func(key []byte, data interface{}, cacheId string)
	SearchFirstDataCalled         func(key []byte) (value interface{}, ok bool)
	RemoveDataCalled              func(key []byte, cacheId string)
	RemoveDataFromAllShardsCalled func(key []byte)
	MergeShardStoresCalled        func(sourceCacheId, destCacheId string)
	MoveDataCalled                func(sourceCacheId, destCacheId string, key [][]byte)
	ClearCalled                   func()
	ClearShardStoreCalled         func(cacheId string)
	RemoveSetOfDataFromPoolCalled func(keys [][]byte, destCacheId string)
	CreateShardStoreCalled        func(destCacheId string)
}

ShardedDataStub -

func (*ShardedDataStub) AddData

func (sd *ShardedDataStub) AddData(key []byte, data interface{}, cacheId string)

AddData -

func (*ShardedDataStub) Clear

func (sd *ShardedDataStub) Clear()

Clear -

func (*ShardedDataStub) ClearShardStore

func (sd *ShardedDataStub) ClearShardStore(cacheId string)

ClearShardStore -

func (*ShardedDataStub) CreateShardStore

func (sd *ShardedDataStub) CreateShardStore(cacheId string)

CreateShardStore -

func (*ShardedDataStub) IsInterfaceNil

func (sd *ShardedDataStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ShardedDataStub) MergeShardStores

func (sd *ShardedDataStub) MergeShardStores(sourceCacheId, destCacheId string)

MergeShardStores -

func (*ShardedDataStub) RegisterHandler

func (sd *ShardedDataStub) RegisterHandler(handler func(key []byte))

RegisterHandler -

func (*ShardedDataStub) RemoveData

func (sd *ShardedDataStub) RemoveData(key []byte, cacheId string)

RemoveData -

func (*ShardedDataStub) RemoveDataFromAllShards

func (sd *ShardedDataStub) RemoveDataFromAllShards(key []byte)

RemoveDataFromAllShards -

func (*ShardedDataStub) RemoveSetOfDataFromPool

func (sd *ShardedDataStub) RemoveSetOfDataFromPool(keys [][]byte, cacheId string)

RemoveSetOfDataFromPool -

func (*ShardedDataStub) SearchFirstData

func (sd *ShardedDataStub) SearchFirstData(key []byte) (value interface{}, ok bool)

SearchFirstData -

func (*ShardedDataStub) ShardDataStore

func (sd *ShardedDataStub) ShardDataStore(cacheId string) (c storage.Cacher)

ShardDataStore -

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)
	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()
	CloseCalled        func() error
	DestroyUnitCalled  func() error
}

StorerStub -

func (*StorerStub) ClearCache

func (ss *StorerStub) ClearCache()

ClearCache -

func (*StorerStub) Close

func (ss *StorerStub) Close() error

Close -

func (*StorerStub) DestroyUnit

func (ss *StorerStub) DestroyUnit() error

DestroyUnit -

func (*StorerStub) Get

func (ss *StorerStub) Get(key []byte) ([]byte, error)

Get -

func (*StorerStub) GetFromEpoch

func (ss *StorerStub) GetFromEpoch(key []byte, epoch uint32) ([]byte, error)

GetFromEpoch -

func (*StorerStub) Has

func (ss *StorerStub) Has(key []byte) error

Has -

func (*StorerStub) HasInEpoch

func (ss *StorerStub) HasInEpoch(key []byte, epoch uint32) error

HasInEpoch -

func (*StorerStub) IsInterfaceNil

func (ss *StorerStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*StorerStub) Put

func (ss *StorerStub) Put(key, data []byte) error

Put -

func (*StorerStub) Remove

func (ss *StorerStub) Remove(key []byte) error

Remove -

func (*StorerStub) SearchFirst

func (ss *StorerStub) SearchFirst(key []byte) ([]byte, error)

SearchFirst -

type TrieNodesResolverStub

type TrieNodesResolverStub struct {
	RequestDataFromHashCalled    func(hash []byte) error
	ProcessReceivedMessageCalled func(message p2p.MessageP2P) error
}

TrieNodesResolverStub -

func (*TrieNodesResolverStub) IsInterfaceNil

func (tnrs *TrieNodesResolverStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*TrieNodesResolverStub) ProcessReceivedMessage

func (tnrs *TrieNodesResolverStub) ProcessReceivedMessage(message p2p.MessageP2P, _ func(buffToSend []byte)) error

ProcessReceivedMessage -

func (*TrieNodesResolverStub) RequestDataFromHash

func (tnrs *TrieNodesResolverStub) RequestDataFromHash(hash []byte, _ uint32) error

RequestDataFromHash -

type TrieStub

type TrieStub struct {
	GetCalled                func(key []byte) ([]byte, error)
	UpdateCalled             func(key, value []byte) error
	DeleteCalled             func(key []byte) error
	RootCalled               func() ([]byte, error)
	ProveCalled              func(key []byte) ([][]byte, error)
	VerifyProofCalled        func(proofs [][]byte, key []byte) (bool, error)
	CommitCalled             func() error
	RecreateCalled           func(root []byte) (data.Trie, error)
	DeepCloneCalled          func() (data.Trie, error)
	CancelPruneCalled        func(rootHash []byte, identifier data.TriePruningIdentifier)
	PruneCalled              func(rootHash []byte, identifier data.TriePruningIdentifier) error
	ResetOldHashesCalled     func() [][]byte
	AppendToOldHashesCalled  func([][]byte)
	TakeSnapshotCalled       func(rootHash []byte)
	SetCheckpointCalled      func(rootHash []byte)
	GetSerializedNodesCalled func([]byte, uint64) ([][]byte, error)
	DatabaseCalled           func() data.DBWriteCacher
	GetAllLeavesCalled       func() (map[string][]byte, error)
	IsPruningEnabledCalled   func() bool
	ClosePersisterCalled     func() error
}

TrieStub -

func (*TrieStub) AppendToOldHashes

func (ts *TrieStub) AppendToOldHashes(hashes [][]byte)

AppendToOldHashes appends the given hashes to the trie's oldHashes variable

func (*TrieStub) CancelPrune

func (ts *TrieStub) CancelPrune(rootHash []byte, identifier data.TriePruningIdentifier)

CancelPrune invalidates the hashes that correspond to the given root hash from the eviction waiting list

func (*TrieStub) ClosePersister

func (ts *TrieStub) ClosePersister() error

ClosePersister -

func (*TrieStub) Commit

func (ts *TrieStub) Commit() error

Commit -

func (*TrieStub) Database

func (ts *TrieStub) Database() data.DBWriteCacher

Database -

func (*TrieStub) DeepClone added in v1.0.11

func (ts *TrieStub) DeepClone() (data.Trie, error)

DeepClone -

func (*TrieStub) Delete

func (ts *TrieStub) Delete(key []byte) error

Delete -

func (*TrieStub) Get

func (ts *TrieStub) Get(key []byte) ([]byte, error)

Get -

func (*TrieStub) GetAllLeaves

func (ts *TrieStub) GetAllLeaves() (map[string][]byte, error)

GetAllLeaves -

func (*TrieStub) GetSerializedNodes

func (ts *TrieStub) GetSerializedNodes(hash []byte, maxBuffToSend uint64) ([][]byte, error)

GetSerializedNodes -

func (*TrieStub) IsInterfaceNil

func (ts *TrieStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*TrieStub) IsPruningEnabled

func (ts *TrieStub) IsPruningEnabled() bool

IsPruningEnabled -

func (*TrieStub) Prove added in v1.0.3

func (ts *TrieStub) Prove(key []byte) ([][]byte, error)

Prove -

func (*TrieStub) Prune

func (ts *TrieStub) Prune(rootHash []byte, identifier data.TriePruningIdentifier) error

Prune removes from the database all the old hashes that correspond to the given root hash

func (*TrieStub) Recreate

func (ts *TrieStub) Recreate(root []byte) (data.Trie, error)

Recreate -

func (*TrieStub) ResetOldHashes

func (ts *TrieStub) ResetOldHashes() [][]byte

ResetOldHashes resets the oldHashes and oldRoot variables and returns the old hashes

func (*TrieStub) Root

func (ts *TrieStub) Root() ([]byte, error)

Root -

func (*TrieStub) SetCheckpoint

func (ts *TrieStub) SetCheckpoint(rootHash []byte)

SetCheckpoint -

func (*TrieStub) String

func (ts *TrieStub) String() string

String -

func (*TrieStub) TakeSnapshot

func (ts *TrieStub) TakeSnapshot(rootHash []byte)

TakeSnapshot -

func (*TrieStub) Update

func (ts *TrieStub) Update(key, value []byte) error

Update -

func (*TrieStub) VerifyProof added in v1.0.3

func (ts *TrieStub) VerifyProof(proofs [][]byte, key []byte) (bool, error)

VerifyProof -

type TxTypeHandlerMock added in v1.0.20

type TxTypeHandlerMock struct {
	ComputeTransactionTypeCalled func(tx data.TransactionHandler) (process.TransactionType, error)
}

TxTypeHandlerMock -

func (*TxTypeHandlerMock) ComputeTransactionType added in v1.0.20

func (th *TxTypeHandlerMock) ComputeTransactionType(tx data.TransactionHandler) (process.TransactionType, error)

ComputeTransactionType -

type Uint64CacherStub

type Uint64CacherStub struct {
	ClearCalled           func()
	PutCalled             func(uint64, interface{}) bool
	GetCalled             func(uint64) (interface{}, bool)
	HasCalled             func(uint64) bool
	PeekCalled            func(uint64) (interface{}, bool)
	HasOrAddCalled        func(uint64, interface{}) (bool, bool)
	RemoveCalled          func(uint64)
	RemoveOldestCalled    func()
	KeysCalled            func() []uint64
	LenCalled             func() int
	RegisterHandlerCalled func(handler func(nonce uint64))
}

Uint64CacherStub -

func (*Uint64CacherStub) Clear

func (ucs *Uint64CacherStub) Clear()

Clear -

func (*Uint64CacherStub) Get

func (ucs *Uint64CacherStub) Get(nonce uint64) (interface{}, bool)

Get -

func (*Uint64CacherStub) Has

func (ucs *Uint64CacherStub) Has(nonce uint64) bool

Has -

func (*Uint64CacherStub) HasOrAdd

func (ucs *Uint64CacherStub) HasOrAdd(nonce uint64, value interface{}) (bool, bool)

HasOrAdd -

func (*Uint64CacherStub) Keys

func (ucs *Uint64CacherStub) Keys() []uint64

Keys -

func (*Uint64CacherStub) Len

func (ucs *Uint64CacherStub) Len() int

Len -

func (*Uint64CacherStub) Peek

func (ucs *Uint64CacherStub) Peek(nonce uint64) (interface{}, bool)

Peek -

func (*Uint64CacherStub) Put

func (ucs *Uint64CacherStub) Put(nonce uint64, value interface{}) bool

Put -

func (*Uint64CacherStub) RegisterHandler

func (ucs *Uint64CacherStub) RegisterHandler(handler func(nonce uint64))

RegisterHandler -

func (*Uint64CacherStub) Remove

func (ucs *Uint64CacherStub) Remove(nonce uint64)

Remove -

func (*Uint64CacherStub) RemoveOldest

func (ucs *Uint64CacherStub) RemoveOldest()

RemoveOldest -

type UnsignedTxHandlerMock

type UnsignedTxHandlerMock struct {
	CleanProcessedUtxsCalled    func()
	ProcessTransactionFeeCalled func(cost *big.Int)
	CreateAllUTxsCalled         func() []data.TransactionHandler
	VerifyCreatedUTxsCalled     func() error
	AddTxFeeFromBlockCalled     func(tx data.TransactionHandler)
}

UnsignedTxHandlerMock -

func (*UnsignedTxHandlerMock) AddRewardTxFromBlock

func (ut *UnsignedTxHandlerMock) AddRewardTxFromBlock(tx data.TransactionHandler)

AddRewardTxFromBlock -

func (*UnsignedTxHandlerMock) CleanProcessedUTxs

func (ut *UnsignedTxHandlerMock) CleanProcessedUTxs()

CleanProcessedUTxs -

func (*UnsignedTxHandlerMock) CreateAllUTxs

func (ut *UnsignedTxHandlerMock) CreateAllUTxs() []data.TransactionHandler

CreateAllUTxs -

func (*UnsignedTxHandlerMock) ProcessTransactionFee

func (ut *UnsignedTxHandlerMock) ProcessTransactionFee(cost *big.Int)

ProcessTransactionFee -

func (*UnsignedTxHandlerMock) VerifyCreatedUTxs

func (ut *UnsignedTxHandlerMock) VerifyCreatedUTxs() error

VerifyCreatedUTxs -

type UpdaterStub

type UpdaterStub struct {
	UpdateCalled func(key, value []byte) error
}

UpdaterStub -

func (*UpdaterStub) IsInterfaceNil

func (updater *UpdaterStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*UpdaterStub) Update

func (updater *UpdaterStub) Update(key, value []byte) error

Update -

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL