rpcsource

package
v0.17.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: Apache-2.0 Imports: 21 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package rpcsource lives outside package sync because rpc/v10, whose types it decodes, imports sync.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mode

type Mode uint8
const (
	Follow Mode = iota
	CatchUp
)

func (Mode) MarshalText

func (m Mode) MarshalText() ([]byte, error)

func (Mode) MarshalYAML

func (m Mode) MarshalYAML() (any, error)

func (*Mode) Set

func (m *Mode) Set(s string) error

func (Mode) String

func (m Mode) String() string

func (*Mode) Type

func (m *Mode) Type() string

func (*Mode) UnmarshalText

func (m *Mode) UnmarshalText(text []byte) error

type Option

type Option func(*Source)

func WithErrorPause

func WithErrorPause(d time.Duration) Option

WithErrorPause sets how long BlockByNumber waits before returning an error.

type Source

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

func New

func New(
	chain *blockchain.Blockchain,
	client *rpc.Client,
	feeder sync.DataSource,
	mode Mode,
	logger log.StructuredLogger,
	opts ...Option,
) *Source

func (*Source) BlockByNumber

func (s *Source) BlockByNumber(
	ctx context.Context,
	blockNumber uint64,
) (sync.CommittedBlock, error)

BlockByNumber pauses before reporting an RPC error: the synchronizer refetches as soon as it fails, most often while polling for a block the remote doesn't have yet.

func (*Source) BlockHeaderLatest

func (s *Source) BlockHeaderLatest(ctx context.Context) (*core.Header, error)

func (*Source) CheckRemote

func (s *Source) CheckRemote(ctx context.Context) error

Jump to

Keyboard shortcuts

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