sync

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2019 License: LGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RootBlockHeaderListLimit  = 500
	RootBlockBatchSize        = 100
	MinorBlockHeaderListLimit = 100 //TODO 100 50
	MinorBlockBatchSize       = 50
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Synchronizer

type Synchronizer interface {
	AddTask(Task) error
	Close() error
	IsSyncing() bool
}

Synchronizer will sync blocks for the master server when receiving new root blocks from peers.

func NewSynchronizer

func NewSynchronizer(bc blockchain) Synchronizer

NewSynchronizer returns a new synchronizer instance.

type Task

type Task interface {
	Run(blockchain) error
	Priority() *big.Int
	PeerID() string
}

Task represents a synchronization task for the synchronizer.

func NewMinorChainTask

func NewMinorChainTask(
	p minorSyncerPeer,
	header *types.MinorBlockHeader,
) Task

NewMinorChainTask returns a sync task for minor chain.

func NewRootChainTask

func NewRootChainTask(
	p rootSyncerPeer,
	header *types.RootBlockHeader,
	statusChan chan *rpc.ShardStatus,
	getShardConnFunc func(fullShardId uint32) []rpc.ShardConnForP2P,
) Task

NewRootChainTask returns a sync task for root chain.

Jump to

Keyboard shortcuts

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