mock

package
v1.999.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMultipleShardsCoordinatorMock

func NewMultipleShardsCoordinatorMock() *multipleShardsCoordinatorMock

NewMultipleShardsCoordinatorMock -

func NewNonceHashConverterMock

func NewNonceHashConverterMock() *nonceHashConverterMock

NewNonceHashConverterMock -

func NewOneShardCoordinatorMock

func NewOneShardCoordinatorMock() *oneShardCoordinatorMock

NewOneShardCoordinatorMock -

func NewTopicMessageHandlerStub

func NewTopicMessageHandlerStub() *topicMessageHandlerStub

NewTopicMessageHandlerStub -

Types

type ChainStorerMock

type ChainStorerMock struct {
	AddStorerCalled     func(key dataRetriever.UnitType, s storage.Storer)
	GetStorerCalled     func(unitType dataRetriever.UnitType) storage.Storer
	HasCalled           func(unitType dataRetriever.UnitType, key []byte) error
	GetCalled           func(unitType dataRetriever.UnitType, key []byte) ([]byte, error)
	PutCalled           func(unitType dataRetriever.UnitType, key []byte, value []byte) error
	GetAllCalled        func(unitType dataRetriever.UnitType, keys [][]byte) (map[string][]byte, error)
	GetAllStorersCalled func() map[dataRetriever.UnitType]storage.Storer
	DestroyCalled       func() error
	CloseAllCalled      func() error
}

ChainStorerMock is a mock implementation of the ChainStorer interface

func (*ChainStorerMock) AddStorer

func (bc *ChainStorerMock) AddStorer(key dataRetriever.UnitType, s storage.Storer)

AddStorer will add a new storer to the chain map

func (*ChainStorerMock) CloseAll

func (bc *ChainStorerMock) CloseAll() error

CloseAll -

func (*ChainStorerMock) Destroy

func (bc *ChainStorerMock) Destroy() error

Destroy removes the underlying files/resources used by the storage service

func (*ChainStorerMock) Get

func (bc *ChainStorerMock) Get(unitType dataRetriever.UnitType, key []byte) ([]byte, error)

Get returns the value for the given key if found in the selected storage unit, nil otherwise. It can return an error if the provided unit type is not supported or if the storage unit underlying implementation reports an error

func (*ChainStorerMock) GetAll

func (bc *ChainStorerMock) GetAll(unitType dataRetriever.UnitType, keys [][]byte) (map[string][]byte, error)

GetAll gets all the elements with keys in the keys array, from the selected storage unit It can report an error if the provided unit type is not supported, if there is a missing key in the unit, or if the underlying implementation of the storage unit reports an error.

func (*ChainStorerMock) GetAllStorers

func (bc *ChainStorerMock) GetAllStorers() map[dataRetriever.UnitType]storage.Storer

GetAllStorers -

func (*ChainStorerMock) GetStorer

func (bc *ChainStorerMock) GetStorer(unitType dataRetriever.UnitType) storage.Storer

GetStorer returns the storer from the chain map or nil if the storer was not found

func (*ChainStorerMock) Has

func (bc *ChainStorerMock) Has(unitType dataRetriever.UnitType, key []byte) error

Has returns true if the key is found in the selected Unit or false otherwise It can return an error if the provided unit type is not supported or if the underlying implementation of the storage unit reports an error.

func (*ChainStorerMock) IsInterfaceNil

func (bc *ChainStorerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ChainStorerMock) Put

func (bc *ChainStorerMock) Put(unitType dataRetriever.UnitType, key []byte, value []byte) error

Put stores the key, value pair in the selected storage unit It can return an error if the provided unit type is not supported or if the storage unit underlying implementation reports an error

func (*ChainStorerMock) SetEpochForPutOperation

func (bc *ChainStorerMock) SetEpochForPutOperation(_ uint32)

SetEpochForPutOperation won't do anything

type ChunkResolverStub

type ChunkResolverStub struct {
	HashSliceResolverStub
	RequestDataFromReferenceAndChunkCalled func(hash []byte, chunkIndex uint32) error
}

ChunkResolverStub -

func (*ChunkResolverStub) RequestDataFromReferenceAndChunk

func (crs *ChunkResolverStub) RequestDataFromReferenceAndChunk(hash []byte, chunkIndex uint32) error

RequestDataFromReferenceAndChunk -

type CoordinatorStub

type CoordinatorStub struct {
	NumberOfShardsCalled          func() uint32
	ComputeIdCalled               func(address []byte) uint32
	SelfIdCalled                  func() uint32
	SameShardCalled               func(firstAddress, secondAddress []byte) bool
	CommunicationIdentifierCalled func(destShardID uint32) string
}

CoordinatorStub -

func (*CoordinatorStub) CommunicationIdentifier

func (coordinator *CoordinatorStub) CommunicationIdentifier(destShardID uint32) string

CommunicationIdentifier -

func (*CoordinatorStub) ComputeId

func (coordinator *CoordinatorStub) ComputeId(address []byte) uint32

ComputeId -

func (*CoordinatorStub) IsInterfaceNil

func (coordinator *CoordinatorStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*CoordinatorStub) NumberOfShards

func (coordinator *CoordinatorStub) NumberOfShards() uint32

NumberOfShards -

func (*CoordinatorStub) SameShard

func (coordinator *CoordinatorStub) SameShard(firstAddress, secondAddress []byte) bool

SameShard -

func (*CoordinatorStub) SelfId

func (coordinator *CoordinatorStub) SelfId() uint32

SelfId -

type CurrentNetworkEpochProviderStub

type CurrentNetworkEpochProviderStub struct {
	EpochIsActiveInNetworkCalled func(epoch uint32) bool
	EpochConfirmedCalled         func(newEpoch uint32, newTimestamp uint64)
}

CurrentNetworkEpochProviderStub -

func (*CurrentNetworkEpochProviderStub) EpochConfirmed

func (cneps *CurrentNetworkEpochProviderStub) EpochConfirmed(newEpoch uint32, newTimestamp uint64)

EpochConfirmed -

func (*CurrentNetworkEpochProviderStub) EpochIsActiveInNetwork

func (cneps *CurrentNetworkEpochProviderStub) EpochIsActiveInNetwork(epoch uint32) bool

EpochIsActiveInNetwork -

func (*CurrentNetworkEpochProviderStub) IsInterfaceNil

func (cneps *CurrentNetworkEpochProviderStub) IsInterfaceNil() bool

IsInterfaceNil -

type DataPackerStub

type DataPackerStub struct {
	PackDataInChunksCalled func(data [][]byte, limit int) ([][]byte, error)
}

DataPackerStub -

func (*DataPackerStub) IsInterfaceNil

func (dps *DataPackerStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*DataPackerStub) PackDataInChunks

func (dps *DataPackerStub) PackDataInChunks(data [][]byte, limit int) ([][]byte, error)

PackDataInChunks -

type EpochHandlerStub

type EpochHandlerStub struct {
	MetaEpochCalled func() uint32
}

EpochHandlerStub -

func (*EpochHandlerStub) IsInterfaceNil

func (ehs *EpochHandlerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*EpochHandlerStub) MetaEpoch

func (ehs *EpochHandlerStub) MetaEpoch() uint32

MetaEpoch -

type HashSliceResolverStub

type HashSliceResolverStub struct {
	RequestDataFromHashCalled      func(hash []byte, epoch uint32) error
	ProcessReceivedMessageCalled   func(message p2p.MessageP2P) error
	RequestDataFromHashArrayCalled func(hashes [][]byte, epoch uint32) error
	SetNumPeersToQueryCalled       func(intra int, cross int)
	NumPeersToQueryCalled          func() (int, int)
	SetResolverDebugHandlerCalled  func(handler dataRetriever.ResolverDebugHandler) error
	CloseCalled                    func() error
}

HashSliceResolverStub -

func (*HashSliceResolverStub) Close

func (hsrs *HashSliceResolverStub) Close() error

Close -

func (*HashSliceResolverStub) IsInterfaceNil

func (hsrs *HashSliceResolverStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*HashSliceResolverStub) NumPeersToQuery

func (hsrs *HashSliceResolverStub) NumPeersToQuery() (int, int)

NumPeersToQuery -

func (*HashSliceResolverStub) ProcessReceivedMessage

func (hsrs *HashSliceResolverStub) ProcessReceivedMessage(message p2p.MessageP2P, _ core.PeerID) error

ProcessReceivedMessage -

func (*HashSliceResolverStub) RequestDataFromHash

func (hsrs *HashSliceResolverStub) RequestDataFromHash(hash []byte, epoch uint32) error

RequestDataFromHash -

func (*HashSliceResolverStub) RequestDataFromHashArray

func (hsrs *HashSliceResolverStub) RequestDataFromHashArray(hashes [][]byte, epoch uint32) error

RequestDataFromHashArray -

func (*HashSliceResolverStub) SetNumPeersToQuery

func (hsrs *HashSliceResolverStub) SetNumPeersToQuery(intra int, cross int)

SetNumPeersToQuery -

func (*HashSliceResolverStub) SetResolverDebugHandler

func (hsrs *HashSliceResolverStub) SetResolverDebugHandler(handler dataRetriever.ResolverDebugHandler) error

SetResolverDebugHandler -

type HasherStub

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

HasherStub -

func (HasherStub) Compute

func (hash HasherStub) Compute(s string) []byte

Compute -

func (HasherStub) EmptyHash

func (hash HasherStub) EmptyHash() []byte

EmptyHash -

func (*HasherStub) IsInterfaceNil

func (hash *HasherStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (HasherStub) Size

func (HasherStub) Size() int

Size -

type HeaderResolverStub

type HeaderResolverStub struct {
	RequestDataFromHashCalled     func(hash []byte, epoch uint32) error
	ProcessReceivedMessageCalled  func(message p2p.MessageP2P) error
	RequestDataFromNonceCalled    func(nonce uint64, epoch uint32) error
	RequestDataFromEpochCalled    func(identifier []byte) error
	SetEpochHandlerCalled         func(epochHandler dataRetriever.EpochHandler) error
	SetNumPeersToQueryCalled      func(intra int, cross int)
	NumPeersToQueryCalled         func() (int, int)
	SetResolverDebugHandlerCalled func(handler dataRetriever.ResolverDebugHandler) error
	CloseCalled                   func() error
}

HeaderResolverStub -

func (*HeaderResolverStub) Close

func (hrs *HeaderResolverStub) Close() error

func (*HeaderResolverStub) IsInterfaceNil

func (hrs *HeaderResolverStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*HeaderResolverStub) NumPeersToQuery

func (hrs *HeaderResolverStub) NumPeersToQuery() (int, int)

NumPeersToQuery -

func (*HeaderResolverStub) ProcessReceivedMessage

func (hrs *HeaderResolverStub) ProcessReceivedMessage(message p2p.MessageP2P, _ core.PeerID) error

ProcessReceivedMessage -

func (*HeaderResolverStub) RequestDataFromEpoch

func (hrs *HeaderResolverStub) RequestDataFromEpoch(identifier []byte) error

RequestDataFromEpoch -

func (*HeaderResolverStub) RequestDataFromHash

func (hrs *HeaderResolverStub) RequestDataFromHash(hash []byte, epoch uint32) error

RequestDataFromHash -

func (*HeaderResolverStub) RequestDataFromNonce

func (hrs *HeaderResolverStub) RequestDataFromNonce(nonce uint64, epoch uint32) error

RequestDataFromNonce -

func (*HeaderResolverStub) SetEpochHandler

func (hrs *HeaderResolverStub) SetEpochHandler(epochHandler dataRetriever.EpochHandler) error

SetEpochHandler -

func (*HeaderResolverStub) SetNumPeersToQuery

func (hrs *HeaderResolverStub) SetNumPeersToQuery(intra int, cross int)

SetNumPeersToQuery -

func (*HeaderResolverStub) SetResolverDebugHandler

func (hrs *HeaderResolverStub) SetResolverDebugHandler(handler dataRetriever.ResolverDebugHandler) error

SetResolverDebugHandler -

type HeadersCacherStub

type HeadersCacherStub struct {
	AddCalled                           func(headerHash []byte, header data.HeaderHandler)
	RemoveHeaderByHashCalled            func(headerHash []byte)
	RemoveHeaderByNonceAndShardIdCalled func(hdrNonce uint64, shardId uint32)
	GetHeaderByNonceAndShardIdCalled    func(hdrNonce uint64, shardId uint32) ([]data.HeaderHandler, [][]byte, error)
	GetHeaderByHashCalled               func(hash []byte) (data.HeaderHandler, error)
	ClearCalled                         func()
	RegisterHandlerCalled               func(handler func(header data.HeaderHandler, shardHeaderHash []byte))
	NoncesCalled                        func(shardId uint32) []uint64
	LenCalled                           func() int
	MaxSizeCalled                       func() int
	GetNumHeadersCalled                 func(shardId uint32) int
}

HeadersCacherStub -

func (*HeadersCacherStub) AddHeader

func (hcs *HeadersCacherStub) AddHeader(headerHash []byte, header data.HeaderHandler)

AddHeader -

func (*HeadersCacherStub) Clear

func (hcs *HeadersCacherStub) Clear()

Clear -

func (*HeadersCacherStub) GetHeaderByHash

func (hcs *HeadersCacherStub) GetHeaderByHash(hash []byte) (data.HeaderHandler, error)

GetHeaderByHash -

func (*HeadersCacherStub) GetHeadersByNonceAndShardId

func (hcs *HeadersCacherStub) GetHeadersByNonceAndShardId(hdrNonce uint64, shardId uint32) ([]data.HeaderHandler, [][]byte, error)

GetHeadersByNonceAndShardId -

func (*HeadersCacherStub) GetNumHeaders

func (hcs *HeadersCacherStub) GetNumHeaders(shardId uint32) int

GetNumHeaders -

func (*HeadersCacherStub) IsInterfaceNil

func (hcs *HeadersCacherStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*HeadersCacherStub) Len

func (hcs *HeadersCacherStub) Len() int

Len -

func (*HeadersCacherStub) MaxSize

func (hcs *HeadersCacherStub) MaxSize() int

MaxSize -

func (*HeadersCacherStub) Nonces

func (hcs *HeadersCacherStub) Nonces(shardId uint32) []uint64

Nonces -

func (*HeadersCacherStub) RegisterHandler

func (hcs *HeadersCacherStub) RegisterHandler(handler func(header data.HeaderHandler, shardHeaderHash []byte))

RegisterHandler -

func (*HeadersCacherStub) RemoveHeaderByHash

func (hcs *HeadersCacherStub) RemoveHeaderByHash(headerHash []byte)

RemoveHeaderByHash -

func (*HeadersCacherStub) RemoveHeaderByNonceAndShardId

func (hcs *HeadersCacherStub) RemoveHeaderByNonceAndShardId(hdrNonce uint64, shardId uint32)

RemoveHeaderByNonceAndShardId -

type IntRandomizerStub

type IntRandomizerStub struct {
	IntnCalled func(n int) int
}

IntRandomizerStub -

func (*IntRandomizerStub) Intn

func (irs *IntRandomizerStub) Intn(n int) int

Intn -

func (*IntRandomizerStub) IsInterfaceNil

func (irs *IntRandomizerStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

type ManualEpochStartNotifierStub

type ManualEpochStartNotifierStub struct {
	NewEpochCalled     func(epoch uint32)
	CurrentEpochCalled func() uint32
}

ManualEpochStartNotifierStub -

func (*ManualEpochStartNotifierStub) CurrentEpoch

func (mesns *ManualEpochStartNotifierStub) CurrentEpoch() uint32

CurrentEpoch -

func (*ManualEpochStartNotifierStub) IsInterfaceNil

func (mesns *ManualEpochStartNotifierStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*ManualEpochStartNotifierStub) NewEpoch

func (mesns *ManualEpochStartNotifierStub) NewEpoch(epoch uint32)

NewEpoch -

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 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 MessageHandlerStub

type MessageHandlerStub struct {
	ConnectedPeersOnTopicCalled            func(topic string) []core.PeerID
	ConnectedFullHistoryPeersOnTopicCalled func(topic string) []core.PeerID
	SendToConnectedPeerCalled              func(topic string, buff []byte, peerID core.PeerID) error
	IDCalled                               func() core.PeerID
}

MessageHandlerStub -

func (*MessageHandlerStub) ConnectedFullHistoryPeersOnTopic

func (mhs *MessageHandlerStub) ConnectedFullHistoryPeersOnTopic(topic string) []core.PeerID

ConnectedFullHistoryPeersOnTopic -

func (*MessageHandlerStub) ConnectedPeersOnTopic

func (mhs *MessageHandlerStub) ConnectedPeersOnTopic(topic string) []core.PeerID

ConnectedPeersOnTopic -

func (*MessageHandlerStub) ID

func (mhs *MessageHandlerStub) ID() core.PeerID

ID -

func (*MessageHandlerStub) IsInterfaceNil

func (mhs *MessageHandlerStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*MessageHandlerStub) SendToConnectedPeer

func (mhs *MessageHandlerStub) SendToConnectedPeer(topic string, buff []byte, peerID core.PeerID) error

SendToConnectedPeer -

type MessengerStub

type MessengerStub struct {
	ConnectedPeersOnTopicCalled            func(topic string) []core.PeerID
	ConnectedFullHistoryPeersOnTopicCalled func(topic string) []core.PeerID
	CloseCalled                            func() error
	IDCalled                               func() core.PeerID
	PeersCalled                            func() []core.PeerID
	AddressesCalled                        func() []string
	ConnectToPeerCalled                    func(address string) error
	TrimConnectionsCalled                  func()
	IsConnectedCalled                      func(peerID core.PeerID) bool
	ConnectedPeersCalled                   func() []core.PeerID
	CreateTopicCalled                      func(name string, createChannelForTopic bool) error
	HasTopicCalled                         func(name string) bool
	HasTopicValidatorCalled                func(name string) bool
	BroadcastOnChannelCalled               func(channel string, topic string, buff []byte)
	BroadcastCalled                        func(topic string, buff []byte)
	RegisterMessageProcessorCalled         func(topic string, identifier string, handler p2p.MessageProcessor) error
	UnregisterMessageProcessorCalled       func(topic string, identifier string) error
	SendToConnectedPeerCalled              func(topic string, buff []byte, peerID core.PeerID) error
	OutgoingChannelLoadBalancerCalled      func() p2p.ChannelLoadBalancer
	BootstrapCalled                        func() error
}

MessengerStub -

func (*MessengerStub) Addresses

func (ms *MessengerStub) Addresses() []string

Addresses -

func (*MessengerStub) Bootstrap

func (ms *MessengerStub) Bootstrap() error

Bootstrap -

func (*MessengerStub) Broadcast

func (ms *MessengerStub) Broadcast(topic string, buff []byte)

Broadcast -

func (*MessengerStub) BroadcastOnChannel

func (ms *MessengerStub) BroadcastOnChannel(channel string, topic string, buff []byte)

BroadcastOnChannel -

func (*MessengerStub) Close

func (ms *MessengerStub) Close() error

Close -

func (*MessengerStub) ConnectToPeer

func (ms *MessengerStub) ConnectToPeer(address string) error

ConnectToPeer -

func (*MessengerStub) ConnectedFullHistoryPeersOnTopic

func (ms *MessengerStub) ConnectedFullHistoryPeersOnTopic(topic string) []core.PeerID

ConnectedFullHistoryPeersOnTopic -

func (*MessengerStub) ConnectedPeers

func (ms *MessengerStub) ConnectedPeers() []core.PeerID

ConnectedPeers -

func (*MessengerStub) ConnectedPeersOnTopic

func (ms *MessengerStub) ConnectedPeersOnTopic(topic string) []core.PeerID

ConnectedPeersOnTopic -

func (*MessengerStub) CreateTopic

func (ms *MessengerStub) CreateTopic(name string, createChannelForTopic bool) error

CreateTopic -

func (*MessengerStub) HasTopic

func (ms *MessengerStub) HasTopic(name string) bool

HasTopic -

func (*MessengerStub) HasTopicValidator

func (ms *MessengerStub) HasTopicValidator(name string) bool

HasTopicValidator -

func (*MessengerStub) ID

func (ms *MessengerStub) ID() core.PeerID

ID -

func (*MessengerStub) IsConnected

func (ms *MessengerStub) IsConnected(peerID core.PeerID) bool

IsConnected -

func (*MessengerStub) IsInterfaceNil

func (ms *MessengerStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*MessengerStub) OutgoingChannelLoadBalancer

func (ms *MessengerStub) OutgoingChannelLoadBalancer() p2p.ChannelLoadBalancer

OutgoingChannelLoadBalancer -

func (*MessengerStub) Peers

func (ms *MessengerStub) Peers() []core.PeerID

Peers -

func (*MessengerStub) RegisterMessageProcessor

func (ms *MessengerStub) RegisterMessageProcessor(topic string, identifier string, handler p2p.MessageProcessor) error

RegisterMessageProcessor -

func (*MessengerStub) SendToConnectedPeer

func (ms *MessengerStub) SendToConnectedPeer(topic string, buff []byte, peerID core.PeerID) error

SendToConnectedPeer -

func (*MessengerStub) TrimConnections

func (ms *MessengerStub) TrimConnections()

TrimConnections -

func (*MessengerStub) UnjoinAllTopics

func (ms *MessengerStub) UnjoinAllTopics() error

UnjoinAllTopics -

func (*MessengerStub) UnregisterAllMessageProcessors

func (ms *MessengerStub) UnregisterAllMessageProcessors() error

UnregisterAllMessageProcessors -

func (*MessengerStub) UnregisterMessageProcessor

func (ms *MessengerStub) UnregisterMessageProcessor(topic string, identifier string) error

UnregisterMessageProcessor -

type P2PAntifloodHandlerStub

type P2PAntifloodHandlerStub struct {
	CanProcessMessageCalled         func(message p2p.MessageP2P, fromConnectedPeer core.PeerID) error
	CanProcessMessagesOnTopicCalled func(peer core.PeerID, topic string, numMessages uint32, totalSize uint64, sequence []byte) error
	BlacklistPeerCalled             func(peer core.PeerID, reason string, duration time.Duration)
}

P2PAntifloodHandlerStub -

func (*P2PAntifloodHandlerStub) BlacklistPeer

func (p2pahs *P2PAntifloodHandlerStub) BlacklistPeer(peer core.PeerID, reason string, duration time.Duration)

BlacklistPeer -

func (*P2PAntifloodHandlerStub) CanProcessMessage

func (p2pahs *P2PAntifloodHandlerStub) CanProcessMessage(message p2p.MessageP2P, fromConnectedPeer core.PeerID) error

CanProcessMessage -

func (*P2PAntifloodHandlerStub) CanProcessMessagesOnTopic

func (p2pahs *P2PAntifloodHandlerStub) CanProcessMessagesOnTopic(peer core.PeerID, topic string, numMessages uint32, totalSize uint64, sequence []byte) error

CanProcessMessagesOnTopic -

func (*P2PAntifloodHandlerStub) IsInterfaceNil

func (p2pahs *P2PAntifloodHandlerStub) IsInterfaceNil() bool

IsInterfaceNil -

type P2PMessageMock

type P2PMessageMock struct {
	FromField      []byte
	DataField      []byte
	SeqNoField     []byte
	TopicField     string
	SignatureField []byte
	KeyField       []byte
	PeerField      core.PeerID
	PayloadField   []byte
	TimestampField int64
}

P2PMessageMock -

func (*P2PMessageMock) Data

func (msg *P2PMessageMock) Data() []byte

Data -

func (*P2PMessageMock) From

func (msg *P2PMessageMock) From() []byte

From -

func (*P2PMessageMock) IsInterfaceNil

func (msg *P2PMessageMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*P2PMessageMock) Key

func (msg *P2PMessageMock) Key() []byte

Key -

func (*P2PMessageMock) Payload

func (msg *P2PMessageMock) Payload() []byte

Payload -

func (*P2PMessageMock) Peer

func (msg *P2PMessageMock) Peer() core.PeerID

Peer -

func (*P2PMessageMock) SeqNo

func (msg *P2PMessageMock) SeqNo() []byte

SeqNo -

func (*P2PMessageMock) Signature

func (msg *P2PMessageMock) Signature() []byte

Signature -

func (*P2PMessageMock) Timestamp

func (msg *P2PMessageMock) Timestamp() int64

Timestamp -

func (*P2PMessageMock) Topic

func (msg *P2PMessageMock) Topic() string

Topic -

type PeerAuthenticationResolverStub

type PeerAuthenticationResolverStub struct {
	RequestDataFromHashCalled      func(hash []byte, epoch uint32) error
	ProcessReceivedMessageCalled   func(message p2p.MessageP2P, fromConnectedPeer core.PeerID) error
	SetResolverDebugHandlerCalled  func(handler dataRetriever.ResolverDebugHandler) error
	SetNumPeersToQueryCalled       func(intra int, cross int)
	NumPeersToQueryCalled          func() (int, int)
	CloseCalled                    func() error
	RequestDataFromHashArrayCalled func(hashes [][]byte, epoch uint32) error
}

PeerAuthenticationResolverStub -

func (*PeerAuthenticationResolverStub) Close

func (pars *PeerAuthenticationResolverStub) Close() error

func (*PeerAuthenticationResolverStub) IsInterfaceNil

func (pars *PeerAuthenticationResolverStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*PeerAuthenticationResolverStub) NumPeersToQuery

func (pars *PeerAuthenticationResolverStub) NumPeersToQuery() (int, int)

NumPeersToQuery -

func (*PeerAuthenticationResolverStub) ProcessReceivedMessage

func (pars *PeerAuthenticationResolverStub) ProcessReceivedMessage(message p2p.MessageP2P, fromConnectedPeer core.PeerID) error

ProcessReceivedMessage -

func (*PeerAuthenticationResolverStub) RequestDataFromHash

func (pars *PeerAuthenticationResolverStub) RequestDataFromHash(hash []byte, epoch uint32) error

RequestDataFromHash -

func (*PeerAuthenticationResolverStub) RequestDataFromHashArray

func (pars *PeerAuthenticationResolverStub) RequestDataFromHashArray(hashes [][]byte, epoch uint32) error

RequestDataFromHashArray -

func (*PeerAuthenticationResolverStub) SetNumPeersToQuery

func (pars *PeerAuthenticationResolverStub) SetNumPeersToQuery(intra int, cross int)

SetNumPeersToQuery -

func (*PeerAuthenticationResolverStub) SetResolverDebugHandler

func (pars *PeerAuthenticationResolverStub) SetResolverDebugHandler(handler dataRetriever.ResolverDebugHandler) error

SetResolverDebugHandler -

type PeerListCreatorStub

type PeerListCreatorStub struct {
	CrossShardPeerListCalled func() []core.PeerID
	IntraShardPeerListCalled func() []core.PeerID
	FullHistoryListCalled    func() []core.PeerID
}

PeerListCreatorStub -

func (*PeerListCreatorStub) CrossShardPeerList

func (p *PeerListCreatorStub) CrossShardPeerList() []core.PeerID

CrossShardPeerList -

func (*PeerListCreatorStub) FullHistoryList

func (p *PeerListCreatorStub) FullHistoryList() []core.PeerID

FullHistoryList -

func (*PeerListCreatorStub) IntraShardPeerList

func (p *PeerListCreatorStub) IntraShardPeerList() []core.PeerID

IntraShardPeerList -

func (*PeerListCreatorStub) IsInterfaceNil

func (p *PeerListCreatorStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

type RequestedItemsHandlerStub

type RequestedItemsHandlerStub struct {
	AddCalled   func(key string) error
	HasCalled   func(key string) bool
	SweepCalled func()
}

RequestedItemsHandlerStub -

func (*RequestedItemsHandlerStub) Add

func (rihs *RequestedItemsHandlerStub) Add(key string) error

Add -

func (*RequestedItemsHandlerStub) Has

func (rihs *RequestedItemsHandlerStub) Has(key string) bool

Has -

func (*RequestedItemsHandlerStub) IsInterfaceNil

func (rihs *RequestedItemsHandlerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*RequestedItemsHandlerStub) Sweep

func (rihs *RequestedItemsHandlerStub) Sweep()

Sweep -

type ResolverDebugHandler

type ResolverDebugHandler struct {
	LogRequestedDataCalled          func(topic string, hash [][]byte, numReqIntra int, numReqCross int)
	LogFailedToResolveDataCalled    func(topic string, hash []byte, err error)
	LogSucceededToResolveDataCalled func(topic string, hash []byte)
	EnabledCalled                   func() bool
}

ResolverDebugHandler -

func (*ResolverDebugHandler) IsInterfaceNil

func (rdh *ResolverDebugHandler) IsInterfaceNil() bool

IsInterfaceNil -

func (*ResolverDebugHandler) LogFailedToResolveData

func (rdh *ResolverDebugHandler) LogFailedToResolveData(topic string, hash []byte, err error)

LogFailedToResolveData -

func (*ResolverDebugHandler) LogRequestedData

func (rdh *ResolverDebugHandler) LogRequestedData(topic string, hashes [][]byte, numReqIntra int, numReqCross int)

LogRequestedData -

func (*ResolverDebugHandler) LogSucceededToResolveData

func (rdh *ResolverDebugHandler) LogSucceededToResolveData(topic string, hash []byte)

LogSucceededToResolveData -

type ResolverStub

type ResolverStub struct {
	RequestDataFromHashCalled     func(hash []byte, epoch uint32) error
	ProcessReceivedMessageCalled  func(message p2p.MessageP2P) error
	SetNumPeersToQueryCalled      func(intra int, cross int)
	NumPeersToQueryCalled         func() (int, int)
	SetResolverDebugHandlerCalled func(handler dataRetriever.ResolverDebugHandler) error
	CloseCalled                   func() error
}

ResolverStub -

func (*ResolverStub) Close

func (rs *ResolverStub) Close() error

Close -

func (*ResolverStub) IsInterfaceNil

func (rs *ResolverStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ResolverStub) NumPeersToQuery

func (rs *ResolverStub) NumPeersToQuery() (int, int)

NumPeersToQuery -

func (*ResolverStub) ProcessReceivedMessage

func (rs *ResolverStub) ProcessReceivedMessage(message p2p.MessageP2P, _ core.PeerID) error

ProcessReceivedMessage -

func (*ResolverStub) RequestDataFromHash

func (rs *ResolverStub) RequestDataFromHash(hash []byte, epoch uint32) error

RequestDataFromHash -

func (*ResolverStub) SetNumPeersToQuery

func (rs *ResolverStub) SetNumPeersToQuery(intra int, cross int)

SetNumPeersToQuery -

func (*ResolverStub) SetResolverDebugHandler

func (rs *ResolverStub) SetResolverDebugHandler(handler dataRetriever.ResolverDebugHandler) error

SetResolverDebugHandler -

type ResolversContainerStub

type ResolversContainerStub struct {
	GetCalled          func(key string) (dataRetriever.Resolver, error)
	AddCalled          func(key string, val dataRetriever.Resolver) error
	ReplaceCalled      func(key string, val dataRetriever.Resolver) error
	RemoveCalled       func(key string)
	LenCalled          func() int
	ResolverKeysCalled func() string
	IterateCalled      func(handler func(key string, resolver dataRetriever.Resolver) bool)
	CloseCalled        func() error
}

ResolversContainerStub -

func (*ResolversContainerStub) Add

Add -

func (*ResolversContainerStub) AddMultiple

func (rcs *ResolversContainerStub) AddMultiple(_ []string, _ []dataRetriever.Resolver) error

AddMultiple -

func (*ResolversContainerStub) Close

func (rcs *ResolversContainerStub) Close() error

Close -

func (*ResolversContainerStub) Get

Get -

func (*ResolversContainerStub) IsInterfaceNil

func (rcs *ResolversContainerStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ResolversContainerStub) Iterate

func (rcs *ResolversContainerStub) Iterate(handler func(key string, resolver dataRetriever.Resolver) bool)

Iterate -

func (*ResolversContainerStub) Len

func (rcs *ResolversContainerStub) Len() int

Len -

func (*ResolversContainerStub) Remove

func (rcs *ResolversContainerStub) Remove(key string)

Remove -

func (*ResolversContainerStub) Replace

func (rcs *ResolversContainerStub) Replace(key string, val dataRetriever.Resolver) error

Replace -

func (*ResolversContainerStub) ResolverKeys

func (rcs *ResolversContainerStub) ResolverKeys() string

ResolverKeys -

type ResolversFinderStub

type ResolversFinderStub struct {
	ResolversContainerStub
	IntraShardResolverCalled     func(baseTopic string) (dataRetriever.Resolver, error)
	MetaChainResolverCalled      func(baseTopic string) (dataRetriever.Resolver, error)
	CrossShardResolverCalled     func(baseTopic string, crossShard uint32) (dataRetriever.Resolver, error)
	MetaCrossShardResolverCalled func(baseTopic string, crossShard uint32) (dataRetriever.Resolver, error)
}

ResolversFinderStub -

func (*ResolversFinderStub) CrossShardResolver

func (rfs *ResolversFinderStub) CrossShardResolver(baseTopic string, crossShard uint32) (dataRetriever.Resolver, error)

CrossShardResolver -

func (*ResolversFinderStub) IntraShardResolver

func (rfs *ResolversFinderStub) IntraShardResolver(baseTopic string) (dataRetriever.Resolver, error)

IntraShardResolver -

func (*ResolversFinderStub) MetaChainResolver

func (rfs *ResolversFinderStub) MetaChainResolver(baseTopic string) (dataRetriever.Resolver, error)

MetaChainResolver -

func (*ResolversFinderStub) MetaCrossShardResolver

func (rfs *ResolversFinderStub) MetaCrossShardResolver(baseTopic string, crossShard uint32) (dataRetriever.Resolver, error)

MetaCrossShardResolver -

type ThrottlerStub

type ThrottlerStub struct {
	CanProcessCalled      func() bool
	StartProcessingCalled func()
	EndProcessingCalled   func()
	StartWasCalled        bool
	EndWasCalled          bool
}

ThrottlerStub -

func (*ThrottlerStub) CanProcess

func (ts *ThrottlerStub) CanProcess() bool

CanProcess -

func (*ThrottlerStub) EndProcessing

func (ts *ThrottlerStub) EndProcessing()

EndProcessing -

func (*ThrottlerStub) IsInterfaceNil

func (ts *ThrottlerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*ThrottlerStub) StartProcessing

func (ts *ThrottlerStub) StartProcessing()

StartProcessing -

type TopicHandlerStub

type TopicHandlerStub struct {
	HasTopicCalled                 func(name string) bool
	CreateTopicCalled              func(name string, createChannelForTopic bool) error
	RegisterMessageProcessorCalled func(topic string, identifier string, handler p2p.MessageProcessor) error
}

TopicHandlerStub -

func (*TopicHandlerStub) CreateTopic

func (ths *TopicHandlerStub) CreateTopic(name string, createChannelForTopic bool) error

CreateTopic -

func (*TopicHandlerStub) HasTopic

func (ths *TopicHandlerStub) HasTopic(name string) bool

HasTopic -

func (*TopicHandlerStub) IsInterfaceNil

func (ths *TopicHandlerStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*TopicHandlerStub) RegisterMessageProcessor

func (ths *TopicHandlerStub) RegisterMessageProcessor(topic string, identifier string, handler p2p.MessageProcessor) error

RegisterMessageProcessor -

type TopicResolverSenderStub

type TopicResolverSenderStub struct {
	SendOnRequestTopicCalled func(rd *dataRetriever.RequestData, originalHashes [][]byte) error
	SendCalled               func(buff []byte, peer core.PeerID) error
	TargetShardIDCalled      func() uint32
	SetNumPeersToQueryCalled func(intra int, cross int)
	GetNumPeersToQueryCalled func() (int, int)
	// contains filtered or unexported fields
}

TopicResolverSenderStub -

func (*TopicResolverSenderStub) IsInterfaceNil

func (trss *TopicResolverSenderStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*TopicResolverSenderStub) NumPeersToQuery

func (trss *TopicResolverSenderStub) NumPeersToQuery() (int, int)

NumPeersToQuery -

func (*TopicResolverSenderStub) RequestTopic

func (trss *TopicResolverSenderStub) RequestTopic() string

RequestTopic -

func (*TopicResolverSenderStub) ResolverDebugHandler

func (trss *TopicResolverSenderStub) ResolverDebugHandler() dataRetriever.ResolverDebugHandler

ResolverDebugHandler -

func (*TopicResolverSenderStub) Send

func (trss *TopicResolverSenderStub) Send(buff []byte, peer core.PeerID) error

Send -

func (*TopicResolverSenderStub) SendOnRequestTopic

func (trss *TopicResolverSenderStub) SendOnRequestTopic(rd *dataRetriever.RequestData, originalHashes [][]byte) error

SendOnRequestTopic -

func (*TopicResolverSenderStub) SetNumPeersToQuery

func (trss *TopicResolverSenderStub) SetNumPeersToQuery(intra int, cross int)

SetNumPeersToQuery -

func (*TopicResolverSenderStub) SetResolverDebugHandler

func (trss *TopicResolverSenderStub) SetResolverDebugHandler(handler dataRetriever.ResolverDebugHandler) error

SetResolverDebugHandler -

func (*TopicResolverSenderStub) TargetShardID

func (trss *TopicResolverSenderStub) TargetShardID() uint32

TargetShardID -

type TxForCurrentBlockStub

type TxForCurrentBlockStub struct {
	CleanCalled func()
	GetTxCalled func(txHash []byte) (data.TransactionHandler, error)
	AddTxCalled func(txHash []byte, tx data.TransactionHandler)
}

TxForCurrentBlockStub -

func (*TxForCurrentBlockStub) AddTx

func (t *TxForCurrentBlockStub) AddTx(txHash []byte, tx data.TransactionHandler)

AddTx -

func (*TxForCurrentBlockStub) Clean

func (t *TxForCurrentBlockStub) Clean()

Clean -

func (*TxForCurrentBlockStub) GetTx

func (t *TxForCurrentBlockStub) GetTx(txHash []byte) (data.TransactionHandler, error)

GetTx -

func (*TxForCurrentBlockStub) IsInterfaceNil

func (t *TxForCurrentBlockStub) IsInterfaceNil() bool

IsInterfaceNil -

type Uint64ByteSliceConverterMock

type Uint64ByteSliceConverterMock struct {
	ToByteSliceCalled func(uint64) []byte
	ToUint64Called    func([]byte) (uint64, error)
}

Uint64ByteSliceConverterMock converts byte slice to/from uint64

func (*Uint64ByteSliceConverterMock) IsInterfaceNil

func (u *Uint64ByteSliceConverterMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*Uint64ByteSliceConverterMock) ToByteSlice

func (u *Uint64ByteSliceConverterMock) ToByteSlice(p uint64) []byte

ToByteSlice is a mock implementation for Uint64ByteSliceConverter

func (*Uint64ByteSliceConverterMock) ToUint64

func (u *Uint64ByteSliceConverterMock) ToUint64(p []byte) (uint64, error)

ToUint64 is a mock implementation for Uint64ByteSliceConverter

type WhiteListHandlerStub

type WhiteListHandlerStub struct {
	RemoveCalled func(keys [][]byte)
	AddCalled    func(keys [][]byte)
}

WhiteListHandlerStub -

func (*WhiteListHandlerStub) Add

func (w *WhiteListHandlerStub) Add(keys [][]byte)

Add -

func (*WhiteListHandlerStub) IsInterfaceNil

func (w *WhiteListHandlerStub) IsInterfaceNil() bool

IsInterfaceNil -

func (*WhiteListHandlerStub) Remove

func (w *WhiteListHandlerStub) Remove(keys [][]byte)

Remove -

Jump to

Keyboard shortcuts

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