sync

package
v0.2.7 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2019 License: GPL-3.0 Imports: 43 Imported by: 0

Documentation

Overview

Package sync TODO(3147): Add details on how sync works.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadChunkedBlock

func ReadChunkedBlock(stream libp2pcore.Stream, p2p p2p.P2P) (*eth.BeaconBlock, error)

ReadChunkedBlock handles each response chunk that is sent by the peer and converts it into a beacon block.

func ReadStatusCode

func ReadStatusCode(stream io.Reader, encoding encoder.NetworkEncoding) (uint8, string, error)

ReadStatusCode response from a RPC stream.

func WriteChunk

func WriteChunk(stream libp2pcore.Stream, encoding encoder.NetworkEncoding, msg interface{}) error

WriteChunk object to stream. response_chunk ::= | <result> | <encoding-dependent-header> | <encoded-payload>

Types

type Checker

type Checker interface {
	Syncing() bool
	Status() error
}

Checker defines a struct which can verify whether a node is currently synchronizing a chain with the rest of peers in the network.

type Config

type Config struct {
	P2P         p2p.P2P
	DB          db.Database
	Operations  *operations.Service
	Chain       blockchainService
	InitialSync Checker
}

Config to set up the regular sync service.

type RegularSync

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

RegularSync service is responsible for handling all run time p2p related operations as the main entry point for network messages.

func NewRegularSync

func NewRegularSync(cfg *Config) *RegularSync

NewRegularSync service.

func (*RegularSync) Start

func (r *RegularSync) Start()

Start the regular sync service.

func (*RegularSync) Status

func (r *RegularSync) Status() error

Status of the currently running regular sync service.

func (*RegularSync) Stop

func (r *RegularSync) Stop() error

Stop the regular sync service.

type StatusTracker

type StatusTracker interface {
	PeerStatuses() map[peer.ID]*pb.Status
}

StatusTracker interface for accessing the status / handshake messages received so far.

Directories

Path Synopsis
Package peerstatus is a threadsafe global cache to store recent peer status messages for access across multiple services.
Package peerstatus is a threadsafe global cache to store recent peer status messages for access across multiple services.

Jump to

Keyboard shortcuts

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