freezeblocks

package
v1.9.7-0...-3df01fa Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2025 License: GPL-3.0 Imports: 63 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrSpanNotFound = errors.New("span not found")

Functions

func BeaconSimpleIdx

func BeaconSimpleIdx(ctx context.Context, sn snaptype.FileInfo, salt uint32, tmpDir string, p *background.Progress, lvl log.Lvl, logger log.Logger) (err error)

func CanDeleteTo

func CanDeleteTo(curBlockNum uint64, blocksInSnapshots uint64) (blockTo uint64)

func CanRetire

func CanRetire(curBlockNum uint64, blocksInSnapshots uint64, snapType snaptype.Enum, chainConfig *chain.Config) (blockFrom, blockTo uint64, can bool)

func DumpBeaconBlocks

func DumpBeaconBlocks(ctx context.Context, db kv.RoDB, fromSlot, toSlot uint64, salt uint32, dirs datadir.Dirs, workers int, lvl log.Lvl, logger log.Logger) error

func DumpBlobsSidecar

func DumpBlobsSidecar(ctx context.Context, blobStorage blob_storage.BlobStorage, db kv.RoDB, fromSlot, toSlot uint64, salt uint32, dirs datadir.Dirs, compressWorkers int, lvl log.Lvl, logger log.Logger) error

func DumpBlocks

func DumpBlocks(ctx context.Context, blockFrom, blockTo uint64, chainConfig *chain.Config, tmpDir, snapDir string, chainDB kv.RoDB, workers int, lvl log.Lvl, logger log.Logger, blockReader services.FullBlockReader) error

func DumpBodies

func DumpBodies(ctx context.Context, db kv.RoDB, _ *chain.Config, blockFrom, blockTo uint64, firstTxNum firstKeyGetter, collect func([]byte) error, workers int, lvl log.Lvl, logger log.Logger) (uint64, error)

DumpBodies - [from, to)

func DumpHeaders

func DumpHeaders(ctx context.Context, db kv.RoDB, _ *chain.Config, blockFrom, blockTo uint64, _ firstKeyGetter, collect func([]byte) error, workers int, lvl log.Lvl, logger log.Logger) (uint64, error)

DumpHeaders - [from, to)

func DumpTxs

func DumpTxs(ctx context.Context, db kv.RoDB, chainConfig *chain.Config, blockFrom, blockTo uint64, _ firstKeyGetter, collect func([]byte) error, workers int, lvl log.Lvl, logger log.Logger) (lastTx uint64, err error)

DumpTxs - [from, to) Format: hash[0]_1byte + sender_address_2bytes + txnRlp

func ForEachHeader

func ForEachHeader(ctx context.Context, s *RoSnapshots, walker func(header *types.Header) error) error

func RemoveIncompatibleIndices

func RemoveIncompatibleIndices(snapsDir string) error

Types

type BeaconSnapshotReader

type BeaconSnapshotReader interface {
	// ReadBlock reads the block at the given slot.
	// If the block is not present, it returns nil.
	ReadBlockBySlot(ctx context.Context, tx kv.Tx, slot uint64) (*cltypes.SignedBeaconBlock, error)
	ReadBlockByRoot(ctx context.Context, tx kv.Tx, blockRoot libcommon.Hash) (*cltypes.SignedBeaconBlock, error)
	ReadHeaderByRoot(ctx context.Context, tx kv.Tx, blockRoot libcommon.Hash) (*cltypes.SignedBeaconBlockHeader, error)
	ReadBlindedBlockBySlot(ctx context.Context, tx kv.Tx, slot uint64) (*cltypes.SignedBlindedBeaconBlock, error)

	FrozenSlots() uint64
}

type BlockReader

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

BlockReader can read blocks from db and snapshots

func NewBlockReader

func NewBlockReader(snapshots services.BlockSnapshots, borSnapshots services.BlockSnapshots) *BlockReader

func (*BlockReader) AllTypes

func (r *BlockReader) AllTypes() []snaptype.Type

func (*BlockReader) BadHeaderNumber

func (r *BlockReader) BadHeaderNumber(ctx context.Context, tx kv.Getter, hash common.Hash) (blockHeight *uint64, err error)

func (*BlockReader) BlockByHash

func (r *BlockReader) BlockByHash(ctx context.Context, db kv.Tx, hash common.Hash) (*types.Block, error)

func (*BlockReader) BlockByNumber

func (r *BlockReader) BlockByNumber(ctx context.Context, db kv.Tx, number uint64) (*types.Block, error)

func (*BlockReader) BlockWithSenders

func (r *BlockReader) BlockWithSenders(ctx context.Context, tx kv.Getter, hash common.Hash, blockHeight uint64) (block *types.Block, senders []common.Address, err error)

func (*BlockReader) Body

func (r *BlockReader) Body(ctx context.Context, tx kv.Getter, hash common.Hash, blockHeight uint64) (body *types.Body, txAmount uint32, err error)

func (*BlockReader) BodyRlp

func (r *BlockReader) BodyRlp(ctx context.Context, tx kv.Getter, hash common.Hash, blockHeight uint64) (bodyRlp rlp2.RawValue, err error)

func (*BlockReader) BodyWithTransactions

func (r *BlockReader) BodyWithTransactions(ctx context.Context, tx kv.Getter, hash common.Hash, blockHeight uint64) (body *types.Body, err error)

func (*BlockReader) BorSnapshots

func (r *BlockReader) BorSnapshots() services.BlockSnapshots

func (*BlockReader) BorStartEventID

func (r *BlockReader) BorStartEventID(ctx context.Context, tx kv.Tx, hash common.Hash, blockHeight uint64) (uint64, error)

func (*BlockReader) CanPruneTo

func (r *BlockReader) CanPruneTo(currentBlockInDB uint64) uint64

func (*BlockReader) CanonicalHash

func (r *BlockReader) CanonicalHash(ctx context.Context, tx kv.Getter, blockHeight uint64) (h common.Hash, err error)

func (*BlockReader) Checkpoint

func (r *BlockReader) Checkpoint(ctx context.Context, tx kv.Getter, checkpointId uint64) ([]byte, error)

func (*BlockReader) CurrentBlock

func (r *BlockReader) CurrentBlock(db kv.Tx) (*types.Block, error)

func (*BlockReader) EventLookup

func (r *BlockReader) EventLookup(ctx context.Context, tx kv.Getter, txnHash common.Hash) (uint64, bool, error)

func (*BlockReader) EventsByBlock

func (r *BlockReader) EventsByBlock(ctx context.Context, tx kv.Tx, hash common.Hash, blockHeight uint64) ([]rlp2.RawValue, error)

func (*BlockReader) EventsByIdFromSnapshot

func (r *BlockReader) EventsByIdFromSnapshot(from uint64, to time.Time, limit int) ([]*heimdall.EventRecordWithTime, bool, error)

EventsByIdFromSnapshot returns the list of records limited by time, or the number of records along with a bool value to signify if the records were limited by time

func (*BlockReader) FirstTxnNumNotInSnapshots

func (r *BlockReader) FirstTxnNumNotInSnapshots() uint64

func (*BlockReader) FreezingCfg

func (r *BlockReader) FreezingCfg() ethconfig.BlocksFreezing

func (*BlockReader) FrozenBlocks

func (r *BlockReader) FrozenBlocks() uint64

func (*BlockReader) FrozenBorBlocks

func (r *BlockReader) FrozenBorBlocks() uint64

func (*BlockReader) FrozenFiles

func (r *BlockReader) FrozenFiles() []string

func (*BlockReader) HasSenders

func (r *BlockReader) HasSenders(ctx context.Context, tx kv.Getter, hash common.Hash, blockHeight uint64) (bool, error)

func (*BlockReader) Header

func (r *BlockReader) Header(ctx context.Context, tx kv.Getter, hash common.Hash, blockHeight uint64) (h *types.Header, err error)

func (*BlockReader) HeaderByHash

func (r *BlockReader) HeaderByHash(ctx context.Context, tx kv.Getter, hash common.Hash) (h *types.Header, err error)

HeaderByHash - will search header in all snapshots starting from recent

func (*BlockReader) HeaderByNumber

func (r *BlockReader) HeaderByNumber(ctx context.Context, tx kv.Getter, blockHeight uint64) (h *types.Header, err error)

func (*BlockReader) HeadersRange

func (r *BlockReader) HeadersRange(ctx context.Context, walker func(header *types.Header) error) error

func (*BlockReader) Integrity

func (r *BlockReader) Integrity(ctx context.Context) error

func (*BlockReader) IntegrityTxnID

func (r *BlockReader) IntegrityTxnID(failFast bool) error

func (*BlockReader) IterateFrozenBodies

func (r *BlockReader) IterateFrozenBodies(f func(blockNum, baseTxNum, txAmount uint64) error) error

func (*BlockReader) LastCheckpointId

func (r *BlockReader) LastCheckpointId(ctx context.Context, tx kv.Tx) (uint64, bool, error)

func (*BlockReader) LastEventId

func (r *BlockReader) LastEventId(_ context.Context, tx kv.Tx) (uint64, bool, error)

func (*BlockReader) LastFrozenCheckpointId

func (r *BlockReader) LastFrozenCheckpointId() uint64

func (*BlockReader) LastFrozenEventId

func (r *BlockReader) LastFrozenEventId() uint64

func (*BlockReader) LastFrozenSpanId

func (r *BlockReader) LastFrozenSpanId() uint64

func (*BlockReader) LastMilestoneId

func (r *BlockReader) LastMilestoneId(ctx context.Context, tx kv.Tx) (uint64, bool, error)

func (*BlockReader) LastSpanId

func (r *BlockReader) LastSpanId(_ context.Context, tx kv.Tx) (uint64, bool, error)

func (*BlockReader) Milestone

func (r *BlockReader) Milestone(ctx context.Context, tx kv.Getter, milestoneId uint64) ([]byte, error)

func (*BlockReader) RawTransactions

func (r *BlockReader) RawTransactions(ctx context.Context, tx kv.Getter, fromBlock, toBlock uint64) (txs [][]byte, err error)

func (*BlockReader) ReadAncestor

func (r *BlockReader) ReadAncestor(db kv.Getter, hash common.Hash, number, ancestor uint64, maxNonCanonical *uint64) (common.Hash, uint64)

func (*BlockReader) Snapshots

func (r *BlockReader) Snapshots() services.BlockSnapshots

func (*BlockReader) Span

func (r *BlockReader) Span(ctx context.Context, tx kv.Getter, spanId uint64) ([]byte, error)

func (*BlockReader) TxnByIdxInBlock

func (r *BlockReader) TxnByIdxInBlock(ctx context.Context, tx kv.Getter, blockNum uint64, txIdxInBlock int) (txn types.Transaction, err error)

TxnByIdxInBlock - doesn't include system-transactions in the begin/end of block return nil if 0 < i < body.TxAmount

func (*BlockReader) TxnLookup

func (r *BlockReader) TxnLookup(_ context.Context, tx kv.Getter, txnHash common.Hash) (uint64, bool, error)

TxnLookup - find blockNumber and txnID by txnHash

type BlockRetire

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

func NewBlockRetire

func NewBlockRetire(compressWorkers int, dirs datadir.Dirs, blockReader services.FullBlockReader, blockWriter *blockio.BlockWriter, db kv.RoDB, chainConfig *chain.Config, notifier services.DBEventNotifier, logger log.Logger) *BlockRetire

func (*BlockRetire) BuildMissedIndicesIfNeed

func (br *BlockRetire) BuildMissedIndicesIfNeed(ctx context.Context, logPrefix string, notifier services.DBEventNotifier, cc *chain.Config) error

func (*BlockRetire) HasNewFrozenFiles

func (br *BlockRetire) HasNewFrozenFiles() bool

func (*BlockRetire) IO

func (*BlockRetire) PruneAncientBlocks

func (br *BlockRetire) PruneAncientBlocks(tx kv.RwTx, limit int) error

func (*BlockRetire) RetireBlocks

func (br *BlockRetire) RetireBlocks(ctx context.Context, minBlockNum uint64, maxBlockNum uint64, lvl log.Lvl, seedNewSnapshots func(downloadRequest []services.DownloadRequest) error, onDeleteSnapshots func(l []string) error) error

func (*BlockRetire) RetireBlocksInBackground

func (br *BlockRetire) RetireBlocksInBackground(ctx context.Context, minBlockNum uint64, maxBlockNum uint64, lvl log.Lvl, seedNewSnapshots func(downloadRequest []services.DownloadRequest) error, onDeleteSnapshots func(l []string) error)

func (*BlockRetire) SetWorkers

func (br *BlockRetire) SetWorkers(workers int)

func (*BlockRetire) Writer

func (br *BlockRetire) Writer() *RoSnapshots

type BorRoSnapshots

type BorRoSnapshots struct {
	RoSnapshots
}

func NewBorRoSnapshots

func NewBorRoSnapshots(cfg ethconfig.BlocksFreezing, snapDir string, segmentsMin uint64, logger log.Logger) *BorRoSnapshots

NewBorRoSnapshots - opens all bor snapshots. But to simplify everything:

  • it opens snapshots only on App start and immutable after
  • all snapshots of given blocks range must exist - to make this blocks range available
  • gaps are not allowed
  • segment have [from:to] semantic

func (*BorRoSnapshots) Ranges

func (s *BorRoSnapshots) Ranges() []Range

func (*BorRoSnapshots) ReopenFolder

func (s *BorRoSnapshots) ReopenFolder() error

func (*BorRoSnapshots) View

func (s *BorRoSnapshots) View() *BorView

type BorView

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

func (*BorView) Checkpoints

func (v *BorView) Checkpoints() []*Segment

func (*BorView) Close

func (v *BorView) Close()

func (*BorView) Events

func (v *BorView) Events() []*Segment

func (*BorView) EventsSegment

func (v *BorView) EventsSegment(blockNum uint64) (*Segment, bool)

func (*BorView) Milestones

func (v *BorView) Milestones() []*Segment

func (*BorView) Spans

func (v *BorView) Spans() []*Segment

func (*BorView) SpansSegment

func (v *BorView) SpansSegment(blockNum uint64) (*Segment, bool)

type CaplinSnapshots

type CaplinSnapshots struct {
	Salt uint32

	BeaconBlocks *segments
	BlobSidecars *segments
	// contains filtered or unexported fields
}

func NewCaplinSnapshots

func NewCaplinSnapshots(cfg ethconfig.BlocksFreezing, beaconCfg *clparams.BeaconChainConfig, dirs datadir.Dirs, logger log.Logger) *CaplinSnapshots

NewCaplinSnapshots - opens all snapshots. But to simplify everything:

  • it opens snapshots only on App start and immutable after
  • all snapshots of given blocks range must exist - to make this blocks range available
  • gaps are not allowed
  • segment have [from:to) semantic

func (*CaplinSnapshots) BlocksAvailable

func (s *CaplinSnapshots) BlocksAvailable() uint64

func (*CaplinSnapshots) BuildMissingIndices

func (s *CaplinSnapshots) BuildMissingIndices(ctx context.Context, logger log.Logger) error

func (*CaplinSnapshots) Close

func (s *CaplinSnapshots) Close()

func (*CaplinSnapshots) FrozenBlobs

func (s *CaplinSnapshots) FrozenBlobs() uint64

func (*CaplinSnapshots) IndicesMax

func (s *CaplinSnapshots) IndicesMax() uint64

func (*CaplinSnapshots) ReadBlobSidecars

func (s *CaplinSnapshots) ReadBlobSidecars(slot uint64) ([]*cltypes.BlobSidecar, error)

func (*CaplinSnapshots) ReadHeader

func (*CaplinSnapshots) ReopenFolder

func (s *CaplinSnapshots) ReopenFolder() error

func (*CaplinSnapshots) ReopenList

func (s *CaplinSnapshots) ReopenList(fileNames []string, optimistic bool) error

ReopenList stops on optimistic=false, continue opening files on optimistic=true

func (*CaplinSnapshots) SegFilePaths

func (s *CaplinSnapshots) SegFilePaths(from, to uint64) []string

func (*CaplinSnapshots) SegmentsMax

func (s *CaplinSnapshots) SegmentsMax() uint64

func (*CaplinSnapshots) View

func (s *CaplinSnapshots) View() *CaplinView

type CaplinView

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

func (*CaplinView) BeaconBlocks

func (v *CaplinView) BeaconBlocks() []*Segment

func (*CaplinView) BeaconBlocksSegment

func (v *CaplinView) BeaconBlocksSegment(slot uint64) (*Segment, bool)

func (*CaplinView) BlobSidecars

func (v *CaplinView) BlobSidecars() []*Segment

func (*CaplinView) BlobSidecarsSegment

func (v *CaplinView) BlobSidecarsSegment(slot uint64) (*Segment, bool)

func (*CaplinView) Close

func (v *CaplinView) Close()

type Merger

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

func NewMerger

func NewMerger(tmpDir string, compressWorkers int, lvl log.Lvl, chainDB kv.RoDB, chainConfig *chain.Config, logger log.Logger) *Merger

func (*Merger) DisableFsync

func (m *Merger) DisableFsync()

func (*Merger) FindMergeRanges

func (m *Merger) FindMergeRanges(currentRanges []Range, maxBlockNum uint64) (toMerge []Range)

func (*Merger) Merge

func (m *Merger) Merge(ctx context.Context, snapshots *RoSnapshots, snapTypes []snaptype.Type, mergeRanges []Range, snapDir string, doIndex bool, onMerge func(r Range) error, onDelete func(l []string) error) error

Merge does merge segments in given ranges

type Range

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

func Segments

func Segments(dir string, minBlock uint64) (res []snaptype.FileInfo, missingSnapshots []Range, err error)

func SegmentsCaplin

func SegmentsCaplin(dir string, minBlock uint64) (res []snaptype.FileInfo, missingSnapshots []Range, err error)

func (Range) From

func (r Range) From() uint64

func (Range) To

func (r Range) To() uint64

type Ranges

type Ranges []Range

func (Ranges) String

func (r Ranges) String() string

type RemoteBlockReader

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

func NewRemoteBlockReader

func NewRemoteBlockReader(client remote.ETHBACKENDClient) *RemoteBlockReader

func (*RemoteBlockReader) AllTypes

func (r *RemoteBlockReader) AllTypes() []snaptype.Type

func (*RemoteBlockReader) BadHeaderNumber

func (r *RemoteBlockReader) BadHeaderNumber(ctx context.Context, tx kv.Getter, hash common.Hash) (blockHeight *uint64, err error)

func (*RemoteBlockReader) BlockByHash

func (r *RemoteBlockReader) BlockByHash(ctx context.Context, db kv.Tx, hash common.Hash) (*types.Block, error)

func (*RemoteBlockReader) BlockByNumber

func (r *RemoteBlockReader) BlockByNumber(ctx context.Context, db kv.Tx, number uint64) (*types.Block, error)

func (*RemoteBlockReader) BlockWithSenders

func (r *RemoteBlockReader) BlockWithSenders(ctx context.Context, _ kv.Getter, hash common.Hash, blockHeight uint64) (block *types.Block, senders []common.Address, err error)

func (*RemoteBlockReader) Body

func (r *RemoteBlockReader) Body(ctx context.Context, tx kv.Getter, hash common.Hash, blockHeight uint64) (body *types.Body, txAmount uint32, err error)

func (*RemoteBlockReader) BodyRlp

func (r *RemoteBlockReader) BodyRlp(ctx context.Context, tx kv.Getter, hash common.Hash, blockHeight uint64) (bodyRlp rlp2.RawValue, err error)

func (*RemoteBlockReader) BodyWithTransactions

func (r *RemoteBlockReader) BodyWithTransactions(ctx context.Context, tx kv.Getter, hash common.Hash, blockHeight uint64) (body *types.Body, err error)

func (*RemoteBlockReader) BorSnapshots

func (r *RemoteBlockReader) BorSnapshots() services.BlockSnapshots

func (*RemoteBlockReader) BorStartEventID

func (r *RemoteBlockReader) BorStartEventID(ctx context.Context, tx kv.Tx, hash common.Hash, blockHeight uint64) (uint64, error)

func (*RemoteBlockReader) CanPruneTo

func (r *RemoteBlockReader) CanPruneTo(uint64) uint64

func (*RemoteBlockReader) CanonicalHash

func (r *RemoteBlockReader) CanonicalHash(ctx context.Context, tx kv.Getter, blockHeight uint64) (common.Hash, error)

func (*RemoteBlockReader) Checkpoint

func (r *RemoteBlockReader) Checkpoint(ctx context.Context, tx kv.Getter, spanId uint64) ([]byte, error)

func (*RemoteBlockReader) CurrentBlock

func (r *RemoteBlockReader) CurrentBlock(db kv.Tx) (*types.Block, error)

func (*RemoteBlockReader) EventLookup

func (r *RemoteBlockReader) EventLookup(ctx context.Context, tx kv.Getter, txnHash common.Hash) (uint64, bool, error)

func (*RemoteBlockReader) EventsByBlock

func (r *RemoteBlockReader) EventsByBlock(ctx context.Context, tx kv.Tx, hash common.Hash, blockHeight uint64) ([]rlp2.RawValue, error)

func (*RemoteBlockReader) FirstTxnNumNotInSnapshots

func (r *RemoteBlockReader) FirstTxnNumNotInSnapshots() uint64

func (*RemoteBlockReader) FreezingCfg

func (r *RemoteBlockReader) FreezingCfg() ethconfig.BlocksFreezing

func (*RemoteBlockReader) FrozenBlocks

func (r *RemoteBlockReader) FrozenBlocks() uint64

func (*RemoteBlockReader) FrozenBorBlocks

func (r *RemoteBlockReader) FrozenBorBlocks() uint64

func (*RemoteBlockReader) FrozenFiles

func (r *RemoteBlockReader) FrozenFiles() (list []string)

func (*RemoteBlockReader) HasSenders

func (r *RemoteBlockReader) HasSenders(ctx context.Context, _ kv.Getter, hash common.Hash, blockHeight uint64) (bool, error)

func (*RemoteBlockReader) Header

func (r *RemoteBlockReader) Header(ctx context.Context, tx kv.Getter, hash common.Hash, blockHeight uint64) (*types.Header, error)

func (*RemoteBlockReader) HeaderByHash

func (r *RemoteBlockReader) HeaderByHash(ctx context.Context, tx kv.Getter, hash common.Hash) (*types.Header, error)

func (*RemoteBlockReader) HeaderByNumber

func (r *RemoteBlockReader) HeaderByNumber(ctx context.Context, tx kv.Getter, blockHeight uint64) (*types.Header, error)

func (*RemoteBlockReader) HeadersRange

func (r *RemoteBlockReader) HeadersRange(ctx context.Context, walker func(header *types.Header) error) error

func (*RemoteBlockReader) Integrity

func (r *RemoteBlockReader) Integrity(_ context.Context) error

func (*RemoteBlockReader) IterateFrozenBodies

func (r *RemoteBlockReader) IterateFrozenBodies(_ func(blockNum uint64, baseTxNum uint64, txAmount uint64) error) error

func (*RemoteBlockReader) LastCheckpointId

func (r *RemoteBlockReader) LastCheckpointId(ctx context.Context, tx kv.Tx) (uint64, bool, error)

func (*RemoteBlockReader) LastEventId

func (r *RemoteBlockReader) LastEventId(ctx context.Context, tx kv.Tx) (uint64, bool, error)

func (*RemoteBlockReader) LastFrozenEventId

func (r *RemoteBlockReader) LastFrozenEventId() uint64

func (*RemoteBlockReader) LastFrozenSpanId

func (r *RemoteBlockReader) LastFrozenSpanId() uint64

func (*RemoteBlockReader) LastMilestoneId

func (r *RemoteBlockReader) LastMilestoneId(ctx context.Context, tx kv.Tx) (uint64, bool, error)

func (*RemoteBlockReader) LastSpanId

func (r *RemoteBlockReader) LastSpanId(_ context.Context, _ kv.Tx) (uint64, bool, error)

func (*RemoteBlockReader) Milestone

func (r *RemoteBlockReader) Milestone(ctx context.Context, tx kv.Getter, spanId uint64) ([]byte, error)

func (*RemoteBlockReader) RawTransactions

func (r *RemoteBlockReader) RawTransactions(ctx context.Context, tx kv.Getter, fromBlock, toBlock uint64) (txs [][]byte, err error)

func (*RemoteBlockReader) ReadAncestor

func (r *RemoteBlockReader) ReadAncestor(db kv.Getter, hash common.Hash, number, ancestor uint64, maxNonCanonical *uint64) (common.Hash, uint64)

func (*RemoteBlockReader) Snapshots

func (r *RemoteBlockReader) Snapshots() services.BlockSnapshots

func (*RemoteBlockReader) Span

func (r *RemoteBlockReader) Span(_ context.Context, _ kv.Getter, _ uint64) ([]byte, error)

func (*RemoteBlockReader) TxnByIdxInBlock

func (r *RemoteBlockReader) TxnByIdxInBlock(ctx context.Context, tx kv.Getter, blockNum uint64, i int) (txn types.Transaction, err error)

func (*RemoteBlockReader) TxnLookup

func (r *RemoteBlockReader) TxnLookup(ctx context.Context, tx kv.Getter, txnHash common.Hash) (uint64, bool, error)

type RoSnapshots

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

func NewRoSnapshots

func NewRoSnapshots(cfg ethconfig.BlocksFreezing, snapDir string, segmentsMin uint64, logger log.Logger) *RoSnapshots

NewRoSnapshots - opens all snapshots. But to simplify everything:

  • it opens snapshots only on App start and immutable after
  • all snapshots of given blocks range must exist - to make this blocks range available
  • gaps are not allowed
  • segment have [from:to) semantic

func (*RoSnapshots) AddSnapshotsToSilkworm

func (s *RoSnapshots) AddSnapshotsToSilkworm(silkwormInstance *silkworm.Silkworm) error

func (*RoSnapshots) BlocksAvailable

func (s *RoSnapshots) BlocksAvailable() uint64

func (*RoSnapshots) Cfg

func (*RoSnapshots) Close

func (s *RoSnapshots) Close()

func (*RoSnapshots) Dir

func (s *RoSnapshots) Dir() string

func (*RoSnapshots) DisableReadAhead

func (s *RoSnapshots) DisableReadAhead() *RoSnapshots

DisableReadAhead - usage: `defer d.EnableReadAhead().DisableReadAhead()`. Please don't use this funcs without `defer` to avoid leak.

func (*RoSnapshots) EnableMadvNormal

func (s *RoSnapshots) EnableMadvNormal() *RoSnapshots

func (*RoSnapshots) EnableMadvWillNeed

func (s *RoSnapshots) EnableMadvWillNeed() *RoSnapshots

func (*RoSnapshots) EnableReadAhead

func (s *RoSnapshots) EnableReadAhead() *RoSnapshots

func (*RoSnapshots) EnsureExpectedBlocksAreAvailable

func (s *RoSnapshots) EnsureExpectedBlocksAreAvailable(cfg *snapcfg.Cfg) error

func (*RoSnapshots) Files

func (s *RoSnapshots) Files() (list []string)

func (*RoSnapshots) HasType

func (s *RoSnapshots) HasType(in snaptype.Type) bool

func (*RoSnapshots) IndicesMax

func (s *RoSnapshots) IndicesMax() uint64

func (*RoSnapshots) IndicesReady

func (s *RoSnapshots) IndicesReady() bool

func (*RoSnapshots) InitSegments

func (s *RoSnapshots) InitSegments(fileNames []string) error

func (*RoSnapshots) LogStat

func (s *RoSnapshots) LogStat(label string)

func (*RoSnapshots) OpenFiles

func (s *RoSnapshots) OpenFiles() (list []string)

func (*RoSnapshots) OptimisticReopenWithDB

func (s *RoSnapshots) OptimisticReopenWithDB(db kv.RoDB)

OptimisticReopenWithDB - optimistically open snapshots (ignoring error), useful at App startup because: - user must be able: delete any snapshot file and Erigon will self-heal by re-downloading - RPC return Nil for historical blocks if snapshots are not open

func (*RoSnapshots) OptimisticalyReopenFolder

func (s *RoSnapshots) OptimisticalyReopenFolder()

func (*RoSnapshots) OptimisticalyReopenWithDB

func (s *RoSnapshots) OptimisticalyReopenWithDB(db kv.RoDB)

func (*RoSnapshots) PrintDebug

func (s *RoSnapshots) PrintDebug()

func (*RoSnapshots) Ranges

func (s *RoSnapshots) Ranges() []Range

func (*RoSnapshots) ReopenFolder

func (s *RoSnapshots) ReopenFolder() error

func (*RoSnapshots) ReopenList

func (s *RoSnapshots) ReopenList(fileNames []string, optimistic bool) error

ReopenList stops on optimistic=false, continue opening files on optimistic=true

func (*RoSnapshots) ReopenSegments

func (s *RoSnapshots) ReopenSegments(types []snaptype.Type, allowGaps bool) error

func (*RoSnapshots) ReopenWithDB

func (s *RoSnapshots) ReopenWithDB(db kv.RoDB) error

func (*RoSnapshots) SegmentsMax

func (s *RoSnapshots) SegmentsMax() uint64

func (*RoSnapshots) SegmentsMin

func (s *RoSnapshots) SegmentsMin() uint64

func (*RoSnapshots) SegmentsReady

func (s *RoSnapshots) SegmentsReady() bool

func (*RoSnapshots) SetSegmentsMin

func (s *RoSnapshots) SetSegmentsMin(min uint64)

func (*RoSnapshots) Types

func (s *RoSnapshots) Types() []snaptype.Type

func (*RoSnapshots) View

func (s *RoSnapshots) View() *View

ViewSingleFile - RLock files of all types

func (*RoSnapshots) ViewSingleFile

func (s *RoSnapshots) ViewSingleFile(t snaptype.Type, blockNum uint64) (segment *Segment, ok bool, release func())

ViewSingleFile - RLock all files of given type if has file with `blockNum`

func (*RoSnapshots) ViewType

func (s *RoSnapshots) ViewType(t snaptype.Type) (segments []*Segment, release func())

ViewSingleFile - RLock all files of given type

type Segment

type Segment struct {
	Range
	*seg.Decompressor
	// contains filtered or unexported fields
}

func (Segment) FileInfo

func (s Segment) FileInfo(dir string) snaptype.FileInfo

func (Segment) FileName

func (s Segment) FileName() string

func (Segment) Index

func (s Segment) Index(index ...snaptype.Index) *recsplit.Index

func (Segment) IsIndexed

func (s Segment) IsIndexed() bool

func (Segment) Type

func (s Segment) Type() snaptype.Type

func (Segment) Version

func (s Segment) Version() snaptype.Version

type View

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

func (*View) Bodies

func (v *View) Bodies() []*Segment

func (*View) BodiesSegment

func (v *View) BodiesSegment(blockNum uint64) (*Segment, bool)

func (*View) Close

func (v *View) Close()

func (*View) Headers

func (v *View) Headers() []*Segment

func (*View) HeadersSegment

func (v *View) HeadersSegment(blockNum uint64) (*Segment, bool)

func (*View) Ranges

func (v *View) Ranges() (ranges []Range)

func (*View) Segment

func (v *View) Segment(t snaptype.Type, blockNum uint64) (*Segment, bool)

func (*View) Segments

func (v *View) Segments(t snaptype.Type) []*Segment

func (*View) Txs

func (v *View) Txs() []*Segment

func (*View) TxsSegment

func (v *View) TxsSegment(blockNum uint64) (*Segment, bool)

Jump to

Keyboard shortcuts

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