atxsync

package
v1.5.2-hotfix1 Latest Latest
Warning

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

Go to latest
Published: May 7, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(
	ctx context.Context,
	retryInterval time.Duration,
	logger *zap.Logger,
	db *sql.Database,
	fetcher system.AtxFetcher,
	set []types.ATXID,
) error

Download specified set of atxs from peers in the network.

actual retry interval will be between [retryInterval, 2*retryInterval].

Types

type Config added in v1.4.0

type Config struct {
	// EpochInfoInterval between epoch info requests to the network.
	EpochInfoInterval time.Duration `mapstructure:"epoch-info-request-interval"`
	// EpochInfoPeers is the number of peers we will ask for epoch info, every epoch info requests interval.
	EpochInfoPeers int `mapstructure:"epoch-info-peers"`

	// RequestsLimit is the maximum number of requests for single activation.
	//
	// The purpose of it is to prevent peers from advertising invalid atx and disappearing.
	// Which will make node ask other peers for invalid atx.
	// It will be reset to 0 once atx advertised again.
	RequestsLimit int `mapstructure:"requests-limit"`

	// AtxsBatch is the maximum number of atxs to sync in a single request.
	AtxsBatch int `mapstructure:"atxs-batch"`

	// ProgressFraction will report progress every fraction from total is downloaded.
	ProgressFraction float64 `mapstructure:"progress-every-fraction"`
	// ProgressInterval will report progress every interval.
	ProgressInterval time.Duration `mapstructure:"progress-on-time"`
}

func DefaultConfig added in v1.4.0

func DefaultConfig() Config

type Opt added in v1.4.0

type Opt func(*Syncer)

func WithConfig added in v1.4.0

func WithConfig(cfg Config) Opt

func WithLogger added in v1.4.0

func WithLogger(logger *zap.Logger) Opt

type Syncer added in v1.4.0

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

func New added in v1.4.0

func New(fetcher fetcher, db sql.Executor, localdb *localsql.Database, opts ...Opt) *Syncer

func (*Syncer) Download added in v1.4.0

func (s *Syncer) Download(parent context.Context, publish types.EpochID, downloadUntil time.Time) error

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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