sync

package
v2.1.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2019 License: LGPL-3.0 Imports: 17 Imported by: 1

Documentation

Index

Constants

View Source
const (
	MaxChunkPerSyncRequest       = 10
	ConcurrentSyncChunkDataCount = 10
	GetChunkDataTimeout          = 10 // 10s.
)

Contants

Variables

View Source
var (
	ErrInvalidChainSyncMessageData     = errors.New("invalid ChainSync message data")
	ErrInvalidChainGetChunkMessageData = errors.New("invalid ChainGetChunk message data")
)

Errors

View Source
var (
	ErrInvalidChainChunksMessageData    = errors.New("invalid ChainChunks message data")
	ErrWrongChainChunksMessageData      = errors.New("wrong ChainChunks message data")
	ErrInvalidChainChunkDataMessageData = errors.New("invalid ChainChunkData message data")
	ErrWrongChainChunkDataMessageData   = errors.New("wrong ChainChunkData message data")
	ErrInvalidChunkHeaderSourcePeer     = errors.New("invalid chunk headers source peer")
)

Errors

View Source
var (
	ErrTooSmallGapToSync        = errors.New("the gap between syncpoint and current tail is smaller than a dynasty interval, ignore the sync task")
	ErrCannotFindBlockByHeight  = errors.New("cannot find the block at given height")
	ErrCannotFindBlockByHash    = errors.New("cannot find the block with the given hash")
	ErrWrongChunkHeaderRootHash = errors.New("wrong chunk header root hash")
	ErrWrongChunkDataRootHash   = errors.New("wrong chunk data root hash")
	ErrWrongChunkDataSize       = errors.New("wrong chunk data size")
	ErrInvalidBlockHashInChunk  = errors.New("invalid block hash in chunk data")
	ErrWrongBlockHashInChunk    = errors.New("wrong block hash in chunk data compared with chunk header")
)

Error Types

Functions

This section is empty.

Types

type Chunk added in v1.0.0

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

Chunk packs some blocks

func NewChunk added in v1.0.0

func NewChunk(blockChain *core.BlockChain) *Chunk

NewChunk return a new chunk

type Service added in v1.0.0

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

Service manage sync tasks

func NewService added in v1.0.0

func NewService(blockChain *core.BlockChain, netService net.Service) *Service

NewService return new Service.

func (*Service) IsActiveSyncing added in v1.0.0

func (ss *Service) IsActiveSyncing() bool

IsActiveSyncing return if there is active task now

func (*Service) Start added in v1.0.0

func (ss *Service) Start()

Start start sync service.

func (*Service) StartActiveSync added in v1.0.0

func (ss *Service) StartActiveSync() bool

StartActiveSync starts an active sync task

func (*Service) Stop added in v1.0.0

func (ss *Service) Stop()

Stop stop sync service.

func (*Service) StopActiveSync added in v1.0.0

func (ss *Service) StopActiveSync()

StopActiveSync stops current sync task

func (*Service) WaitingForFinish added in v1.0.0

func (ss *Service) WaitingForFinish()

WaitingForFinish wait for finishing current sync task

type Task added in v1.0.0

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

Task is a sync task

func NewTask added in v1.0.0

func NewTask(blockChain *core.BlockChain, netService net.Service, chunk *Chunk) *Task

NewTask return a new sync task

func (*Task) Start added in v1.0.0

func (st *Task) Start()

Start the sync task

func (*Task) Stop added in v1.0.0

func (st *Task) Stop()

Stop the sync task

Directories

Path Synopsis
Package syncpb is a generated protocol buffer package.
Package syncpb is a generated protocol buffer package.

Jump to

Keyboard shortcuts

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