layerfetcher

package
v0.1.16-ntpfix Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2020 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package layerfetcher fetches layers from remote peers

Index

Constants

View Source
const (
	BlockDB       = 1
	LayerBlocksDB = 2
	ATXDB         = 3
	TXDB          = 4
	POETDB        = 5
	LayerHashDB   = 6
	ATXIDsDB      = 7
)

DB hints per DB

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	RequestTimeout int
}

Config defines configuration for layer fetching logic

type Future

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

Future is a preparation for using actual futures in the code, this will allow to truly execute asynchronous reads and receive result only when needed

func (*Future) Result

func (f *Future) Result() error

Result actually evaluates the result of the fetch task

type LayerPromiseResult

type LayerPromiseResult struct {
	Layer types.LayerID
	// contains filtered or unexported fields
}

LayerPromiseResult is the result of trying to fetch an entire layer- if this fails the error will be added to result

type Logic

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

Logic is the struct containing components needed to follow layer fetching logic

func NewLogic

func NewLogic(cfg Config, blocks blockHandler, atxs atxHandler, poet poetDb, network service.Service, fetcher fetch.Fetcher, log log.Log) *Logic

NewLogic creates a new instance of layer fetching logic

func (*Logic) FetchAtx

func (l *Logic) FetchAtx(id types.ATXID) error

FetchAtx returns error if ATX was not found

func (*Logic) FetchBlock

func (l *Logic) FetchBlock(id types.BlockID) error

FetchBlock gets data for a single block id and validates it

func (*Logic) FetchFlow

func (l *Logic) FetchFlow()

FetchFlow is the main syncing flow TBD

func (*Logic) GetAtxs

func (l *Logic) GetAtxs(IDs []types.ATXID) error

GetAtxs gets the data for given atx ids IDs and validates them. returns an error if at least one ATX cannot be fetched

func (*Logic) GetBlocks

func (l *Logic) GetBlocks(IDs []types.BlockID) error

GetBlocks gets the data for given block ids and validates the blocks. returns an error if a single atx failed to be fetched or validated

func (*Logic) GetEpochATXs

func (l *Logic) GetEpochATXs(id types.EpochID) error

GetEpochATXs fetches all atxs received by peer for given layer

func (*Logic) GetPoetProof

func (l *Logic) GetPoetProof(id types.Hash32) error

GetPoetProof gets poet proof from remote peer

func (*Logic) GetTxs

func (l *Logic) GetTxs(IDs []types.TransactionID) error

GetTxs fetches the txs provided as IDs and validates them, returns an error if one TX failed to be fetched

func (*Logic) IsSynced

func (l *Logic) IsSynced() bool

IsSynced indocates if this node is synced

func (*Logic) LayerHashBlocksReceiver

func (l *Logic) LayerHashBlocksReceiver(msg []byte) []byte

LayerHashBlocksReceiver returns the block IDs for the specified layer hash, it also returns the validation vector for this hash and latest blocks received in gossip

func (*Logic) LayerHashReqReceiver

func (l *Logic) LayerHashReqReceiver(msg []byte) []byte

LayerHashReqReceiver returns the layer hash for the given layer ID

func (*Logic) ListenToGossip

func (l *Logic) ListenToGossip() bool

ListenToGossip indicates if node is currently accepting packets from gossip

func (*Logic) PollLayer

func (l *Logic) PollLayer(layer types.LayerID) chan LayerPromiseResult

PollLayer performs the following send layer number to all parties receive layer hash from all peers get layer hash from corresponding peer fetch block ids from all peers fetch ATXs and Txs per block

Jump to

Keyboard shortcuts

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