fetcher

package
v0.0.9-Bytes Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package fetcher contains the sequencer announcement based synchronisation.

Copyright © 2019 Annchain Authors <EMAIL ADDRESS>

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitLoggers

func InitLoggers(logger *logrus.Logger, logdir string)

Types

type Fetcher

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

Fetcher is responsible for accumulating sequencer announcements from various peers and scheduling them for retrieval.

func New

func New(getsequencer sequencerRetrievalFn, chainHeight chainHeightFn, insertChain chainInsertFn, dropPeer peerDropFn) *Fetcher

New creates a sequencer fetcher to retrieve sequencers based on hash announcements.

func (*Fetcher) Enqueue

func (f *Fetcher) Enqueue(peer string, sequencer *types.Sequencer) error

Enqueue tries to fill gaps the the fetcher's future import queue.

func (*Fetcher) FilterBodies

func (f *Fetcher) FilterBodies(peer string, transactions []types.Txis, sequencers archive.Sequencers, time time.Time) []types.Txis

FilterBodies extracts all the sequencer bodies that were explicitly requested by the fetcher, returning those that should be handled differently.

func (*Fetcher) FilterHeaders

func (f *Fetcher) FilterHeaders(peer string, headers dagmessage.SequencerHeaders, time time.Time) []*dagmessage.SequencerHeader

FilterHeaders extracts all the headers that were explicitly requested by the fetcher, returning those that should be handled differently.

func (*Fetcher) Notify

func (f *Fetcher) Notify(peer string, hash types2.Hash, number uint64, time time.Time,
	headerFetcher headerRequesterFn, bodyFetcher bodyRequesterFn) error

Notify announces the fetcher of the potential availability of a new sequencer in the network.

func (*Fetcher) Start

func (f *Fetcher) Start()

Start boots up the announcement based synchroniser, accepting and processing hash notifications and sequencer fetches until termination requested.

func (*Fetcher) Stop

func (f *Fetcher) Stop()

Stop terminates the announcement based synchroniser, canceling all pending operations.

Jump to

Keyboard shortcuts

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