mock

package
v1.7.4 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: GPL-3.0 Imports: 9 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 EnableEpochsHandlerMock

type EnableEpochsHandlerMock struct {
	RefactorPeersMiniBlocksEnableEpochField   uint32
	IsRefactorPeersMiniBlocksFlagEnabledField bool
	CurrentEpoch                              uint32
}

EnableEpochsHandlerMock -

func (*EnableEpochsHandlerMock) FixGasRemainingForSaveKeyValueBuiltinFunctionEnabled added in v1.6.4

func (mock *EnableEpochsHandlerMock) FixGasRemainingForSaveKeyValueBuiltinFunctionEnabled() bool

FixGasRemainingForSaveKeyValueBuiltinFunctionEnabled -

func (*EnableEpochsHandlerMock) GetActivationEpoch added in v1.7.0

func (mock *EnableEpochsHandlerMock) GetActivationEpoch(flag core.EnableEpochFlag) uint32

GetActivationEpoch -

func (*EnableEpochsHandlerMock) GetCurrentEpoch added in v1.7.0

func (mock *EnableEpochsHandlerMock) GetCurrentEpoch() uint32

GetCurrentEpoch -

func (*EnableEpochsHandlerMock) IsFlagDefined added in v1.7.0

func (mock *EnableEpochsHandlerMock) IsFlagDefined(_ core.EnableEpochFlag) bool

IsFlagDefined returns true

func (*EnableEpochsHandlerMock) IsFlagEnabled added in v1.7.0

func (mock *EnableEpochsHandlerMock) IsFlagEnabled(_ core.EnableEpochFlag) bool

IsFlagEnabled returns true

func (*EnableEpochsHandlerMock) IsFlagEnabledInEpoch added in v1.7.0

func (mock *EnableEpochsHandlerMock) IsFlagEnabledInEpoch(_ core.EnableEpochFlag, _ uint32) bool

IsFlagEnabledInEpoch returns true

func (*EnableEpochsHandlerMock) IsInterfaceNil

func (mock *EnableEpochsHandlerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

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

type EpochHandlerStub struct {
	EpochCalled func() uint32
}

EpochHandlerStub -

func (*EpochHandlerStub) Epoch

func (ehs *EpochHandlerStub) Epoch() uint32

Epoch -

func (*EpochHandlerStub) IsInterfaceNil

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, validatorInfoCacher epochStart.ValidatorInfoCacher)
	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, validatorInfoCacher epochStart.ValidatorInfoCacher)

NotifyAllPrepare -

func (*EpochStartNotifierStub) RegisterHandler

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

RegisterHandler -

func (*EpochStartNotifierStub) UnregisterHandler

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

UnregisterHandler -

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

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

ListIndexUpdaterStub -

func (*ListIndexUpdaterStub) IsInterfaceNil

func (lius *ListIndexUpdaterStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ListIndexUpdaterStub) UpdateListAndIndex

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

UpdateListAndIndex -

type MarshalizerMock

type MarshalizerMock struct {
	Fail bool
}

MarshalizerMock that will be used for testing

func (*MarshalizerMock) IsInterfaceNil

func (mm *MarshalizerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*MarshalizerMock) Marshal

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

Marshal converts the input object in a slice of bytes

func (*MarshalizerMock) Unmarshal

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

Unmarshal applies the serialized values over an instantiated object

type 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

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

type NodesSetupMock struct {
	MinShardHysteresisNodesCalled func() uint32
	MinMetaHysteresisNodesCalled  func() uint32
}

NodesSetupMock -

func (*NodesSetupMock) IsInterfaceNil added in v1.7.0

func (mock *NodesSetupMock) IsInterfaceNil() bool

IsInterfaceNil -

func (*NodesSetupMock) MinMetaHysteresisNodes added in v1.7.0

func (mock *NodesSetupMock) MinMetaHysteresisNodes() uint32

MinMetaHysteresisNodes -

func (*NodesSetupMock) MinShardHysteresisNodes added in v1.7.0

func (mock *NodesSetupMock) MinShardHysteresisNodes() uint32

MinShardHysteresisNodes -

type PubkeyConverterMock

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

PubkeyConverterMock -

func NewPubkeyConverterMock

func NewPubkeyConverterMock(addressLen int) *PubkeyConverterMock

NewPubkeyConverterMock -

func (*PubkeyConverterMock) Decode

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

Decode -

func (*PubkeyConverterMock) Encode

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

Encode -

func (*PubkeyConverterMock) EncodeSlice added in v1.6.0

func (pcm *PubkeyConverterMock) EncodeSlice(pkBytesSlice [][]byte) ([]string, error)

EncodeSlice -

func (*PubkeyConverterMock) IsInterfaceNil

func (pcm *PubkeyConverterMock) IsInterfaceNil() bool

IsInterfaceNil -

func (*PubkeyConverterMock) Len

func (pcm *PubkeyConverterMock) Len() int

Len -

func (*PubkeyConverterMock) SilentEncode added in v1.6.0

func (pcm *PubkeyConverterMock) SilentEncode(pkBytes []byte, log core.Logger) string

SilentEncode -

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

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

ShuffledOutHandlerStub -

func (*ShuffledOutHandlerStub) CurrentShardID

func (s *ShuffledOutHandlerStub) CurrentShardID() uint32

CurrentShardID -

func (*ShuffledOutHandlerStub) IsInterfaceNil

func (s *ShuffledOutHandlerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*ShuffledOutHandlerStub) Process

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

Process -

func (*ShuffledOutHandlerStub) RegisterHandler

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

RegisterHandler -

Jump to

Keyboard shortcuts

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