Documentation ¶
Index ¶
- Constants
- type BlockchainReactor
- func (r *BlockchainReactor) AddPeer(peer p2p.Peer)
- func (r *BlockchainReactor) GetChannels() []*p2p.ChannelDescriptor
- func (r *BlockchainReactor) GetMaxPeerBlockHeight() int64
- func (r *BlockchainReactor) GetRemainingSyncTime() time.Duration
- func (r *BlockchainReactor) GetTotalSyncedTime() time.Duration
- func (r *BlockchainReactor) Receive(chID byte, src p2p.Peer, msgBytes []byte)
- func (r *BlockchainReactor) RemovePeer(peer p2p.Peer, reason interface{})
- func (r *BlockchainReactor) SetLogger(logger log.Logger)
- func (r *BlockchainReactor) SetSwitch(sw *p2p.Switch)
- func (r *BlockchainReactor) Start() error
- func (r *BlockchainReactor) Stop() error
- func (r *BlockchainReactor) SwitchToBlockSync(state state.State) error
- func (r *BlockchainReactor) SyncHeight() int64
- type Event
- type Metrics
- type PeerByID
- type Routine
Constants ¶
const ( // BlockchainChannel is a channel for blocks and status updates (`BlockStore` height) BlockchainChannel = byte(0x40) )
const ( // MetricsSubsystem is a subsystem shared by all metrics exposed by this // package. MetricsSubsystem = "blockchain" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockchainReactor ¶
type BlockchainReactor struct { p2p.BaseReactor // contains filtered or unexported fields }
BlockchainReactor handles block sync protocol.
func NewBlockchainReactor ¶
func NewBlockchainReactor( state state.State, blockApplier blockApplier, store blockStore, blockSync bool, metrics *cons.Metrics) *BlockchainReactor
NewBlockchainReactor creates a new reactor instance.
func (*BlockchainReactor) AddPeer ¶
func (r *BlockchainReactor) AddPeer(peer p2p.Peer)
AddPeer implements Reactor interface
func (*BlockchainReactor) GetChannels ¶
func (r *BlockchainReactor) GetChannels() []*p2p.ChannelDescriptor
GetChannels implements Reactor
func (*BlockchainReactor) GetMaxPeerBlockHeight ¶
func (r *BlockchainReactor) GetMaxPeerBlockHeight() int64
func (*BlockchainReactor) GetRemainingSyncTime ¶
func (r *BlockchainReactor) GetRemainingSyncTime() time.Duration
func (*BlockchainReactor) GetTotalSyncedTime ¶
func (r *BlockchainReactor) GetTotalSyncedTime() time.Duration
func (*BlockchainReactor) Receive ¶
func (r *BlockchainReactor) Receive(chID byte, src p2p.Peer, msgBytes []byte)
Receive implements Reactor by handling different message types. XXX: do not call any methods that can block or incur heavy processing. https://github.com/providenetwork/tendermint/issues/2888
func (*BlockchainReactor) RemovePeer ¶
func (r *BlockchainReactor) RemovePeer(peer p2p.Peer, reason interface{})
RemovePeer implements Reactor interface.
func (*BlockchainReactor) SetLogger ¶
func (r *BlockchainReactor) SetLogger(logger log.Logger)
SetLogger sets the logger of the reactor.
func (*BlockchainReactor) SetSwitch ¶
func (r *BlockchainReactor) SetSwitch(sw *p2p.Switch)
SetSwitch implements Reactor interface.
func (*BlockchainReactor) Start ¶
func (r *BlockchainReactor) Start() error
Start implements cmn.Service interface
func (*BlockchainReactor) Stop ¶
func (r *BlockchainReactor) Stop() error
Stop implements cmn.Service interface.
func (*BlockchainReactor) SwitchToBlockSync ¶
func (r *BlockchainReactor) SwitchToBlockSync(state state.State) error
SwitchToBlockSync is called by the state sync reactor when switching to block sync.
func (*BlockchainReactor) SyncHeight ¶
func (r *BlockchainReactor) SyncHeight() int64
SyncHeight returns the height to which the BlockchainReactor has synced.
type Metrics ¶
type Metrics struct { // events_in EventsIn metrics.Counter // events_in EventsHandled metrics.Counter // events_out EventsOut metrics.Counter // errors_in ErrorsIn metrics.Counter // errors_handled ErrorsHandled metrics.Counter // errors_out ErrorsOut metrics.Counter // events_shed EventsShed metrics.Counter // events_sent EventsSent metrics.Counter // errors_sent ErrorsSent metrics.Counter // errors_shed ErrorsShed metrics.Counter }
Metrics contains metrics exposed by this package.
func PrometheusMetrics ¶
PrometheusMetrics returns metrics for in and out events, errors, etc. handled by routines. Can we burn in the routine name here?
type Routine ¶
type Routine struct {
// contains filtered or unexported fields
}
Routine is a structure that models a finite state machine as serialized stream of events processed by a handle function. This Routine structure handles the concurrency and messaging guarantees. Events are sent via `send` are handled by the `handle` function to produce an iterator `next()`. Calling `stop()` on a routine will conclude processing of all sent events and produce `final()` event representing the terminal state.