freezeblocks

package
v3.0.0-alpha5.0...-c974331 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: LGPL-3.0 Imports: 58 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BlockCompressCfg = seg.Cfg{
	MinPatternScore: 1_000,
	MinPatternLen:   8,
	MaxPatternLen:   128,
	SamplingFactor:  4,
	MaxDictPatterns: 16 * 1024,

	DictReducerSoftLimit: 1_000_000,
	Workers:              1,
}
View Source
var ErrNothingToPrune = errors.New("nothing to prune")

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 DumpBlobSidecarsRange

func DumpBlobSidecarsRange(ctx context.Context, db kv.RoDB, storage blob_storage.BlobStorage, fromSlot uint64, toSlot uint64, salt uint32, dirs datadir.Dirs, workers int, blobCountFn BlobCountBySlotFn, 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, blobCountFn BlobCountBySlotFn, 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(dirs datadir.Dirs) error

func Segments

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

func SegmentsCaplin

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

func Sqeeze

func Sqeeze(ctx context.Context, dirs datadir.Dirs, from, to string, logger log.Logger) 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 BlobCountBySlotFn

type BlobCountBySlotFn func(slot uint64) (uint64, error)

type BlockReader

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

BlockReader can read blocks from db and snapshots

func NewBlockReader

func NewBlockReader(snapshots snapshotsync.BlockSnapshots, borSnapshots snapshotsync.BlockSnapshots, heimdallStore heimdall.Store, borBridge bridge.Store) *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, txCount uint32, err error)

func (*BlockReader) BodyRlp

func (r *BlockReader) BodyRlp(ctx context.Context, tx kv.Getter, hash common.Hash, blockHeight uint64) (bodyRlp rlp.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() snapshotsync.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) CanonicalBodyForStorage

func (r *BlockReader) CanonicalBodyForStorage(ctx context.Context, tx kv.Getter, blockNum uint64) (body *types.BodyForStorage, err error)

func (*BlockReader) CanonicalHash

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

func (*BlockReader) Checkpoint

func (r *BlockReader) Checkpoint(ctx context.Context, tx kv.Tx, checkpointId uint64) (*heimdall.Checkpoint, bool, 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.Tx, txnHash common.Hash) (uint64, bool, error)

func (*BlockReader) EventsByBlock

func (r *BlockReader) EventsByBlock(ctx context.Context, tx kv.Tx, hash common.Hash, blockHeight uint64) ([]rlp.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) HeaderNumber

func (r *BlockReader) HeaderNumber(ctx context.Context, tx kv.Getter, hash common.Hash) (*uint64, 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) IsCanonical

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

func (*BlockReader) IterateFrozenBodies

func (r *BlockReader) IterateFrozenBodies(f func(blockNum, baseTxNum, txCount 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(ctx context.Context, tx kv.Tx) (uint64, bool, error)

func (*BlockReader) LastFrozenCheckpointId

func (r *BlockReader) LastFrozenCheckpointId() uint64

func (*BlockReader) LastFrozenEventBlockNum

func (r *BlockReader) LastFrozenEventBlockNum() 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(ctx context.Context, tx kv.Tx) (uint64, bool, error)

func (*BlockReader) Milestone

func (r *BlockReader) Milestone(ctx context.Context, tx kv.Tx, milestoneId uint64) (*heimdall.Milestone, bool, 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) Ready

func (r *BlockReader) Ready(ctx context.Context) <-chan error

func (*BlockReader) Snapshots

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

func (*BlockReader) Span

func (r *BlockReader) Span(ctx context.Context, tx kv.Tx, spanId uint64) (*heimdall.Span, bool, 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.txCount

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,
	heimdallStore heimdall.Store,
	bridgeStore bridge.Store,
	chainConfig *chain.Config,
	config *ethconfig.Config,
	notifier services.DBEventNotifier,
	snBuildAllowed *semaphore.Weighted,
	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) GetWorkers

func (br *BlockRetire) GetWorkers() int

func (*BlockRetire) IO

func (*BlockRetire) PruneAncientBlocks

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

func (*BlockRetire) RetireBlocks

func (br *BlockRetire) RetireBlocks(ctx context.Context, requestedMinBlockNum uint64, requestedMaxBlockNum uint64, lvl log.Lvl, seedNewSnapshots func(downloadRequest []snapshotsync.DownloadRequest) error, onDeleteSnapshots func(l []string) error, onFinish func() error) error

func (*BlockRetire) RetireBlocksInBackground

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

func (*BlockRetire) SetWorkers

func (br *BlockRetire) SetWorkers(workers int)

func (*BlockRetire) Writer

func (br *BlockRetire) Writer() *RoSnapshots

type CaplinSnapshots

type CaplinSnapshots struct {
	Salt uint32
	// 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) LS

func (s *CaplinSnapshots) LS()

func (*CaplinSnapshots) LogStat

func (s *CaplinSnapshots) LogStat(str string)

func (*CaplinSnapshots) OpenFolder

func (s *CaplinSnapshots) OpenFolder() error

func (*CaplinSnapshots) OpenList

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

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

func (*CaplinSnapshots) ReadBlobSidecars

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

func (*CaplinSnapshots) ReadHeader

func (*CaplinSnapshots) SegFileNames

func (s *CaplinSnapshots) SegFileNames(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 {
	BeaconBlockRotx *snapshotsync.RoTx
	BlobSidecarRotx *snapshotsync.RoTx
	// contains filtered or unexported fields
}

func (*CaplinView) BeaconBlocks

func (v *CaplinView) BeaconBlocks() []*snapshotsync.VisibleSegment

func (*CaplinView) BeaconBlocksSegment

func (v *CaplinView) BeaconBlocksSegment(slot uint64) (*snapshotsync.VisibleSegment, bool)

func (*CaplinView) BlobSidecars

func (v *CaplinView) BlobSidecars() []*snapshotsync.VisibleSegment

func (*CaplinView) BlobSidecarsSegment

func (v *CaplinView) BlobSidecarsSegment(slot uint64) (*snapshotsync.VisibleSegment, bool)

func (*CaplinView) Close

func (v *CaplinView) Close()

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, txCount uint32, err error)

func (*RemoteBlockReader) BodyRlp

func (r *RemoteBlockReader) BodyRlp(ctx context.Context, tx kv.Getter, hash common.Hash, blockHeight uint64) (bodyRlp rlp.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() snapshotsync.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) CanonicalBodyForStorage

func (r *RemoteBlockReader) CanonicalBodyForStorage(ctx context.Context, tx kv.Getter, blockNum uint64) (body *types.BodyForStorage, err error)

func (*RemoteBlockReader) CanonicalHash

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

func (*RemoteBlockReader) Checkpoint

func (r *RemoteBlockReader) Checkpoint(ctx context.Context, tx kv.Tx, spanId uint64) (*heimdall.Checkpoint, bool, 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.Tx, borTxnHash common.Hash) (uint64, bool, error)

func (*RemoteBlockReader) EventsByBlock

func (r *RemoteBlockReader) EventsByBlock(ctx context.Context, tx kv.Tx, hash common.Hash, blockHeight uint64) ([]rlp.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) HeaderNumber

func (r *RemoteBlockReader) HeaderNumber(ctx context.Context, tx kv.Getter, hash common.Hash) (*uint64, 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) IsCanonical

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

func (*RemoteBlockReader) IterateFrozenBodies

func (r *RemoteBlockReader) IterateFrozenBodies(_ func(blockNum uint64, baseTxNum uint64, txCount 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) LastFrozenEventBlockNum

func (r *RemoteBlockReader) LastFrozenEventBlockNum() uint64

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.Tx, spanId uint64) (*heimdall.Milestone, bool, 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) Ready

func (r *RemoteBlockReader) Ready(ctx context.Context) <-chan error

func (*RemoteBlockReader) Snapshots

func (*RemoteBlockReader) Span

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 {
	snapshotsync.RoSnapshots
}

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) View

func (s *RoSnapshots) View() *View

type View

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

func (*View) Bodies

func (v *View) Bodies() []*snapshotsync.VisibleSegment

func (*View) BodiesSegment

func (v *View) BodiesSegment(blockNum uint64) (*snapshotsync.VisibleSegment, bool)

func (*View) Close

func (v *View) Close()

func (*View) Headers

func (v *View) Headers() []*snapshotsync.VisibleSegment

func (*View) HeadersSegment

func (v *View) HeadersSegment(blockNum uint64) (*snapshotsync.VisibleSegment, bool)

func (*View) Txs

func (v *View) Txs() []*snapshotsync.VisibleSegment

func (*View) TxsSegment

func (v *View) TxsSegment(blockNum uint64) (*snapshotsync.VisibleSegment, bool)

Jump to

Keyboard shortcuts

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