syncer

package
v0.0.0-...-dde17ac Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2018 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RequestCollationBody

func RequestCollationBody(fetcher mainchain.RecordFetcher, shardID *big.Int, period *big.Int) (*pb.CollationBodyRequest, error)

RequestCollationBody fetches a collation header record submitted to the VRC for a shardID, period pair and constructs a p2p collationBodyRequest that will then be relayed to the appropriate proposer that submitted the collation header. In production, this will be done within a voter service.

func RespondCollationBody

func RespondCollationBody(req p2p.Message, collationFetcher types.CollationFetcher) (*pb.CollationBodyResponse, error)

RespondCollationBody is called by a node responding to another node's request for a collation body given a (shardID, chunkRoot, period, proposerAddress) tuple. The proposer will fetch the corresponding data from persistent storage (shardDB) by constructing a collation header from the input and calculating its hash.

Types

type Syncer

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

Syncer represents a service that provides handlers for shard chain data requests/responses between remote nodes and event loops for performing windback sync across nodes, handling reorgs, and synchronizing items such as transactions and in future sharding iterations: state.

func NewSyncer

func NewSyncer(config *params.Config, client *mainchain.VRCClient, p2p *p2p.Server, shardChainDB *database.ShardDB, shardID int) (*Syncer, error)

NewSyncer creates a struct instance of a syncer service. It will have access to config, a signer, a p2p server, a shardChainDB, and a shardID.

func (*Syncer) HandleCollationBodyRequests

func (s *Syncer) HandleCollationBodyRequests(collationFetcher types.CollationFetcher, done <-chan struct{})

HandleCollationBodyRequests subscribes to messages from the shardp2p network and responds to a specific peer that requested the body using the Send method exposed by the p2p server's API (implementing the p2p.Sender interface).

func (*Syncer) Start

func (s *Syncer) Start()

Start the main loop for handling shard chain data requests.

func (*Syncer) Stop

func (s *Syncer) Stop() error

Stop the main loop.

Jump to

Keyboard shortcuts

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