testscommon

package
v1.0.143 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePoolsHolder

func CreatePoolsHolder(numShards uint32, selfShard uint32) dataRetriever.PoolsHolder

CreatePoolsHolder -

func CreatePoolsHolderWithTxPool

func CreatePoolsHolderWithTxPool(txPool dataRetriever.ShardedDataCacherNotifier) dataRetriever.PoolsHolder

CreatePoolsHolderWithTxPool -

func CreateTxPool

func CreateTxPool(numShards uint32, selfShard uint32) (dataRetriever.ShardedDataCacherNotifier, error)

CreateTxPool -

func GetGeneralConfig

func GetGeneralConfig() config.Config

Types

type CacherMock

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

CacherMock -

func NewCacherMock

func NewCacherMock() *CacherMock

NewCacherMock -

func (*CacherMock) Clear

func (cacher *CacherMock) Clear()

Clear -

func (*CacherMock) Get

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

Get -

func (*CacherMock) Has

func (cacher *CacherMock) Has(key []byte) bool

Has -

func (*CacherMock) HasOrAdd

func (cacher *CacherMock) HasOrAdd(key []byte, value interface{}, _ int) (has, added bool)

HasOrAdd -

func (*CacherMock) IsInterfaceNil

func (cacher *CacherMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*CacherMock) Keys

func (cacher *CacherMock) Keys() [][]byte

Keys -

func (*CacherMock) Len

func (cacher *CacherMock) Len() int

Len -

func (*CacherMock) MaxSize

func (cacher *CacherMock) MaxSize() int

MaxSize -

func (*CacherMock) Peek

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

Peek -

func (*CacherMock) Put

func (cacher *CacherMock) Put(key []byte, value interface{}, _ int) (evicted bool)

Put -

func (*CacherMock) RegisterHandler

func (cacher *CacherMock) RegisterHandler(handler func(key []byte, value interface{}), _ string)

RegisterHandler -

func (*CacherMock) Remove

func (cacher *CacherMock) Remove(key []byte)

Remove -

func (*CacherMock) UnRegisterHandler

func (cacher *CacherMock) UnRegisterHandler(string)

UnRegisterHandler -

type CacherStub

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

CacherStub -

func NewCacherStub

func NewCacherStub() *CacherStub

NewCacherStub -

func (*CacherStub) Clear

func (cacher *CacherStub) Clear()

Clear -

func (*CacherStub) Get

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

Get -

func (*CacherStub) Has

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

Has -

func (*CacherStub) HasOrAdd

func (cacher *CacherStub) HasOrAdd(key []byte, value interface{}, sizeInBytes int) (has, added bool)

HasOrAdd -

func (*CacherStub) IsInterfaceNil

func (cacher *CacherStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*CacherStub) Keys

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

Keys -

func (*CacherStub) Len

func (cacher *CacherStub) Len() int

Len -

func (*CacherStub) MaxSize

func (cacher *CacherStub) MaxSize() int

MaxSize -

func (*CacherStub) Peek

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

Peek -

func (*CacherStub) Put

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

Put -

func (*CacherStub) RegisterHandler

func (cacher *CacherStub) RegisterHandler(handler func(key []byte, value interface{}), _ string)

RegisterHandler -

func (*CacherStub) Remove

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

Remove -

func (*CacherStub) UnRegisterHandler

func (cacher *CacherStub) UnRegisterHandler(id string)

UnRegisterHandler -

type PeerHonestyHandlerStub

type PeerHonestyHandlerStub struct {
	ChangeScoreCalled func(pk string, topic string, units int)
}

PeerHonestyHandlerStub -

func (*PeerHonestyHandlerStub) ChangeScore

func (phhs *PeerHonestyHandlerStub) ChangeScore(pk string, topic string, units int)

ChangeScore -

func (*PeerHonestyHandlerStub) IsInterfaceNil

func (phhs *PeerHonestyHandlerStub) IsInterfaceNil() bool

IsInterfaceNil -

type PoolsHolderMock

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

PoolsHolderMock -

func NewPoolsHolderMock

func NewPoolsHolderMock() *PoolsHolderMock

NewPoolsHolderMock -

func (*PoolsHolderMock) CurrentBlockTxs

func (holder *PoolsHolderMock) CurrentBlockTxs() dataRetriever.TransactionCacher

CurrentBlockTxs -

func (*PoolsHolderMock) Headers

func (holder *PoolsHolderMock) Headers() dataRetriever.HeadersPool

Headers -

func (*PoolsHolderMock) IsInterfaceNil

func (holder *PoolsHolderMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*PoolsHolderMock) MiniBlocks

func (holder *PoolsHolderMock) MiniBlocks() storage.Cacher

MiniBlocks -

func (*PoolsHolderMock) PeerChangesBlocks

func (holder *PoolsHolderMock) PeerChangesBlocks() storage.Cacher

PeerChangesBlocks -

func (*PoolsHolderMock) RewardTransactions

func (holder *PoolsHolderMock) RewardTransactions() dataRetriever.ShardedDataCacherNotifier

RewardTransactions -

func (*PoolsHolderMock) SetTransactions

func (holder *PoolsHolderMock) SetTransactions(pool dataRetriever.ShardedDataCacherNotifier)

SetTransactions -

func (*PoolsHolderMock) SetUnsignedTransactions

func (holder *PoolsHolderMock) SetUnsignedTransactions(pool dataRetriever.ShardedDataCacherNotifier)

SetUnsignedTransactions -

func (*PoolsHolderMock) Transactions

Transactions -

func (*PoolsHolderMock) TrieNodes

func (holder *PoolsHolderMock) TrieNodes() storage.Cacher

TrieNodes -

func (*PoolsHolderMock) UnsignedTransactions

func (holder *PoolsHolderMock) UnsignedTransactions() dataRetriever.ShardedDataCacherNotifier

UnsignedTransactions -

type PoolsHolderStub

type PoolsHolderStub struct {
	HeadersCalled              func() dataRetriever.HeadersPool
	TransactionsCalled         func() dataRetriever.ShardedDataCacherNotifier
	UnsignedTransactionsCalled func() dataRetriever.ShardedDataCacherNotifier
	RewardTransactionsCalled   func() dataRetriever.ShardedDataCacherNotifier
	MiniBlocksCalled           func() storage.Cacher
	MetaBlocksCalled           func() storage.Cacher
	CurrBlockTxsCalled         func() dataRetriever.TransactionCacher
	TrieNodesCalled            func() storage.Cacher
	PeerChangesBlocksCalled    func() storage.Cacher
}

PoolsHolderStub -

func NewPoolsHolderStub

func NewPoolsHolderStub() *PoolsHolderStub

NewPoolsHolderStub -

func (*PoolsHolderStub) CurrentBlockTxs

func (holder *PoolsHolderStub) CurrentBlockTxs() dataRetriever.TransactionCacher

CurrentBlockTxs -

func (*PoolsHolderStub) Headers

func (holder *PoolsHolderStub) Headers() dataRetriever.HeadersPool

Headers -

func (*PoolsHolderStub) IsInterfaceNil

func (holder *PoolsHolderStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*PoolsHolderStub) MetaBlocks

func (holder *PoolsHolderStub) MetaBlocks() storage.Cacher

MetaBlocks -

func (*PoolsHolderStub) MiniBlocks

func (holder *PoolsHolderStub) MiniBlocks() storage.Cacher

MiniBlocks -

func (*PoolsHolderStub) PeerChangesBlocks

func (holder *PoolsHolderStub) PeerChangesBlocks() storage.Cacher

PeerChangesBlocks -

func (*PoolsHolderStub) RewardTransactions

func (holder *PoolsHolderStub) RewardTransactions() dataRetriever.ShardedDataCacherNotifier

RewardTransactions -

func (*PoolsHolderStub) Transactions

Transactions -

func (*PoolsHolderStub) TrieNodes

func (holder *PoolsHolderStub) TrieNodes() storage.Cacher

TrieNodes -

func (*PoolsHolderStub) UnsignedTransactions

func (holder *PoolsHolderStub) UnsignedTransactions() dataRetriever.ShardedDataCacherNotifier

UnsignedTransactions -

type ProtoMarshalizerMock

type ProtoMarshalizerMock struct {
}

ProtoMarshalizerMock implements marshaling with protobuf

func (*ProtoMarshalizerMock) IsInterfaceNil

func (pmm *ProtoMarshalizerMock) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ProtoMarshalizerMock) Marshal

func (pmm *ProtoMarshalizerMock) Marshal(obj interface{}) ([]byte, error)

Marshal does the actual serialization of an object The object to be serialized must implement the gogoProtoObj interface

func (*ProtoMarshalizerMock) Unmarshal

func (pmm *ProtoMarshalizerMock) Unmarshal(obj interface{}, buff []byte) error

Unmarshal does the actual deserialization of an object The object to be deserialized must implement the gogoProtoObj interface

type ShardedDataStub

type ShardedDataStub struct {
	RegisterOnAddedCalled                  func(func(key []byte, value interface{}))
	ShardDataStoreCalled                   func(cacheID string) storage.Cacher
	AddDataCalled                          func(key []byte, data interface{}, sizeInBytes int, cacheID string)
	SearchFirstDataCalled                  func(key []byte) (value interface{}, ok bool)
	RemoveDataCalled                       func(key []byte, cacheID string)
	RemoveDataFromAllShardsCalled          func(key []byte)
	MergeShardStoresCalled                 func(sourceCacheID, destCacheID string)
	MoveDataCalled                         func(sourceCacheID, destCacheID string, key [][]byte)
	ClearCalled                            func()
	ClearShardStoreCalled                  func(cacheID string)
	RemoveSetOfDataFromPoolCalled          func(keys [][]byte, destCacheID string)
	ImmunizeSetOfDataAgainstEvictionCalled func(keys [][]byte, cacheID string)
	CreateShardStoreCalled                 func(destCacheID string)
	GetCountsCalled                        func() counting.CountsWithSize
}

ShardedDataStub -

func NewShardedDataStub

func NewShardedDataStub() *ShardedDataStub

NewShardedDataStub -

func (*ShardedDataStub) AddData

func (shardedData *ShardedDataStub) AddData(key []byte, data interface{}, sizeInBytes int, cacheID string)

AddData -

func (*ShardedDataStub) Clear

func (shardedData *ShardedDataStub) Clear()

Clear -

func (*ShardedDataStub) ClearShardStore

func (shardedData *ShardedDataStub) ClearShardStore(cacheID string)

ClearShardStore -

func (*ShardedDataStub) GetCounts

func (sd *ShardedDataStub) GetCounts() counting.CountsWithSize

GetCounts -

func (*ShardedDataStub) ImmunizeSetOfDataAgainstEviction

func (shardedData *ShardedDataStub) ImmunizeSetOfDataAgainstEviction(keys [][]byte, cacheID string)

ImmunizeSetOfDataAgainstEviction -

func (*ShardedDataStub) IsInterfaceNil

func (shardedData *ShardedDataStub) IsInterfaceNil() bool

IsInterfaceNil returns true if there is no value under the interface

func (*ShardedDataStub) MergeShardStores

func (shardedData *ShardedDataStub) MergeShardStores(sourceCacheID, destCacheID string)

MergeShardStores -

func (*ShardedDataStub) RegisterOnAdded added in v1.0.137

func (shardedData *ShardedDataStub) RegisterOnAdded(handler func(key []byte, value interface{}))

RegisterOnAdded -

func (*ShardedDataStub) RemoveData

func (shardedData *ShardedDataStub) RemoveData(key []byte, cacheID string)

RemoveData -

func (*ShardedDataStub) RemoveDataFromAllShards

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

RemoveDataFromAllShards -

func (*ShardedDataStub) RemoveSetOfDataFromPool

func (shardedData *ShardedDataStub) RemoveSetOfDataFromPool(keys [][]byte, cacheID string)

RemoveSetOfDataFromPool -

func (*ShardedDataStub) SearchFirstData

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

SearchFirstData -

func (*ShardedDataStub) ShardDataStore

func (shardedData *ShardedDataStub) ShardDataStore(cacheID string) storage.Cacher

ShardDataStore -

Jump to

Keyboard shortcuts

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