syncer

package
v2.10.2+incompatible Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockHash

type BlockHash struct {
	Height int
	Hash   string
}

type Fetcher

type Fetcher interface {
	FetchAccount(address common.Address, hash common.HashHeight, prevCnt uint64)
	FetchSnapshot(hash common.HashHeight, prevCnt uint64)
	Fetch(request face.FetchRequest)
}

type Handlers

type Handlers interface {
	RegisterHandler(MsgHandler)
	UnRegisterHandler(MsgHandler)
}

type MsgHandler

type MsgHandler interface {
	Handle(common.NetMsgType, []byte, p2p.Peer)
	Types() []common.NetMsgType
	Id() string
}

type RetryStatus

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

type Sender

type Sender interface {
	// when new block create
	BroadcastAccountBlocks(common.Address, []*common.AccountStateBlock) error
	BroadcastSnapshotBlocks([]*common.SnapshotBlock) error

	// when fetch block message be arrived
	SendAccountBlocks(common.Address, []*common.AccountStateBlock, p2p.Peer) error
	SendSnapshotBlocks([]*common.SnapshotBlock, p2p.Peer) error

	SendAccountHashes(common.Address, []common.HashHeight, p2p.Peer) error
	SendSnapshotHashes([]common.HashHeight, p2p.Peer) error

	RequestAccountHash(common.Address, common.HashHeight, uint64) error
	RequestSnapshotHash(common.HashHeight, uint64) error
	RequestAccountBlocks(common.Address, []common.HashHeight) error
	RequestSnapshotBlocks([]common.HashHeight) error
}

type Syncer

type Syncer interface {
	Fetcher() Fetcher
	Sender() Sender
	Handlers() Handlers
	DefaultHandler() MsgHandler
	Init(reader face.ChainReader, writer face.PoolWriter)
	Start()
	Stop()
	Done() bool
}

func NewSyncer

func NewSyncer(net p2p.P2P, bus EventBus.Bus) Syncer

Jump to

Keyboard shortcuts

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