state_fsm

package
v0.10.6 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2023 License: MIT Imports: 27 Imported by: 0

Documentation

Overview

Package state_fsm is a generated GoMock package.

Index

Constants

This section is empty.

Variables

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

Functions

func HaltTransition

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

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, microblockInterval time.Duration) (FSM, Async, error)

func NewPersistTransition

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

func NewSyncFsm

func NewSyncFsm(baseInfo BaseInfo, conf 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 {
	BlockExists(state storage.State, block *proto.Block) (bool, error)
	Apply(state storage.State, block []*proto.Block) (proto.Height, error)
	ApplyMicro(state storage.State, block *proto.Block) (proto.Height, error)
}

type Default

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

type DefaultImpl

type DefaultImpl struct {
}

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)

	// BlockIDs receives signatures that was requested by GetSignatures
	BlockIDs(peer.Peer, []proto.BlockID) (FSM, Async, error)
	Task(task AsyncTask) (FSM, Async, error)

	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)

	String() string

	Errorf(err error) 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) Errorf added in v0.10.0

func (a HaltFSM) Errorf(err error) 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) String added in v0.10.0

func (a HaltFSM) String() string

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, _ *proto.Block) (FSM, Async, error)

func (*IdleFsm) BlockIDs

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

func (*IdleFsm) Errorf added in v0.10.0

func (a *IdleFsm) Errorf(err error) error

func (*IdleFsm) Halt

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

func (*IdleFsm) MicroBlock

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

func (*IdleFsm) MicroBlockInv

func (a *IdleFsm) MicroBlockInv(_ peer.Peer, _ *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) String added in v0.10.0

func (a *IdleFsm) String() string

func (*IdleFsm) Task

func (a *IdleFsm) Task(task tasks.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 {
	Add2Cache(id []byte) (existed bool)
	Request(p types.MessageSender, id []byte) (existed bool)
}

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) 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) 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 MockTime added in v0.10.0

type MockTime struct {
	// NowFunc mocks the Now method.
	NowFunc func() time.Time
	// contains filtered or unexported fields
}

MockTime is a mock implementation of types.Time.

func TestSomethingThatUsesTime(t *testing.T) {

	// make and configure a mocked types.Time
	mockedTime := &MockTime{
		NowFunc: func() time.Time {
			panic("mock out the Now method")
		},
	}

	// use mockedTime in code that requires types.Time
	// and then make assertions.

}

func (*MockTime) Now added in v0.10.0

func (mock *MockTime) Now() time.Time

Now calls NowFunc.

func (*MockTime) NowCalls added in v0.10.0

func (mock *MockTime) NowCalls() []struct {
}

NowCalls gets all the calls that were made to Now. Check the length with:

len(mockedTime.NowCalls())

type NGFsm

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

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, _ []proto.BlockID) (FSM, Async, error)

func (*NGFsm) Errorf added in v0.10.0

func (a *NGFsm) Errorf(err error) 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)

MicroBlock handles new microblock message.

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) String added in v0.10.0

func (a *NGFsm) String() string

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 {
	// contains filtered or unexported fields
}

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) Errorf added in v0.10.0

func (a *PersistFsm) Errorf(err error) 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) String added in v0.10.0

func (a *PersistFsm) String() string

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.Peer, block *proto.Block) (FSM, Async, error)

func (*SyncFsm) BlockIDs

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

func (*SyncFsm) Errorf added in v0.10.0

func (a *SyncFsm) Errorf(err error) error

func (*SyncFsm) Halt

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

func (*SyncFsm) MicroBlock

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

MicroBlock ignores new microblocks while syncing.

func (*SyncFsm) MicroBlockInv

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

MicroBlockInv ignores microblock requests while syncing.

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.Peer) (FSM, Async, error)

func (*SyncFsm) PeerError

func (a *SyncFsm) PeerError(p peer.Peer, _ error) (FSM, Async, error)

func (*SyncFsm) Score

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

func (*SyncFsm) String added in v0.10.0

func (a *SyncFsm) String() string

func (*SyncFsm) Task

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

func (*SyncFsm) Transaction

func (a *SyncFsm) Transaction(p peer.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