mock

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2019 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacherStub

type CacherStub struct {
	ClearCalled           func()
	PutCalled             func(key []byte, value interface{}) (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{}) (ok, evicted bool)
	RemoveCalled          func(key []byte)
	RemoveOldestCalled    func()
	KeysCalled            func() [][]byte
	LenCalled             func() int
	RegisterHandlerCalled func(func(key []byte))
}

func (*CacherStub) Clear

func (cs *CacherStub) Clear()

func (*CacherStub) Get

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

func (*CacherStub) Has

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

func (*CacherStub) HasOrAdd

func (cs *CacherStub) HasOrAdd(key []byte, value interface{}) (ok, evicted bool)

func (*CacherStub) Keys

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

func (*CacherStub) Len

func (cs *CacherStub) Len() int

func (*CacherStub) Peek

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

func (*CacherStub) Put

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

func (*CacherStub) RegisterHandler

func (cs *CacherStub) RegisterHandler(handler func(key []byte))

func (*CacherStub) Remove

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

func (*CacherStub) RemoveOldest

func (cs *CacherStub) RemoveOldest()

type Facade

type Facade struct {
	Running                                        bool
	ShouldErrorStart                               bool
	ShouldErrorStop                                bool
	GetCurrentPublicKeyHandler                     func() string
	TpsBenchmarkHandler                            func() *statistics.TpsBenchmark
	GetHeartbeatsHandler                           func() ([]heartbeat.PubKeyHeartbeat, error)
	BalanceHandler                                 func(string) (*big.Int, error)
	GetAccountHandler                              func(address string) (*state.Account, error)
	GenerateTransactionHandler                     func(sender string, receiver string, value *big.Int, code string) (*transaction.Transaction, error)
	GetTransactionHandler                          func(hash string) (*transaction.Transaction, error)
	SendTransactionHandler                         func(nonce uint64, sender string, receiver string, value *big.Int, gasPrice uint64, gasLimit uint64, code string, signature []byte) (string, error)
	GenerateAndSendBulkTransactionsHandler         func(destination string, value *big.Int, nrTransactions uint64) error
	GenerateAndSendBulkTransactionsOneByOneHandler func(destination string, value *big.Int, nrTransactions uint64) error
	RecentNotarizedBlocksHandler                   func(maxShardHeadersNum int) ([]*external.BlockHeader, error)
	RetrieveShardBlockHandler                      func(blockHash []byte) (*external.ShardBlockInfo, error)
}

Facade is the mock implementation of a node router handler

func (*Facade) GenerateAndSendBulkTransactions added in v1.0.3

func (f *Facade) GenerateAndSendBulkTransactions(destination string, value *big.Int, nrTransactions uint64) error

GenerateAndSendBulkTransactions is the mock implementation of a handler's GenerateAndSendBulkTransactions method

func (*Facade) GenerateAndSendBulkTransactionsOneByOne added in v1.0.3

func (f *Facade) GenerateAndSendBulkTransactionsOneByOne(destination string, value *big.Int, nrTransactions uint64) error

GenerateAndSendBulkTransactionsOneByOne is the mock implementation of a handler's GenerateAndSendBulkTransactionsOneByOne method

func (*Facade) GenerateTransaction

func (f *Facade) GenerateTransaction(sender string, receiver string, value *big.Int,
	code string) (*transaction.Transaction, error)

GenerateTransaction is the mock implementation of a handler's GenerateTransaction method

func (*Facade) GetAccount

func (f *Facade) GetAccount(address string) (*state.Account, error)

GetAccount is the mock implementation of a handler's GetAccount method

func (*Facade) GetBalance

func (f *Facade) GetBalance(address string) (*big.Int, error)

GetBalance is the mock implementation of a handler's GetBalance method

func (*Facade) GetCurrentPublicKey added in v1.0.3

func (f *Facade) GetCurrentPublicKey() string

GetCurrentPublicKey is the mock implementation of a handler's StopNode method

func (*Facade) GetHeartbeats

func (f *Facade) GetHeartbeats() ([]heartbeat.PubKeyHeartbeat, error)

func (*Facade) GetTransaction

func (f *Facade) GetTransaction(hash string) (*transaction.Transaction, error)

GetTransaction is the mock implementation of a handler's GetTransaction method

func (*Facade) IsNodeRunning

func (f *Facade) IsNodeRunning() bool

IsNodeRunning is the mock implementation of a handler's IsNodeRunning method

func (*Facade) RecentNotarizedBlocks added in v1.0.3

func (f *Facade) RecentNotarizedBlocks(maxShardHeadersNum int) ([]*external.BlockHeader, error)

func (*Facade) RetrieveShardBlock added in v1.0.3

func (f *Facade) RetrieveShardBlock(blockHash []byte) (*external.ShardBlockInfo, error)

func (*Facade) SendTransaction added in v1.0.3

func (f *Facade) SendTransaction(nonce uint64, sender string, receiver string, value *big.Int, gasPrice uint64, gasLimit uint64, code string, signature []byte) (string, error)

SendTransaction is the mock implementation of a handler's SendTransaction method

func (*Facade) StartNode

func (f *Facade) StartNode() error

StartNode is the mock implementation of a handler's StartNode method

func (*Facade) StopNode

func (f *Facade) StopNode() error

StopNode is the mock implementation of a handler's StopNode method

func (*Facade) TpsBenchmark

func (f *Facade) TpsBenchmark() *statistics.TpsBenchmark

TpsBenchmark is the mock implementation for retreiving the TpsBenchmark

type WrongFacade

type WrongFacade struct {
}

WrongFacade is a struct that can be used as a wrong implementation of the node router handler

Jump to

Keyboard shortcuts

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