mocks

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2025 License: AGPL-3.0 Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockCatchpointCatchupAccessor

type MockCatchpointCatchupAccessor struct{}

MockCatchpointCatchupAccessor is a dummy CatchpointCatchupAccessor implementation which doesn't do anything.

func (*MockCatchpointCatchupAccessor) BuildMerkleTrie

func (m *MockCatchpointCatchupAccessor) BuildMerkleTrie(ctx context.Context, progressUpdates func(uint64, uint64)) (err error)

BuildMerkleTrie inserts the account hashes into the merkle trie

func (*MockCatchpointCatchupAccessor) CompleteCatchup

func (m *MockCatchpointCatchupAccessor) CompleteCatchup(ctx context.Context) (err error)

CompleteCatchup completes the catchpoint catchup process by switching the databases tables around and reloading the ledger.

func (*MockCatchpointCatchupAccessor) EnsureFirstBlock

func (m *MockCatchpointCatchupAccessor) EnsureFirstBlock(ctx context.Context) (blk bookkeeping.Block, err error)

EnsureFirstBlock ensure that we have a single block in the staging block table, and returns that block

func (*MockCatchpointCatchupAccessor) FinishBlocks

func (m *MockCatchpointCatchupAccessor) FinishBlocks(ctx context.Context, applyChanges bool) (err error)

FinishBlocks concludes the catchup of the blocks database.

func (*MockCatchpointCatchupAccessor) GetCatchupBlockRound

func (m *MockCatchpointCatchupAccessor) GetCatchupBlockRound(ctx context.Context) (round basics.Round, err error)

GetCatchupBlockRound returns the latest block round matching the current catchpoint

func (*MockCatchpointCatchupAccessor) GetLabel

func (m *MockCatchpointCatchupAccessor) GetLabel(ctx context.Context) (label string, err error)

GetLabel returns the current catchpoint catchup label

func (*MockCatchpointCatchupAccessor) GetState

GetState returns the current state of the catchpoint catchup

func (*MockCatchpointCatchupAccessor) GetVerifyData

func (m *MockCatchpointCatchupAccessor) GetVerifyData(ctx context.Context) (balancesHash, spverHash, onlineAccountsHash, onlineRoundParams crypto.Digest, totals ledgercore.AccountTotals, err error)

GetVerifyData returns the balances hash, spver hash and totals used by VerifyCatchpoint

func (*MockCatchpointCatchupAccessor) Ledger

Ledger returns ledger instance as CatchupAccessorClientLedger interface

func (*MockCatchpointCatchupAccessor) ProcessStagingBalances

func (m *MockCatchpointCatchupAccessor) ProcessStagingBalances(ctx context.Context, sectionName string, bytes []byte, progress *ledger.CatchpointCatchupAccessorProgress) (err error)

ProcessStagingBalances deserialize the given bytes as a temporary staging balances

func (*MockCatchpointCatchupAccessor) ResetStagingBalances

func (m *MockCatchpointCatchupAccessor) ResetStagingBalances(ctx context.Context, newCatchup bool) (err error)

ResetStagingBalances resets the current staging balances, preparing for a new set of balances to be added

func (*MockCatchpointCatchupAccessor) SetLabel

func (m *MockCatchpointCatchupAccessor) SetLabel(ctx context.Context, label string) (err error)

SetLabel set the catchpoint catchup label

func (*MockCatchpointCatchupAccessor) SetState

SetState set the state of the catchpoint catchup

func (*MockCatchpointCatchupAccessor) StoreBalancesRound

func (m *MockCatchpointCatchupAccessor) StoreBalancesRound(ctx context.Context, blk *bookkeeping.Block) (err error)

StoreBalancesRound calculates the balances round based on the first block and the associated consensus parametets, and store that to the database

func (*MockCatchpointCatchupAccessor) StoreBlock

StoreBlock stores a single block to the blocks database.

func (*MockCatchpointCatchupAccessor) StoreFirstBlock

func (m *MockCatchpointCatchupAccessor) StoreFirstBlock(ctx context.Context, blk *bookkeeping.Block, cert *agreement.Certificate) (err error)

StoreFirstBlock stores a single block to the blocks database.

func (*MockCatchpointCatchupAccessor) VerifyCatchpoint

func (m *MockCatchpointCatchupAccessor) VerifyCatchpoint(ctx context.Context, blk *bookkeeping.Block) (err error)

VerifyCatchpoint verifies that the catchpoint is valid by reconstructing the label.

type MockNetwork

type MockNetwork struct {
	network.GossipNode
	GenesisID string
}

MockNetwork is a dummy network that doesn't do anything

func (*MockNetwork) Address

func (network *MockNetwork) Address() (string, bool)

Address - unused function

func (*MockNetwork) Broadcast

func (network *MockNetwork) Broadcast(ctx context.Context, tag protocol.Tag, data []byte, wait bool, except network.Peer) error

Broadcast - unused function

func (*MockNetwork) ClearHandlers

func (network *MockNetwork) ClearHandlers()

ClearHandlers - empty implementation

func (*MockNetwork) ClearProcessors

func (network *MockNetwork) ClearProcessors()

ClearProcessors - empty implementation

func (*MockNetwork) Disconnect

func (network *MockNetwork) Disconnect(badpeer network.DisconnectablePeer)

Disconnect - unused function

func (*MockNetwork) DisconnectPeers

func (network *MockNetwork) DisconnectPeers()

DisconnectPeers - unused function

func (*MockNetwork) GetGenesisID

func (network *MockNetwork) GetGenesisID() string

GetGenesisID - empty implementation

func (*MockNetwork) GetHTTPClient

func (network *MockNetwork) GetHTTPClient(address string) (*http.Client, error)

GetHTTPClient returns a http.Client with a suitable for the network

func (*MockNetwork) GetPeers

func (network *MockNetwork) GetPeers(options ...network.PeerOption) []network.Peer

GetPeers - unused function

func (*MockNetwork) OnNetworkAdvance

func (network *MockNetwork) OnNetworkAdvance()

OnNetworkAdvance - empty implementation

func (*MockNetwork) Ready

func (network *MockNetwork) Ready() chan struct{}

Ready - always ready

func (*MockNetwork) RegisterHTTPHandler

func (network *MockNetwork) RegisterHTTPHandler(path string, handler http.Handler)

RegisterHTTPHandler - empty implementation

func (*MockNetwork) RegisterHTTPHandlerFunc

func (network *MockNetwork) RegisterHTTPHandlerFunc(path string, handler func(http.ResponseWriter, *http.Request))

RegisterHTTPHandlerFunc - empty implementation

func (*MockNetwork) RegisterHandlers

func (network *MockNetwork) RegisterHandlers(dispatch []network.TaggedMessageHandler)

RegisterHandlers - empty implementation.

func (*MockNetwork) RegisterRPCName

func (network *MockNetwork) RegisterRPCName(name string, rcvr interface{})

RegisterRPCName - unused function

func (*MockNetwork) RegisterValidatorHandlers

func (network *MockNetwork) RegisterValidatorHandlers(dispatch []network.TaggedMessageValidatorHandler)

RegisterValidatorHandlers - empty implementation.

func (*MockNetwork) Relay

func (network *MockNetwork) Relay(ctx context.Context, tag protocol.Tag, data []byte, wait bool, except network.Peer) error

Relay - unused function

func (*MockNetwork) RequestConnectOutgoing

func (network *MockNetwork) RequestConnectOutgoing(replace bool, quit <-chan struct{})

RequestConnectOutgoing - unused function

func (*MockNetwork) Start

func (network *MockNetwork) Start() error

Start - unused function

func (*MockNetwork) Stop

func (network *MockNetwork) Stop()

Stop - unused function

type MockParticipationRegistry

type MockParticipationRegistry struct {
}

MockParticipationRegistry is a dummy ParticipationRegistry that doesn't do anything

func (*MockParticipationRegistry) AppendKeys

AppendKeys appends state proof keys to an existing Participation record. Keys can only be appended once, an error will occur when the data is flushed when inserting a duplicate key.

func (*MockParticipationRegistry) Close

func (m *MockParticipationRegistry) Close()

Close any resources used to implement the interface.

func (*MockParticipationRegistry) Delete

Delete removes a record from storage.

func (*MockParticipationRegistry) DeleteExpired

func (m *MockParticipationRegistry) DeleteExpired(latestRound basics.Round, agreementProto config.ConsensusParams) error

DeleteExpired removes all records from storage which are expired on the given round.

func (*MockParticipationRegistry) DeleteStateProofKeys

func (m *MockParticipationRegistry) DeleteStateProofKeys(id account.ParticipationID, round basics.Round) error

DeleteStateProofKeys removes all stateproof keys preceding a given round (including)

func (*MockParticipationRegistry) Flush

func (m *MockParticipationRegistry) Flush(timeout time.Duration) error

Flush ensures that all changes have been written to the underlying data store.

func (*MockParticipationRegistry) Get

Get a participation record.

func (*MockParticipationRegistry) GetAll

GetAll of the participation records.

func (*MockParticipationRegistry) GetForRound

GetForRound fetches a record with voting secrets for a particular round.

func (*MockParticipationRegistry) GetStateProofSecretsForRound

GetStateProofSecretsForRound fetches a record with stateproof secrets for a particular round.

func (*MockParticipationRegistry) HasLiveKeys

func (m *MockParticipationRegistry) HasLiveKeys(from, to basics.Round) bool

HasLiveKeys quickly tests to see if there is a valid participation key over some range of rounds

func (*MockParticipationRegistry) Insert

Insert adds a record to storage and computes the ParticipationID

func (*MockParticipationRegistry) Record

func (m *MockParticipationRegistry) Record(account basics.Address, round basics.Round, participationType account.ParticipationAction) error

Record sets the Last* field for the active ParticipationID for the given account.

func (*MockParticipationRegistry) Register

Register updates the EffectiveFirst and EffectiveLast fields. If there are multiple records for the account then it is possible for multiple records to be updated.

Jump to

Keyboard shortcuts

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