state

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2025 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoMoreBlocks = errors.New("no more blocks to process")
)

Sentinel errors

Functions

This section is empty.

Types

type Config

type Config struct {
	Storage StorageConfig `yaml:"storage"`
	Limiter LimiterConfig `yaml:"limiter"`
}

func (*Config) Validate

func (c *Config) Validate() error

type LimiterConfig

type LimiterConfig struct {
	Enabled           bool `yaml:"enabled"`
	clickhouse.Config `yaml:",inline"`
	Table             string `yaml:"table"`
}

type Manager

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

func NewManager

func NewManager(ctx context.Context, log logrus.FieldLogger, config *Config) (*Manager, error)

func (*Manager) GetHeadDistance added in v0.0.8

func (s *Manager) GetHeadDistance(ctx context.Context, processor, network, mode string, executionHead *big.Int) (distance int64, headType string, err error)

GetHeadDistance calculates the distance between current processing block and the relevant head

func (*Manager) GetMinMaxStoredBlocks added in v0.0.5

func (s *Manager) GetMinMaxStoredBlocks(ctx context.Context, network, processor string) (minBlock, maxBlock *big.Int, err error)

func (*Manager) IsBlockRecentlyProcessed added in v0.0.8

func (s *Manager) IsBlockRecentlyProcessed(ctx context.Context, blockNumber uint64, network, processor string, withinSeconds int) (bool, error)

IsBlockRecentlyProcessed checks if a block was processed within the specified number of seconds

func (*Manager) MarkBlockProcessed

func (s *Manager) MarkBlockProcessed(ctx context.Context, blockNumber uint64, network, processor string) error

func (*Manager) NextBlock

func (s *Manager) NextBlock(ctx context.Context, processor, network, mode string, chainHead *big.Int) (*big.Int, error)

func (*Manager) SetNetwork added in v0.0.5

func (s *Manager) SetNetwork(network string)

SetNetwork sets the network name for metrics labeling

func (*Manager) Start

func (s *Manager) Start(ctx context.Context) error

func (*Manager) Stop

func (s *Manager) Stop(ctx context.Context) error

type StorageConfig

type StorageConfig struct {
	clickhouse.Config `yaml:",inline"`
	Table             string `yaml:"table"`
}

Jump to

Keyboard shortcuts

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