state_fsm

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2020 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package state_fsm is a generated GoMock package.

Index

Constants

This section is empty.

Variables

View Source
var TimeoutErr = errors.New("timeout")

Functions

func HaltTransition

func HaltTransition(info BaseInfo) (FSM, Async, error)

func IsOutdate

func IsOutdate(period proto.Timestamp, lastBlock *proto.Block, tm types.Time) bool

func MinedBlockNgTransition

func MinedBlockNgTransition(info BaseInfo, block *proto.Block, limits proto.MiningLimits, keyPair proto.KeyPair, vrf []byte) (FSM, Async, error)

func NewFsm

func NewFsm(
	services services.Services,
	outdatePeriod proto.Timestamp,
) (FSM, Async, error)

func NewIdleToSyncTransition

func NewIdleToSyncTransition(baseInfo BaseInfo, p Peer) (FSM, Async, error)

func NewPersistTransition

func NewPersistTransition(info BaseInfo) (FSM, Async, error)

func NewSyncFsm

func NewSyncFsm(baseInfo BaseInfo, conf2 conf, internal sync_internal.Internal) (FSM, Async, error)

Types

type Actions

type Actions interface {
	SendScore(currentScorer)
	SendBlock(block *proto.Block)
}

type ActionsImpl

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

func (*ActionsImpl) SendBlock

func (a *ActionsImpl) SendBlock(block *proto.Block)

func (*ActionsImpl) SendScore

func (a *ActionsImpl) SendScore(s currentScorer)

type Async

type Async []Task

type BaseInfo

type BaseInfo struct {

	// scheduler
	types.Scheduler

	MicroBlockCache    services.MicroBlockCache
	MicroBlockInvCache services.MicroBlockInvCache
	// contains filtered or unexported fields
}

func (*BaseInfo) BroadcastTransaction

func (a *BaseInfo) BroadcastTransaction(t proto.Transaction, receivedFrom peer.Peer)

func (*BaseInfo) CleanUtx

func (a *BaseInfo) CleanUtx()

type BlocksApplier

type BlocksApplier interface {
	Apply(state storage.State, block []*proto.Block) error
}

type Default

type Default interface {
	Noop(FSM) (FSM, Async, error)
	PeerError(fsm FSM, p Peer, baseInfo BaseInfo, _ error) (FSM, Async, error)
	NewPeer(fsm FSM, p Peer, info BaseInfo) (FSM, Async, error)
}

type DefaultImpl

type DefaultImpl struct {
}

func (DefaultImpl) NewPeer

func (a DefaultImpl) NewPeer(fsm FSM, p Peer, info BaseInfo) (FSM, Async, error)

func (DefaultImpl) Noop

func (a DefaultImpl) Noop(f FSM) (FSM, Async, error)

func (DefaultImpl) PeerError

func (a DefaultImpl) PeerError(fsm FSM, p Peer, baseInfo BaseInfo, _ error) (FSM, Async, error)

type FSM

type FSM interface {
	NewPeer(p peer.Peer) (FSM, Async, error)
	PeerError(p peer.Peer, e error) (FSM, Async, error)
	Score(p peer.Peer, score *proto.Score) (FSM, Async, error)
	Block(p peer.Peer, block *proto.Block) (FSM, Async, error)
	MinedBlock(block *proto.Block, limits proto.MiningLimits, keyPair proto.KeyPair, vrf []byte) (FSM, Async, error)

	// Received signatures after asking by GetSignatures
	BlockIDs(peer.Peer, []proto.BlockID) (FSM, Async, error)
	Task(task AsyncTask) (FSM, Async, error)

	// micro
	MicroBlock(p peer.Peer, micro *proto.MicroBlock) (FSM, Async, error)
	MicroBlockInv(p peer.Peer, inv *proto.MicroBlockInv) (FSM, Async, error)

	Transaction(p peer.Peer, t proto.Transaction) (FSM, Async, error)

	//
	Halt() (FSM, Async, error)
}

type FromBaseInfo

type FromBaseInfo interface {
	FromBaseInfo(b BaseInfo) FSM
}

type HaltFSM

type HaltFSM struct {
}

func (HaltFSM) Block

func (a HaltFSM) Block(peer peer.Peer, block *proto.Block) (FSM, Async, error)

func (HaltFSM) BlockIDs

func (a HaltFSM) BlockIDs(peer peer.Peer, sigs []proto.BlockID) (FSM, Async, error)

func (HaltFSM) Halt

func (a HaltFSM) Halt() (FSM, Async, error)

func (HaltFSM) MicroBlock

func (a HaltFSM) MicroBlock(p peer.Peer, micro *proto.MicroBlock) (FSM, Async, error)

func (HaltFSM) MicroBlockInv

func (a HaltFSM) MicroBlockInv(p peer.Peer, inv *proto.MicroBlockInv) (FSM, Async, error)

func (HaltFSM) MinedBlock

func (a HaltFSM) MinedBlock(block *proto.Block, limits proto.MiningLimits, keyPair proto.KeyPair, vrf []byte) (FSM, Async, error)

func (HaltFSM) NewPeer

func (a HaltFSM) NewPeer(p peer.Peer) (FSM, Async, error)

func (HaltFSM) PeerError

func (a HaltFSM) PeerError(peer.Peer, error) (FSM, Async, error)

func (HaltFSM) Score

func (a HaltFSM) Score(p peer.Peer, score *proto.Score) (FSM, Async, error)

func (HaltFSM) Task

func (a HaltFSM) Task(task tasks.AsyncTask) (FSM, Async, error)

func (HaltFSM) Transaction

func (a HaltFSM) Transaction(p peer.Peer, t proto.Transaction) (FSM, Async, error)

type IdleFsm

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

func NewIdleFsm

func NewIdleFsm(info BaseInfo) *IdleFsm

func (*IdleFsm) Block

func (a *IdleFsm) Block(peer peer.Peer, block *proto.Block) (FSM, Async, error)

func (*IdleFsm) BlockIDs

func (a *IdleFsm) BlockIDs(_ peer.Peer, _ []proto.BlockID) (FSM, Async, error)

func (*IdleFsm) Halt

func (a *IdleFsm) Halt() (FSM, Async, error)

func (*IdleFsm) MicroBlock

func (a *IdleFsm) MicroBlock(p peer.Peer, micro *proto.MicroBlock) (FSM, Async, error)

func (*IdleFsm) MicroBlockInv

func (a *IdleFsm) MicroBlockInv(p peer.Peer, inv *proto.MicroBlockInv) (FSM, Async, error)

func (*IdleFsm) MinedBlock

func (a *IdleFsm) MinedBlock(block *proto.Block, limits proto.MiningLimits, keyPair proto.KeyPair, vrf []byte) (FSM, Async, error)

func (*IdleFsm) NewPeer

func (a *IdleFsm) NewPeer(p peer.Peer) (FSM, Async, error)

func (*IdleFsm) PeerError

func (a *IdleFsm) PeerError(p peer.Peer, e error) (FSM, Async, error)

func (*IdleFsm) Score

func (a *IdleFsm) Score(p peer.Peer, score *proto.Score) (FSM, Async, error)

func (*IdleFsm) Task

func (a *IdleFsm) Task(task AsyncTask) (FSM, Async, error)

func (*IdleFsm) Transaction

func (a *IdleFsm) Transaction(p peer.Peer, t proto.Transaction) (FSM, Async, error)

type InvRequester

type InvRequester interface {
	Request(p types.MessageSender, id []byte)
}

type MockDefault

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

MockDefault is a mock of Default interface

func NewMockDefault

func NewMockDefault(ctrl *gomock.Controller) *MockDefault

NewMockDefault creates a new mock instance

func (*MockDefault) EXPECT

func (m *MockDefault) EXPECT() *MockDefaultMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockDefault) NewPeer

func (m *MockDefault) NewPeer(fsm FSM, p Peer, info BaseInfo) (FSM, Async, error)

NewPeer mocks base method

func (*MockDefault) Noop

func (m *MockDefault) Noop(arg0 FSM) (FSM, Async, error)

Noop mocks base method

func (*MockDefault) PeerError

func (m *MockDefault) PeerError(fsm FSM, p Peer, baseInfo BaseInfo, arg3 error) (FSM, Async, error)

PeerError mocks base method

type MockDefaultMockRecorder

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

MockDefaultMockRecorder is the mock recorder for MockDefault

func (*MockDefaultMockRecorder) NewPeer

func (mr *MockDefaultMockRecorder) NewPeer(fsm, p, info interface{}) *gomock.Call

NewPeer indicates an expected call of NewPeer

func (*MockDefaultMockRecorder) Noop

func (mr *MockDefaultMockRecorder) Noop(arg0 interface{}) *gomock.Call

Noop indicates an expected call of Noop

func (*MockDefaultMockRecorder) PeerError

func (mr *MockDefaultMockRecorder) PeerError(fsm, p, baseInfo, arg3 interface{}) *gomock.Call

PeerError indicates an expected call of PeerError

type NGFsm

type NGFsm struct {
	BaseInfo
}

func NewNGFsm12

func NewNGFsm12(info BaseInfo) *NGFsm

func (*NGFsm) Block

func (a *NGFsm) Block(peer peer.Peer, block *proto.Block) (FSM, Async, error)

func (*NGFsm) BlockIDs

func (a *NGFsm) BlockIDs(peer peer.Peer, sigs []proto.BlockID) (FSM, Async, error)

func (*NGFsm) GetPeers

func (a *NGFsm) GetPeers(peer peer.Peer) (FSM, Async, error)

func (*NGFsm) Halt

func (a *NGFsm) Halt() (FSM, Async, error)

func (*NGFsm) MicroBlock

func (a *NGFsm) MicroBlock(p peer.Peer, micro *proto.MicroBlock) (FSM, Async, error)

received microblock

func (*NGFsm) MicroBlockInv

func (a *NGFsm) MicroBlockInv(p peer.Peer, inv *proto.MicroBlockInv) (FSM, Async, error)

func (*NGFsm) MinedBlock

func (a *NGFsm) MinedBlock(block *proto.Block, limits proto.MiningLimits, keyPair proto.KeyPair, vrf []byte) (FSM, Async, error)

func (*NGFsm) NewPeer

func (a *NGFsm) NewPeer(p peer.Peer) (FSM, Async, error)

func (*NGFsm) PeerError

func (a *NGFsm) PeerError(p peer.Peer, e error) (FSM, Async, error)

func (*NGFsm) Score

func (a *NGFsm) Score(p peer.Peer, score *proto.Score) (FSM, Async, error)

func (*NGFsm) Task

func (a *NGFsm) Task(task AsyncTask) (FSM, Async, error)

func (*NGFsm) Transaction

func (a *NGFsm) Transaction(p peer.Peer, t proto.Transaction) (FSM, Async, error)

type PersistFsm

type PersistFsm struct {
	BaseInfo
}

Save transactions by address from temporary file into storage. Only read operations permitted.

func (*PersistFsm) Block

func (a *PersistFsm) Block(p peer.Peer, block *proto.Block) (FSM, Async, error)

func (*PersistFsm) BlockIDs

func (a *PersistFsm) BlockIDs(peer peer.Peer, ids []proto.BlockID) (FSM, Async, error)

func (*PersistFsm) Halt

func (a *PersistFsm) Halt() (FSM, Async, error)

func (*PersistFsm) MicroBlock

func (a *PersistFsm) MicroBlock(p peer.Peer, micro *proto.MicroBlock) (FSM, Async, error)

func (*PersistFsm) MicroBlockInv

func (a *PersistFsm) MicroBlockInv(p peer.Peer, inv *proto.MicroBlockInv) (FSM, Async, error)

func (*PersistFsm) MinedBlock

func (a *PersistFsm) MinedBlock(block *proto.Block, limits proto.MiningLimits, keyPair proto.KeyPair, vrf []byte) (FSM, Async, error)

func (*PersistFsm) NewPeer

func (a *PersistFsm) NewPeer(p peer.Peer) (FSM, Async, error)

func (*PersistFsm) PeerError

func (a *PersistFsm) PeerError(p peer.Peer, e error) (FSM, Async, error)

func (*PersistFsm) Score

func (a *PersistFsm) Score(p peer.Peer, score *proto.Score) (FSM, Async, error)

func (*PersistFsm) Task

func (a *PersistFsm) Task(t tasks.AsyncTask) (FSM, Async, error)

func (*PersistFsm) Transaction

func (a *PersistFsm) Transaction(p peer.Peer, t proto.Transaction) (FSM, Async, error)

type SyncFsm

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

func (*SyncFsm) Block

func (a *SyncFsm) Block(p Peer, block *proto.Block) (FSM, Async, error)

func (*SyncFsm) BlockIDs

func (a *SyncFsm) BlockIDs(peer Peer, sigs []proto.BlockID) (FSM, Async, error)

func (*SyncFsm) Halt

func (a *SyncFsm) Halt() (FSM, Async, error)

func (*SyncFsm) MicroBlock

func (a *SyncFsm) MicroBlock(_ Peer, _ *proto.MicroBlock) (FSM, Async, error)

ignore microblocks

func (*SyncFsm) MicroBlockInv

func (a *SyncFsm) MicroBlockInv(_ Peer, _ *proto.MicroBlockInv) (FSM, Async, error)

ignore microblocks

func (*SyncFsm) MinedBlock

func (a *SyncFsm) MinedBlock(block *proto.Block, limits proto.MiningLimits, keyPair proto.KeyPair, vrf []byte) (FSM, Async, error)

func (*SyncFsm) NewPeer

func (a *SyncFsm) NewPeer(p Peer) (FSM, Async, error)

func (*SyncFsm) PeerError

func (a *SyncFsm) PeerError(p Peer, e error) (FSM, Async, error)

func (*SyncFsm) Score

func (a *SyncFsm) Score(p Peer, score *proto.Score) (FSM, Async, error)

func (*SyncFsm) Task

func (a *SyncFsm) Task(task AsyncTask) (FSM, Async, error)

func (*SyncFsm) Transaction

func (a *SyncFsm) Transaction(p Peer, t proto.Transaction) (FSM, Async, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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