state

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2025 License: GPL-3.0 Imports: 10 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 JSONInt added in v0.1.1

type JSONInt int

JSONInt handles JSON numbers that might be strings or numbers.

func (JSONInt) Int added in v0.1.1

func (j JSONInt) Int() int

Int returns the value as int.

func (JSONInt) MarshalJSON added in v0.1.1

func (j JSONInt) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*JSONInt) UnmarshalJSON added in v0.1.1

func (j *JSONInt) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type JSONInt64 added in v0.1.1

type JSONInt64 int64

JSONInt64 handles JSON numbers that might be strings or numbers.

func (JSONInt64) Int64 added in v0.1.1

func (j JSONInt64) Int64() int64

Int64 returns the value as int64.

func (JSONInt64) MarshalJSON added in v0.1.1

func (j JSONInt64) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*JSONInt64) UnmarshalJSON added in v0.1.1

func (j *JSONInt64) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

type JSONUint64 added in v0.1.1

type JSONUint64 uint64

JSONUint64 handles JSON numbers that might be strings or numbers (unsigned).

func (JSONUint64) MarshalJSON added in v0.1.1

func (j JSONUint64) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (JSONUint64) Uint64 added in v0.1.1

func (j JSONUint64) Uint64() uint64

Uint64 returns the value as uint64.

func (*JSONUint64) UnmarshalJSON added in v0.1.1

func (j *JSONUint64) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

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.4

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