storage

package
v0.0.0-...-d9a1657 Latest Latest
Warning

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

Go to latest
Published: May 5, 2023 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BucketNameBlocks    = "blocks"
	BucketNameNumberIdx = "numberIdx"
)
View Source
const (
	ErrIntegrityCheckFailed = errors.ConstError("integrity check has failed")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockIndex

type BlockIndex struct {
	Log       *zap.Logger
	Path      string
	Size      int
	ReOrgSize int
	ClientId  string
	Loader    func(number uint64) (*web3.BlockHeader, error)
	// contains filtered or unexported fields
}

func (*BlockIndex) CheckIntegrity

func (bi *BlockIndex) CheckIntegrity() (err error)

func (*BlockIndex) Close

func (bi *BlockIndex) Close() error

func (*BlockIndex) FillGaps

func (bi *BlockIndex) FillGaps(
	ctx context.Context,
	latestNumber uint64,
) error

func (*BlockIndex) ForEachBlock

func (bi *BlockIndex) ForEachBlock(fn func(block *web3.BlockHeader) error) error

func (*BlockIndex) Open

func (bi *BlockIndex) Open() error

func (*BlockIndex) Prune

func (bi *BlockIndex) Prune(callback func(block *web3.BlockHeader)) (size int, removed int, err error)

func (*BlockIndex) Put

func (bi *BlockIndex) Put(block *web3.BlockHeader) (latest uint64, err error)

func (*BlockIndex) Stats

func (bi *BlockIndex) Stats() (stats *BlockIndexStats, err error)

type BlockIndexStats

type BlockIndexStats struct {
	Size           int
	EarliestNumber uint64
	EarliestHash   string
	LatestNumber   uint64
	LatestHash     string
}

func (BlockIndexStats) String

func (b BlockIndexStats) String() string

Jump to

Keyboard shortcuts

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