multidownloader

package
v0.8.0-beta5 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: Apache-2.0, MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidBlockChunkSize is returned when the block chunk size is invalid
	ErrInvalidBlockChunkSize = errors.New("MultidownloaderConfig.BlockChunkSize: block chunk size must be greater than 0")
	// ErrInvalidMaxParallelBlockHeaderRetrieval is returned when the max parallel block header retrieval is invalid
	ErrInvalidMaxParallelBlockHeaderRetrieval = errors.New("MultidownloaderConfig.MaxParallelBlockHeaderRetrieval:" +
		" max parallel block header retrieval must be greater than 0")
	// ErrInvalidWaitPeriodToCheckCatchUp is returned when the wait period to check catch up is invalid
	ErrInvalidWaitPeriodToCheckCatchUp = errors.New("MultidownloaderConfig.WaitPeriodToCheckCatchUp: " +
		"wait period to check catch up must be greater than 0")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	// Enabled indicates if the multidownloader is enabled
	Enabled bool
	// StoragePath is the path to the storage
	StoragePath string
	// BlockChunkSize is the number of blocks to query in each FilterLogs call
	BlockChunkSize uint32
	// MaxParallelBlockHeaderRetrieval is the maximum number of parallel RPC calls to retrieve block headers
	MaxParallelBlockHeaderRetrieval int
	// BlockFinality is which block to consider final (typically finalizedBlock)
	BlockFinality aggkittypes.BlockNumberFinality
	// WaitPeriodToCheckCatchUp is the duration to wait before checking again if logs are not yet available
	WaitPeriodToCheckCatchUp types.Duration
}

func NewConfigDefault

func NewConfigDefault(name string, basePathDB string) Config

func (*Config) String

func (cfg *Config) String() string

func (*Config) Validate

func (cfg *Config) Validate() error

type EVMMultidownloader

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

func NewEVMMultidownloader

func NewEVMMultidownloader(log aggkitcommon.Logger,
	cfg Config,
	name string,
	ethClient aggkittypes.BaseEthereumClienter,
	rpcClient aggkittypes.RPCClienter,
	storageDB mdrtypes.Storager,
	blockNotifierManager ethermantypes.BlockNotifierManager,
) (*EVMMultidownloader, error)

NewEVMMultidownloader creates a new EVM multidownloader instance with proper validation

func (*EVMMultidownloader) BlockHeader

BlockHeader gets the block header for the given finality type

func (*EVMMultidownloader) BlockNumber

func (dh *EVMMultidownloader) BlockNumber(ctx context.Context,
	finality aggkittypes.BlockNumberFinality) (uint64, error)

BlockNumber gets the block number for the given finality type

func (*EVMMultidownloader) ChainID

func (dh *EVMMultidownloader) ChainID(ctx context.Context) (uint64, error)

ChainID gets the chain ID directly from ethClient

func (*EVMMultidownloader) CheckDatabase

func (dh *EVMMultidownloader) CheckDatabase(ctx context.Context) error

func (*EVMMultidownloader) EthClient

EthClient returns the underlying eth client

func (*EVMMultidownloader) FilterLogs

func (dh *EVMMultidownloader) FilterLogs(ctx context.Context, query ethereum.FilterQuery) ([]types.Log, error)

FilterLogs filters the logs. It gets them from storage or waits until they are available

func (*EVMMultidownloader) GetRPCServices

func (dh *EVMMultidownloader) GetRPCServices() []jRPC.Service

func (*EVMMultidownloader) HeaderByNumber

func (dh *EVMMultidownloader) HeaderByNumber(ctx context.Context, number *big.Int) (*aggkittypes.BlockHeader, error)

HeaderByNumber gets the block header for the given block number from storage or ethClient

func (*EVMMultidownloader) Initialize

func (dh *EVMMultidownloader) Initialize(ctx context.Context) error

Initialize initializes the multidownloader. At this point all syncers must be registered and it will prepare the pendingSync segments

func (*EVMMultidownloader) IsAvailable

func (dh *EVMMultidownloader) IsAvailable(query mdrtypes.LogQuery) bool

func (*EVMMultidownloader) RegisterSyncer

func (dh *EVMMultidownloader) RegisterSyncer(data aggkittypes.SyncerConfig) error

func (*EVMMultidownloader) ShowStatistics

func (dh *EVMMultidownloader) ShowStatistics(iteration int)

func (*EVMMultidownloader) Start

func (dh *EVMMultidownloader) Start(ctx context.Context) error

func (*EVMMultidownloader) StepSafe

func (dh *EVMMultidownloader) StepSafe(ctx context.Context) (bool, error)

StepSafe performs a safe step syncing logs and block headers from historical data Returns true when syncing is complete, false if more work remains

type EVMMultidownloaderRPC

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

func NewEVMMultidownloaderRPC

func NewEVMMultidownloaderRPC(
	logger aggkitcommon.Logger,
	downloader *EVMMultidownloader,
) *EVMMultidownloaderRPC

func (*EVMMultidownloaderRPC) Status

func (b *EVMMultidownloaderRPC) Status() (interface{}, rpc.Error)

Status returns the status of the L1InfoTreeSync component curl -X POST http://localhost:5576/ "Content-Type: application/json" \ -d '{"method":"l1infotreesync_status", "params":[], "id":1}'

type Statistics

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

func NewStatistics

func NewStatistics() *Statistics

func (*Statistics) ETA

func (s *Statistics) ETA(pendingBlocks uint64) time.Duration

func (*Statistics) ElapsedSyncing

func (s *Statistics) ElapsedSyncing() time.Duration

func (*Statistics) FinishDBOperation

func (s *Statistics) FinishDBOperation()

func (*Statistics) FinishEthCall

func (s *Statistics) FinishEthCall(err error, numLogs uint64, numBlocks uint64)

func (*Statistics) FinishSyncing

func (s *Statistics) FinishSyncing()

func (*Statistics) LaunchedEthCall

func (s *Statistics) LaunchedEthCall()

func (*Statistics) Show

func (s *Statistics) Show(logFunc func(format string, args ...interface{}), iteration int)

func (*Statistics) StartDBOperation

func (s *Statistics) StartDBOperation()

func (*Statistics) StartSyncing

func (s *Statistics) StartSyncing()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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