store

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchWriteOption

type BatchWriteOption struct {
	WriteOption `mapstructure:",squash"`

	BatchSize    int           `default:"100"`
	BatchTimeout time.Duration `default:"3s"`
}

type BatchWriter

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

BatchWriter is used in poll-and-process model.

func NewBatchWriter

func NewBatchWriter(store Writable, option BatchWriteOption) *BatchWriter

func (*BatchWriter) OnCatchedUp

func (writer *BatchWriter) OnCatchedUp(ctx context.Context)

Process implements process.CatchUpProcessor[evm.BlockData] interface.

func (*BatchWriter) Process

func (writer *BatchWriter) Process(ctx context.Context, data evm.BlockData)

Process implements process.CatchUpProcessor[evm.BlockData] interface.

type Readable

type Readable interface {
	// block
	GetBlockNumber(bhon types.BlockHashOrNumber) (uint64, bool, error)
	GetBlock(bhon types.BlockHashOrNumber, isFull bool) (types.Lazy[*ethTypes.Block], error)
	GetBlockTransactionCount(bhon types.BlockHashOrNumber) (int64, error)

	// transaction
	GetTransactionByHash(txHash common.Hash) (*ethTypes.TransactionDetail, error)
	GetTransactionByIndex(bhon types.BlockHashOrNumber, txIndex uint32) (*ethTypes.TransactionDetail, error)

	// receipt
	GetTransactionReceipt(txHash common.Hash) (*ethTypes.Receipt, error)
	GetBlockReceipts(bhon types.BlockHashOrNumber) (types.Lazy[[]ethTypes.Receipt], error)

	// trace
	GetTrace(txHash common.Hash, index uint) (*ethTypes.LocalizedTrace, error)
	GetTransactionTraces(txHash common.Hash) ([]ethTypes.LocalizedTrace, error)
	GetBlockTraces(bhon types.BlockHashOrNumber) (types.Lazy[[]ethTypes.LocalizedTrace], error)
}

type Store

type Store interface {
	Writable
	Readable

	Close() error
}

type Writable

type Writable interface {
	NextBlockNumber() uint64
	Write(...evm.BlockData) error
}

type WriteOption

type WriteOption struct {
	RetryInterval time.Duration `default:"3s"`

	Health health.TimedCounterConfig
}

type Writer

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

Writer is used in poll-and-process model.

func NewWriter

func NewWriter(store Writable, option WriteOption) *Writer

func (*Writer) Process

func (writer *Writer) Process(ctx context.Context, data evm.BlockData)

Process implements process.Processor[evm.BlockData] interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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