mock

package
v1.2.36-indexer1.1.26 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2021 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMultipleShardsCoordinatorFake

func NewMultipleShardsCoordinatorFake(numOfShards uint32, currentShard uint32) *multipleShardsCoordinatorFake

NewMultipleShardsCoordinatorFake -

Types

type EpochHandlerMock

type EpochHandlerMock struct {
	EpochValue uint32
}

EpochHandlerMock -

func (*EpochHandlerMock) Epoch

func (ehm *EpochHandlerMock) Epoch() uint32

Epoch -

func (*EpochHandlerMock) IsInterfaceNil

func (ehm *EpochHandlerMock) IsInterfaceNil() bool

IsInterfaceNil -

type EpochHandlerStub added in v1.0.102

type EpochHandlerStub struct {
	EpochCalled func() uint32
}

EpochHandlerStub -

func (*EpochHandlerStub) Epoch added in v1.0.102

func (ehs *EpochHandlerStub) Epoch() uint32

Epoch -

func (*EpochHandlerStub) IsInterfaceNil added in v1.0.102

func (ehs *EpochHandlerStub) IsInterfaceNil() bool

IsInterfaceNil -

type EpochStartNotifierStub

type EpochStartNotifierStub struct {
	RegisterHandlerCalled   func(handler epochStart.ActionHandler)
	UnregisterHandlerCalled func(handler epochStart.ActionHandler)
	NotifyAllPrepareCalled  func(hdr data.HeaderHandler, body data.BodyHandler)
	NotifyAllCalled         func(hdr data.HeaderHandler)
}

EpochStartNotifierStub -

func (*EpochStartNotifierStub) IsInterfaceNil

func (esnm *EpochStartNotifierStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*EpochStartNotifierStub) NotifyAll

func (esnm *EpochStartNotifierStub) NotifyAll(hdr data.HeaderHandler)

NotifyAll -

func (*EpochStartNotifierStub) NotifyAllPrepare

func (esnm *EpochStartNotifierStub) NotifyAllPrepare(metaHdr data.HeaderHandler, body data.BodyHandler)

NotifyAllPrepare -

func (*EpochStartNotifierStub) RegisterHandler

func (esnm *EpochStartNotifierStub) RegisterHandler(handler epochStart.ActionHandler)

RegisterHandler -

func (*EpochStartNotifierStub) UnregisterHandler

func (esnm *EpochStartNotifierStub) UnregisterHandler(handler epochStart.ActionHandler)

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

func (*HasherMock) Size

func (sha *HasherMock) Size() int

Size return the required size in bytes

type HasherStub

type HasherStub struct {
	ComputeCalled   func(s string) []byte
	EmptyHashCalled func() []byte
	SizeCalled      func() int
}

HasherStub -

func (*HasherStub) Compute

func (hs *HasherStub) Compute(s string) []byte

Compute will output the SHA's equivalent of the input string

func (*HasherStub) EmptyHash

func (hs *HasherStub) EmptyHash() []byte

EmptyHash will return the equivalent of empty string SHA's

func (*HasherStub) IsInterfaceNil

func (hs *HasherStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*HasherStub) Size

func (hs *HasherStub) Size() int

Size returns the required size in bytes

type ListIndexUpdaterStub added in v1.0.102

type ListIndexUpdaterStub struct {
	UpdateListAndIndexCalled func(pubKey string, shardID uint32, list string, index uint32) error
}

ListIndexUpdaterStub -

func (*ListIndexUpdaterStub) IsInterfaceNil added in v1.0.102

func (lius *ListIndexUpdaterStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ListIndexUpdaterStub) UpdateListAndIndex added in v1.0.102

func (lius *ListIndexUpdaterStub) UpdateListAndIndex(pubKey string, shardID uint32, list string, index uint32) error

UpdateListAndIndex -

type MarshalizerMock added in v1.0.102

type MarshalizerMock struct {
	Fail bool
}

MarshalizerMock that will be used for testing

func (*MarshalizerMock) IsInterfaceNil added in v1.0.102

func (mm *MarshalizerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*MarshalizerMock) Marshal added in v1.0.102

func (mm *MarshalizerMock) Marshal(obj interface{}) ([]byte, error)

Marshal converts the input object in a slice of bytes

func (*MarshalizerMock) Unmarshal added in v1.0.102

func (mm *MarshalizerMock) Unmarshal(obj interface{}, buff []byte) error

Unmarshal applies the serialized values over an instantiated object

type NodesCoordinatorCacheMock

type NodesCoordinatorCacheMock struct {
	ClearCalled func()
	PutCalled   func(key []byte, value interface{}, sieInBytes int) (evicted bool)
	GetCalled   func(key []byte) (value interface{}, ok bool)
}

NodesCoordinatorCacheMock -

func (*NodesCoordinatorCacheMock) Clear added in v1.0.111

func (rm *NodesCoordinatorCacheMock) Clear()

Clear -

func (*NodesCoordinatorCacheMock) Get

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

Get -

func (*NodesCoordinatorCacheMock) Put

func (rm *NodesCoordinatorCacheMock) Put(key []byte, value interface{}, sizeInBytes int) (evicted bool)

Put -

type PubkeyConverterMock added in v1.0.104

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

PubkeyConverterMock -

func NewPubkeyConverterMock added in v1.0.104

func NewPubkeyConverterMock(addressLen int) *PubkeyConverterMock

NewPubkeyConverterMock -

func (*PubkeyConverterMock) Decode added in v1.0.104

func (pcm *PubkeyConverterMock) Decode(humanReadable string) ([]byte, error)

Decode -

func (*PubkeyConverterMock) Encode added in v1.0.104

func (pcm *PubkeyConverterMock) Encode(pkBytes []byte) string

Encode -

func (*PubkeyConverterMock) IsInterfaceNil added in v1.0.104

func (pcm *PubkeyConverterMock) IsInterfaceNil() bool

IsInterfaceNil -

func (*PubkeyConverterMock) Len added in v1.0.104

func (pcm *PubkeyConverterMock) Len() int

Len -

type RaterMock

type RaterMock struct {
	ComputeRatingCalled  func(string, uint32) uint32
	GetRatingCalled      func(string) uint32
	GetStartRatingCalled func() uint32
	GetChancesCalled     func(uint32) uint32
}

RaterMock -

func (*RaterMock) ComputeRating

func (rm *RaterMock) ComputeRating(ratingOptionKey string, previousValue uint32) uint32

ComputeRating -

func (*RaterMock) GetChance

func (rm *RaterMock) GetChance(rating uint32) uint32

GetChance -

func (*RaterMock) GetRating

func (rm *RaterMock) GetRating(pk string) uint32

GetRating -

func (*RaterMock) GetStartRating

func (rm *RaterMock) GetStartRating() uint32

GetStartRating -

func (*RaterMock) IsInterfaceNil

func (rm *RaterMock) IsInterfaceNil() bool

IsInterfaceNil -

type ShuffledOutHandlerStub added in v1.0.103

type ShuffledOutHandlerStub struct {
	ProcessCalled         func(newShardID uint32) error
	RegisterHandlerCalled func(handler func(newShardID uint32))
	CurrentShardIDCalled  func() uint32
}

ShuffledOutHandlerStub -

func (*ShuffledOutHandlerStub) CurrentShardID added in v1.0.103

func (s *ShuffledOutHandlerStub) CurrentShardID() uint32

CurrentShardID -

func (*ShuffledOutHandlerStub) IsInterfaceNil added in v1.0.103

func (s *ShuffledOutHandlerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*ShuffledOutHandlerStub) Process added in v1.0.103

func (s *ShuffledOutHandlerStub) Process(newShardID uint32) error

Process -

func (*ShuffledOutHandlerStub) RegisterHandler added in v1.0.103

func (s *ShuffledOutHandlerStub) RegisterHandler(handler func(newShardID uint32))

RegisterHandler -

type StorerMock

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

StorerMock -

func NewStorerMock

func NewStorerMock() *StorerMock

NewStorerMock -

func (*StorerMock) ClearCache

func (sm *StorerMock) ClearCache()

ClearCache -

func (*StorerMock) Close

func (sm *StorerMock) Close() error

Close -

func (*StorerMock) DestroyUnit

func (sm *StorerMock) DestroyUnit() error

DestroyUnit -

func (*StorerMock) Get

func (sm *StorerMock) Get(key []byte) ([]byte, error)

Get -

func (*StorerMock) GetBulkFromEpoch added in v1.0.147

func (sm *StorerMock) GetBulkFromEpoch(keys [][]byte, _ uint32) (map[string][]byte, error)

GetBulkFromEpoch -

func (*StorerMock) GetFromEpoch

func (sm *StorerMock) GetFromEpoch(key []byte, _ uint32) ([]byte, error)

GetFromEpoch -

func (*StorerMock) GetOldestEpoch added in v1.2.4

func (sm *StorerMock) GetOldestEpoch() (uint32, error)

GetOldestEpoch -

func (*StorerMock) Has

func (sm *StorerMock) Has(_ []byte) error

Has -

func (*StorerMock) IsInterfaceNil

func (sm *StorerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*StorerMock) Put

func (sm *StorerMock) Put(key, data []byte) error

Put -

func (*StorerMock) PutInEpoch added in v1.1.1

func (sm *StorerMock) PutInEpoch(key, data []byte, _ uint32) error

PutInEpoch -

func (*StorerMock) RangeKeys added in v1.0.138

func (sm *StorerMock) RangeKeys(_ func(key []byte, val []byte) bool)

RangeKeys -

func (*StorerMock) Remove

func (sm *StorerMock) Remove(_ []byte) error

Remove -

func (*StorerMock) SearchFirst

func (sm *StorerMock) SearchFirst(key []byte) ([]byte, error)

SearchFirst -

type ValidatorMock

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

ValidatorMock -

func NewValidatorMock

func NewValidatorMock(pubKey []byte, chances uint32, index uint32) *ValidatorMock

NewValidatorMock -

func (*ValidatorMock) Chances added in v0.0.5

func (vm *ValidatorMock) Chances() uint32

Chances -

func (*ValidatorMock) Index added in v1.0.102

func (vm *ValidatorMock) Index() uint32

Index -

func (*ValidatorMock) PubKey

func (vm *ValidatorMock) PubKey() []byte

PubKey -

func (*ValidatorMock) Size added in v1.0.123

func (vm *ValidatorMock) Size() int

Size -

Jump to

Keyboard shortcuts

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