mock

package
v1.0.144 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2020 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthAccountWrapperMock        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowAccountWrapperMock          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupAccountWrapperMock = fmt.Errorf("proto: unexpected end of group")
)

Functions

This section is empty.

Types

type AccountWrapMock

type AccountWrapMock struct {
	AccountWrapMockData

	CodeHash     []byte
	CodeMetadata []byte
	RootHash     []byte

	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 []byte) *AccountWrapMock

NewAccountWrapMock -

func (*AccountWrapMock) AddToBalance

func (awm *AccountWrapMock) AddToBalance(_ *big.Int) error

AddToBalance -

func (*AccountWrapMock) AddToDeveloperReward

func (awm *AccountWrapMock) AddToDeveloperReward(*big.Int)

AddToDeveloperReward -

func (*AccountWrapMock) AddressBytes added in v1.0.113

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

AddressBytes -

func (*AccountWrapMock) ChangeOwnerAddress

func (awm *AccountWrapMock) ChangeOwnerAddress([]byte, []byte) error

ChangeOwnerAddress -

func (*AccountWrapMock) ClaimDeveloperRewards

func (awm *AccountWrapMock) ClaimDeveloperRewards([]byte) (*big.Int, error)

ClaimDeveloperRewards -

func (*AccountWrapMock) DataTrie

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

DataTrie -

func (*AccountWrapMock) DataTrieTracker

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

DataTrieTracker -

func (*AccountWrapMock) GetBalance

func (awm *AccountWrapMock) GetBalance() *big.Int

GetBalance -

func (*AccountWrapMock) GetCode

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

GetCode -

func (*AccountWrapMock) GetCodeHash

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

GetCodeHash -

func (*AccountWrapMock) GetCodeMetadata added in v1.0.103

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

GetCodeMetadata -

func (*AccountWrapMock) GetDeveloperReward

func (awm *AccountWrapMock) GetDeveloperReward() *big.Int

GetDeveloperReward -

func (*AccountWrapMock) GetNonce

func (awm *AccountWrapMock) GetNonce() uint64

GetNonce gets the nonce of the account

func (*AccountWrapMock) GetOwnerAddress

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

GetOwnerAddress -

func (*AccountWrapMock) GetRootHash

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

GetRootHash -

func (*AccountWrapMock) GetUserName added in v1.0.103

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

GetUserName -

func (*AccountWrapMock) IncreaseNonce

func (awm *AccountWrapMock) IncreaseNonce(val uint64)

IncreaseNonce adds the given value to the current nonce

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) SetCodeMetadata added in v1.0.103

func (awm *AccountWrapMock) SetCodeMetadata(codeMetadata []byte)

SetCodeMetadata -

func (*AccountWrapMock) SetDataTrie

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

SetDataTrie -

func (*AccountWrapMock) SetOwnerAddress

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

SetOwnerAddress -

func (*AccountWrapMock) SetRootHash

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

SetRootHash -

func (*AccountWrapMock) SetUserName added in v1.0.103

func (awm *AccountWrapMock) SetUserName(_ []byte)

SetUserName -

func (*AccountWrapMock) SubFromBalance

func (awm *AccountWrapMock) SubFromBalance(_ *big.Int) error

SubFromBalance -

type AccountWrapMockData

type AccountWrapMockData struct {
	MockValue int64 `protobuf:"varint,1,opt,name=MockValue,proto3" json:"MockValue,omitempty"`
}

func (*AccountWrapMockData) Descriptor

func (*AccountWrapMockData) Descriptor() ([]byte, []int)

func (*AccountWrapMockData) Equal

func (this *AccountWrapMockData) Equal(that interface{}) bool

func (*AccountWrapMockData) GetMockValue

func (m *AccountWrapMockData) GetMockValue() int64

func (*AccountWrapMockData) GoString

func (this *AccountWrapMockData) GoString() string

func (*AccountWrapMockData) Marshal

func (m *AccountWrapMockData) Marshal() (dAtA []byte, err error)

func (*AccountWrapMockData) MarshalTo

func (m *AccountWrapMockData) MarshalTo(dAtA []byte) (int, error)

func (*AccountWrapMockData) MarshalToSizedBuffer

func (m *AccountWrapMockData) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*AccountWrapMockData) ProtoMessage

func (*AccountWrapMockData) ProtoMessage()

func (*AccountWrapMockData) Reset

func (m *AccountWrapMockData) Reset()

func (*AccountWrapMockData) Size

func (m *AccountWrapMockData) Size() (n int)

func (*AccountWrapMockData) String

func (this *AccountWrapMockData) String() string

func (*AccountWrapMockData) Unmarshal

func (m *AccountWrapMockData) Unmarshal(dAtA []byte) error

func (*AccountWrapMockData) XXX_DiscardUnknown

func (m *AccountWrapMockData) XXX_DiscardUnknown()

func (*AccountWrapMockData) XXX_Marshal

func (m *AccountWrapMockData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*AccountWrapMockData) XXX_Merge

func (m *AccountWrapMockData) XXX_Merge(src proto.Message)

func (*AccountWrapMockData) XXX_Size

func (m *AccountWrapMockData) XXX_Size() int

func (*AccountWrapMockData) XXX_Unmarshal

func (m *AccountWrapMockData) XXX_Unmarshal(b []byte) error

type AccountsFactoryStub

type AccountsFactoryStub struct {
	CreateAccountCalled func(address []byte) (state.AccountHandler, error)
}

AccountsFactoryStub -

func (*AccountsFactoryStub) CreateAccount

func (afs *AccountsFactoryStub) CreateAccount(address []byte) (state.AccountHandler, error)

CreateAccount -

func (*AccountsFactoryStub) IsInterfaceNil

func (afs *AccountsFactoryStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

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 DataTrieTrackerStub

type DataTrieTrackerStub struct {
	ClearDataCachesCalled func()
	DirtyDataCalled       func() map[string][]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) 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
	OpMutex     sync.RWMutex
}

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.

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) IsInterfaceNil

func (ewl *EvictionWaitingList) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

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

func (*EvictionWaitingList) ShouldKeepHash added in v1.0.114

func (ewl *EvictionWaitingList) ShouldKeepHash(hash string, identifier data.TriePruningIdentifier) (bool, error)

ShouldKeepHash --

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 MarshalizerStub added in v1.0.104

type MarshalizerStub struct {
	MarshalCalled   func(obj interface{}) ([]byte, error)
	UnmarshalCalled func(obj interface{}, buff []byte) error
}

MarshalizerStub -

func (*MarshalizerStub) IsInterfaceNil added in v1.0.104

func (ms *MarshalizerStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*MarshalizerStub) Marshal added in v1.0.104

func (ms *MarshalizerStub) Marshal(obj interface{}) ([]byte, error)

Marshal -

func (*MarshalizerStub) Unmarshal added in v1.0.104

func (ms *MarshalizerStub) Unmarshal(obj interface{}, buff []byte) error

Unmarshal -

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) RangeKeys added in v1.0.138

func (s *MemDbMock) RangeKeys(handler func(key []byte, value []byte) bool)

RangeKeys will iterate over all contained (key, value) pairs calling the handler for each pair

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 []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 -

func (*MultipleShardsCoordinatorMock) SetNoShards

func (scm *MultipleShardsCoordinatorMock) SetNoShards(noShards uint32)

SetNoShards -

func (*MultipleShardsCoordinatorMock) SetSelfId

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

SetSelfId -

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 PubkeyConverterStub added in v1.0.104

type PubkeyConverterStub struct {
	LenCalled    func() int
	DecodeCalled func(humanReadable string) ([]byte, error)
	EncodeCalled func(pkBytes []byte) string
}

PubkeyConverterStub -

func (*PubkeyConverterStub) Decode added in v1.0.104

func (pcs *PubkeyConverterStub) Decode(humanReadable string) ([]byte, error)

Decode -

func (*PubkeyConverterStub) Encode added in v1.0.104

func (pcs *PubkeyConverterStub) Encode(pkBytes []byte) string

Encode -

func (*PubkeyConverterStub) IsInterfaceNil added in v1.0.104

func (pcs *PubkeyConverterStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*PubkeyConverterStub) Len added in v1.0.104

func (pcs *PubkeyConverterStub) Len() int

Len -

type RequestHandlerStub added in v1.0.102

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 added in v1.0.102

func (rhs *RequestHandlerStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*RequestHandlerStub) RequestInterval added in v1.0.102

func (rhs *RequestHandlerStub) RequestInterval() time.Duration

RequestInterval -

func (*RequestHandlerStub) RequestMetaHeader added in v1.0.102

func (rhs *RequestHandlerStub) RequestMetaHeader(hash []byte)

RequestMetaHeader -

func (*RequestHandlerStub) RequestMetaHeaderByNonce added in v1.0.102

func (rhs *RequestHandlerStub) RequestMetaHeaderByNonce(nonce uint64)

RequestMetaHeaderByNonce -

func (*RequestHandlerStub) RequestMiniBlock added in v1.0.102

func (rhs *RequestHandlerStub) RequestMiniBlock(destShardID uint32, miniblockHash []byte)

RequestMiniBlock -

func (*RequestHandlerStub) RequestMiniBlocks added in v1.0.102

func (rhs *RequestHandlerStub) RequestMiniBlocks(destShardID uint32, miniblocksHashes [][]byte)

RequestMiniBlocks -

func (*RequestHandlerStub) RequestRewardTransactions added in v1.0.102

func (rhs *RequestHandlerStub) RequestRewardTransactions(destShardID uint32, txHashes [][]byte)

RequestRewardTransactions -

func (*RequestHandlerStub) RequestShardHeader added in v1.0.102

func (rhs *RequestHandlerStub) RequestShardHeader(shardID uint32, hash []byte)

RequestShardHeader -

func (*RequestHandlerStub) RequestShardHeaderByNonce added in v1.0.102

func (rhs *RequestHandlerStub) RequestShardHeaderByNonce(shardID uint32, nonce uint64)

RequestShardHeaderByNonce -

func (*RequestHandlerStub) RequestStartOfEpochMetaBlock added in v1.0.102

func (rhs *RequestHandlerStub) RequestStartOfEpochMetaBlock(epoch uint32)

RequestStartOfEpochMetaBlock -

func (*RequestHandlerStub) RequestTransaction added in v1.0.102

func (rhs *RequestHandlerStub) RequestTransaction(destShardID uint32, txHashes [][]byte)

RequestTransaction -

func (*RequestHandlerStub) RequestTrieNodes added in v1.0.102

func (rhs *RequestHandlerStub) RequestTrieNodes(destShardID uint32, hashes [][]byte, topic string)

RequestTrieNodes -

func (*RequestHandlerStub) RequestUnsignedTransactions added in v1.0.102

func (rhs *RequestHandlerStub) RequestUnsignedTransactions(destShardID uint32, txHashes [][]byte)

RequestUnsignedTransactions -

func (*RequestHandlerStub) SetEpoch added in v1.0.102

func (rhs *RequestHandlerStub) SetEpoch(_ uint32)

SetEpoch -

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(_ []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) SelfId

func (scm ShardCoordinatorMock) SelfId() uint32

SelfId -

func (ShardCoordinatorMock) SetSelfId

func (scm ShardCoordinatorMock) SetSelfId(_ uint32) error

SetSelfId -

type StorageManagerStub added in v1.0.129

type StorageManagerStub struct {
	DatabaseCalled                    func() data.DBWriteCacher
	TakeSnapshotCalled                func([]byte)
	SetCheckpointCalled               func([]byte)
	PruneCalled                       func([]byte)
	CancelPruneCalled                 func([]byte)
	MarkForEvictionCalled             func([]byte, data.ModifiedHashes) error
	GetDbThatContainsHashCalled       func([]byte) data.DBWriteCacher
	GetSnapshotThatContainsHashCalled func(rootHash []byte) data.SnapshotDbHandler
	IsPruningEnabledCalled            func() bool
	EnterSnapshotModeCalled           func()
	ExitSnapshotModeCalled            func()
	IsInterfaceNilCalled              func() bool
}

StorageManagerStub --

func (*StorageManagerStub) CancelPrune added in v1.0.129

func (sms *StorageManagerStub) CancelPrune([]byte, data.TriePruningIdentifier)

CancelPrune --

func (*StorageManagerStub) Database added in v1.0.129

func (sms *StorageManagerStub) Database() data.DBWriteCacher

Database --

func (*StorageManagerStub) EnterSnapshotMode added in v1.0.129

func (sms *StorageManagerStub) EnterSnapshotMode()

EnterSnapshotMode --

func (*StorageManagerStub) ExitSnapshotMode added in v1.0.129

func (sms *StorageManagerStub) ExitSnapshotMode()

ExitSnapshotMode --

func (*StorageManagerStub) GetSnapshotThatContainsHash added in v1.0.129

func (sms *StorageManagerStub) GetSnapshotThatContainsHash(d []byte) data.SnapshotDbHandler

GetSnapshotThatContainsHash --

func (*StorageManagerStub) IsInterfaceNil added in v1.0.129

func (sms *StorageManagerStub) IsInterfaceNil() bool

IsInterfaceNil --

func (*StorageManagerStub) IsPruningEnabled added in v1.0.129

func (sms *StorageManagerStub) IsPruningEnabled() bool

IsPruningEnabled --

func (*StorageManagerStub) MarkForEviction added in v1.0.129

func (sms *StorageManagerStub) MarkForEviction(d []byte, m data.ModifiedHashes) error

MarkForEviction --

func (*StorageManagerStub) Prune added in v1.0.129

Prune --

func (*StorageManagerStub) SetCheckpoint added in v1.0.129

func (sms *StorageManagerStub) SetCheckpoint([]byte)

SetCheckpoint --

func (*StorageManagerStub) TakeSnapshot added in v1.0.129

func (sms *StorageManagerStub) TakeSnapshot([]byte)

TakeSnapshot --

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
	RangeKeysCalled    func(handler func(key []byte, val []byte) bool)
}

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) RangeKeys added in v1.0.138

func (ss *StorerStub) RangeKeys(handler func(key []byte, val []byte) bool)

RangeKeys -

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, _ core.PeerID) 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)
	CommitCalled                func() error
	RecreateCalled              func(root []byte) (data.Trie, error)
	CancelPruneCalled           func(rootHash []byte, identifier data.TriePruningIdentifier)
	PruneCalled                 func(rootHash []byte, identifier data.TriePruningIdentifier)
	ResetOldHashesCalled        func() [][]byte
	AppendToOldHashesCalled     func([][]byte)
	TakeSnapshotCalled          func(rootHash []byte)
	SetCheckpointCalled         func(rootHash []byte)
	GetSerializedNodesCalled    func([]byte, uint64) ([][]byte, uint64, error)
	DatabaseCalled              func() data.DBWriteCacher
	GetAllLeavesCalled          func() (map[string][]byte, error)
	GetAllLeavesOnChannelCalled func() chan core.KeyValueHolder
	GetAllHashesCalled          func() ([][]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) Delete

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

Delete -

func (*TrieStub) EnterSnapshotMode added in v1.0.102

func (ts *TrieStub) EnterSnapshotMode()

EnterSnapshotMode -

func (*TrieStub) ExitSnapshotMode added in v1.0.102

func (ts *TrieStub) ExitSnapshotMode()

ExitSnapshotMode -

func (*TrieStub) Get

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

Get -

func (*TrieStub) GetAllHashes added in v1.0.137

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

GetAllHashes -

func (*TrieStub) GetAllLeaves

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

GetAllLeaves -

func (*TrieStub) GetAllLeavesOnChannel added in v1.0.137

func (ts *TrieStub) GetAllLeavesOnChannel() chan core.KeyValueHolder

GetAllLeavesOnChannel -

func (*TrieStub) GetDirtyHashes added in v1.0.111

func (ts *TrieStub) GetDirtyHashes() (data.ModifiedHashes, error)

GetDirtyHashes -

func (*TrieStub) GetSerializedNodes

func (ts *TrieStub) GetSerializedNodes(hash []byte, maxBuffToSend uint64) ([][]byte, uint64, 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) Prune

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

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) SetNewHashes added in v1.0.111

func (ts *TrieStub) SetNewHashes(_ data.ModifiedHashes)

SetNewHashes -

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 -

type UnsignedTxHandlerMock

type UnsignedTxHandlerMock struct {
	CleanProcessedUtxsCalled    func()
	ProcessTransactionFeeCalled func(cost *big.Int, hash []byte)
	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, hash []byte)

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