services

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: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type All

type All struct {
	BlockReader FullBlockReader
}

type BlockAndTxnReader

type BlockAndTxnReader interface {
	BlockReader
	TxnReader
}

type BlockReader

type BlockReader interface {
	BlockByNumber(ctx context.Context, db kv.Tx, number uint64) (*types.Block, error)
	BlockByHash(ctx context.Context, db kv.Tx, hash common.Hash) (*types.Block, error)
	CurrentBlock(db kv.Tx) (*types.Block, error)
	BlockWithSenders(ctx context.Context, tx kv.Getter, hash common.Hash, blockNum uint64) (block *types.Block, senders []common.Address, err error)
	IterateFrozenBodies(f func(blockNum, baseTxNum, txCount uint64) error) error
}

type BlockRetire

type BlockRetire interface {
	PruneAncientBlocks(tx kv.RwTx, limit int) (deleted int, err error)
	RetireBlocksInBackground(ctx context.Context, miBlockNum uint64, maxBlockNum uint64, lvl log.Lvl, seedNewSnapshots func(downloadRequest []snapshotsync.DownloadRequest) error, onDelete func(l []string) error, onFinishRetire func() error)
	BuildMissedIndicesIfNeed(ctx context.Context, logPrefix string, notifier DBEventNotifier, cc *chain.Config) error
	SetWorkers(workers int)
	GetWorkers() int
}

BlockRetire - freezing blocks: moving old data from DB to snapshot files

type BodyReader

type BodyReader interface {
	BodyWithTransactions(ctx context.Context, tx kv.Getter, hash common.Hash, blockNum uint64) (body *types.Body, err error)
	BodyRlp(ctx context.Context, tx kv.Getter, hash common.Hash, blockNum uint64) (bodyRlp rlp.RawValue, err error)
	Body(ctx context.Context, tx kv.Getter, hash common.Hash, blockNum uint64) (body *types.Body, txCount uint32, err error)
	CanonicalBodyForStorage(ctx context.Context, tx kv.Getter, blockNum uint64) (body *types.BodyForStorage, err error)
	HasSenders(ctx context.Context, tx kv.Getter, hash common.Hash, blockNum uint64) (bool, error)
}

type BorCheckpointReader

type BorCheckpointReader interface {
	LastCheckpointId(ctx context.Context, tx kv.Tx) (uint64, bool, error)
	Checkpoint(ctx context.Context, tx kv.Tx, checkpointId uint64) (*heimdall.Checkpoint, bool, error)
}

type BorEventReader

type BorEventReader interface {
	LastEventId(ctx context.Context, tx kv.Tx) (uint64, bool, error)
	EventLookup(ctx context.Context, tx kv.Tx, txnHash common.Hash) (uint64, bool, error)
	EventsByBlock(ctx context.Context, tx kv.Tx, hash common.Hash, blockNum uint64) ([]rlp.RawValue, error)
	BorStartEventId(ctx context.Context, tx kv.Tx, hash common.Hash, blockNum uint64) (uint64, error)
	LastFrozenEventId() uint64
	LastFrozenEventBlockNum() uint64
}

type BorMilestoneReader

type BorMilestoneReader interface {
	LastMilestoneId(ctx context.Context, tx kv.Tx) (uint64, bool, error)
	Milestone(ctx context.Context, tx kv.Tx, milestoneId uint64) (*heimdall.Milestone, bool, error)
}

type BorSpanReader

type BorSpanReader interface {
	Span(ctx context.Context, tx kv.Tx, spanId uint64) (*heimdall.Span, bool, error)
	LastSpanId(ctx context.Context, tx kv.Tx) (uint64, bool, error)
	LastFrozenSpanId() uint64
}

type CanonicalReader

type CanonicalReader interface {
	CanonicalHash(ctx context.Context, tx kv.Getter, blockNum uint64) (h common.Hash, ok bool, err error)
	IsCanonical(ctx context.Context, tx kv.Getter, hash common.Hash, blockNum uint64) (bool, error)
	BadHeaderNumber(ctx context.Context, tx kv.Getter, hash common.Hash) (blockHeight *uint64, err error)
}

type DBEventNotifier

type DBEventNotifier interface {
	OnNewSnapshot()
}

type FullBlockReader

type FullBlockReader interface {
	BlockReader
	BodyReader
	HeaderReader
	BorEventReader
	BorSpanReader
	BorMilestoneReader
	BorCheckpointReader
	TxnReader
	CanonicalReader

	FrozenBlocks() uint64
	FrozenBorBlocks() uint64
	FrozenFiles() (list []string)
	FreezingCfg() ethconfig.BlocksFreezing
	CanPruneTo(currentBlockInDB uint64) (canPruneBlocksTo uint64)

	Snapshots() snapshotsync.BlockSnapshots
	BorSnapshots() snapshotsync.BlockSnapshots

	Ready(ctx context.Context) <-chan error

	AllTypes() []snaptype.Type
}

type HeaderAndCanonicalReader

type HeaderAndCanonicalReader interface {
	HeaderReader
	CanonicalReader
}

type HeaderReader

type HeaderReader interface {
	Header(ctx context.Context, tx kv.Getter, hash common.Hash, blockNum uint64) (*types.Header, error)
	HeaderByNumber(ctx context.Context, tx kv.Getter, blockNum uint64) (*types.Header, error)
	HeaderNumber(ctx context.Context, tx kv.Getter, hash common.Hash) (*uint64, error)
	HeaderByHash(ctx context.Context, tx kv.Getter, hash common.Hash) (*types.Header, error)
	ReadAncestor(db kv.Getter, hash common.Hash, number, ancestor uint64, maxNonCanonical *uint64) (common.Hash, uint64)

	// HeadersRange - TODO: change it to `stream`
	HeadersRange(ctx context.Context, walker func(header *types.Header) error) error
	Integrity(ctx context.Context) error
}

type Range

type Range struct {
	From, To uint64
}

type TxnReader

type TxnReader interface {
	TxnLookup(ctx context.Context, tx kv.Getter, txnHash common.Hash) (uint64, bool, error)
	TxnByIdxInBlock(ctx context.Context, tx kv.Getter, blockNum uint64, i int) (txn types.Transaction, err error)
	RawTransactions(ctx context.Context, tx kv.Getter, fromBlock, toBlock uint64) (txs [][]byte, err error)
	FirstTxnNumNotInSnapshots() uint64
}

Jump to

Keyboard shortcuts

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