snapshot

package
v0.31.5-binance.2 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2019 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StateSyncChannel is a channel for state and status updates (`StateStore` height)
	// First implementation (range request) of state sync is 0x35
	StateSyncChannel = byte(0x36)
)

Variables

This section is empty.

Functions

func InitSnapshotManager

func InitSnapshotManager(
	stateDB dbm.DB,
	txIndexDB dbm.DB,
	blockStore *blockchain.BlockStore,
	dbDir string,
	logger log.Logger)

func RegisterSnapshotMessages

func RegisterSnapshotMessages(cdc *amino.Codec)

Types

type BlockchainStateMessage

type BlockchainStateMessage interface{}

BlockchainStateMessage is a generic message for this reactor.

type SnapshotManager

type SnapshotManager struct {
	RestorationManifest *abci.Manifest
	Reader              abci.SnapshotReader
	Writer              abci.SnapshotWriter
	// contains filtered or unexported fields
}

application should only interact with this manager (not internal Reader/Writer) but we have to expose reader/writer to make tendermint state sync reactor manipulate low level data

func Manager

func Manager() *SnapshotManager

func ManagerAt

func ManagerAt(height int64) *SnapshotManager

func (*SnapshotManager) Delete

func (mgr *SnapshotManager) Delete() error

func (*SnapshotManager) Finalize

func (mgr *SnapshotManager) Finalize() error

finalize snapshot we synced from peer

func (*SnapshotManager) GetBlockStore

func (mgr *SnapshotManager) GetBlockStore() *blockchain.BlockStore

func (*SnapshotManager) GetStateDB

func (mgr *SnapshotManager) GetStateDB() dbm.DB

func (*SnapshotManager) GetTxDB

func (mgr *SnapshotManager) GetTxDB() dbm.DB

func (*SnapshotManager) IsFinalized

func (mgr *SnapshotManager) IsFinalized() bool

func (*SnapshotManager) SelfFinalize

func (mgr *SnapshotManager) SelfFinalize(numKeys []int64) error

finalize snapshot we generated by ourselves

func (*SnapshotManager) WriteAppStateChunk

func (mgr *SnapshotManager) WriteAppStateChunk(chunk *abci.AppStateChunk) error

func (*SnapshotManager) WriteManifest

func (mgr *SnapshotManager) WriteManifest(hash abci.SHA256Sum, manifest *abci.Manifest) error

type SnapshotRequest

type SnapshotRequest struct {
	Height int64
	Hash   abci.SHA256Sum
	PeerID p2p.ID
}

func (SnapshotRequest) String

func (req SnapshotRequest) String() string

type StatePool

type StatePool struct {
	cmn.BaseService
	// contains filtered or unexported fields
}

func NewStatePool

func NewStatePool(app proxy.AppConnState, requestsCh chan<- SnapshotRequest, errorsCh chan<- peerError, stateDB dbm.DB) *StatePool

func (*StatePool) OnStart

func (pool *StatePool) OnStart() error

func (*StatePool) OnStop

func (pool *StatePool) OnStop()

type StateReactor

type StateReactor struct {
	p2p.BaseReactor
	// contains filtered or unexported fields
}

StateReactor handles initial state syncing. User manual: https://docs.binance.org/fullnode.html#state-sync

func NewStateReactor

func NewStateReactor(stateDB dbm.DB, app proxy.AppConnState, config *cfg.Config) *StateReactor

NewStateReactor returns new reactor instance.

func (*StateReactor) AddPeer

func (bcSR *StateReactor) AddPeer(peer p2p.Peer)

AddPeer implements Reactor by sending our state to peer.

func (*StateReactor) BroadcastStateStatusRequest

func (bcSR *StateReactor) BroadcastStateStatusRequest()

BroadcastStatusRequest broadcasts `StateStore` height.

func (*StateReactor) GetChannels

func (_ *StateReactor) GetChannels() []*p2p.ChannelDescriptor

GetChannels implements Reactor

func (*StateReactor) OnStart

func (bcSR *StateReactor) OnStart() error

OnStart implements cmn.Service.

func (*StateReactor) OnStop

func (bcSR *StateReactor) OnStop()

OnStop implements cmn.Service.

func (*StateReactor) Receive

func (bcSR *StateReactor) Receive(chID byte, src p2p.Peer, msgBytes []byte)

Receive implements Reactor by handling 4 types of messages (see below).

func (*StateReactor) RemovePeer

func (bcSR *StateReactor) RemovePeer(peer p2p.Peer, reason interface{})

RemovePeer implements Reactor by removing peer from the pool.

func (*StateReactor) SetLogger

func (bcSR *StateReactor) SetLogger(l log.Logger)

SetLogger implements cmn.Service by setting the logger on reactor and pool.

Jump to

Keyboard shortcuts

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