Documentation
¶
Index ¶
- func Filename(network string, epoch int, lastBlockHash common.Hash) string
- func From(f era.ReadAtSeekCloser) (era.Era, error)
- func NewBuilder(w io.Writer) era.Builder
- func NewIterator(e era.Era) (era.Iterator, error)
- type Builder
- type Era
- func (e *Era) Accumulator() (common.Hash, error)
- func (e *Era) Close() error
- func (e *Era) Count() uint64
- func (e *Era) GetBlockByNumber(blockNum uint64) (*types.Block, error)
- func (e *Era) GetBody(num uint64) (*types.Body, error)
- func (e *Era) GetHeader(num uint64) (*types.Header, error)
- func (e *Era) GetRawBodyByNumber(blockNum uint64) ([]byte, error)
- func (e *Era) GetRawReceiptsByNumber(blockNum uint64) ([]byte, error)
- func (e *Era) GetTD(blockNum uint64) (*big.Int, error)
- func (e *Era) HasComponent(c componentType) bool
- func (e *Era) InitialTD() (*big.Int, error)
- func (e *Era) Iterator() (era.Iterator, error)
- func (e *Era) Start() uint64
- type Iterator
- func (it *Iterator) Block() (*types.Block, error)
- func (it *Iterator) BlockAndReceipts() (*types.Block, types.Receipts, error)
- func (it *Iterator) Error() error
- func (it *Iterator) Next() bool
- func (it *Iterator) Number() uint64
- func (it *Iterator) Receipts() (types.Receipts, error)
- func (it *Iterator) TotalDifficulty() (*big.Int, error)
- type RawIterator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Filename ¶
Filename returns a recognizable filename for an Ere file. The filename uses the last block hash to uniquely identify the epoch's content.
Files produced by this builder do not include Proof entries, so the "noproofs" profile postfix is appended per the Ere spec.
func NewBuilder ¶
NewBuilder returns a new Builder instance.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder is used to build an Ere e2store file. It collects block entries and writes them to the underlying e2store.Writer.
func (*Builder) Accumulator ¶
Accumulator returns the accumulator root after Finalize has been called. Returns nil for post-merge epochs where no accumulator exists.
func (*Builder) AddRLP ¶
func (b *Builder) AddRLP(header, body, receipts []byte, number uint64, blockHash common.Hash, td, difficulty *big.Int) error
AddRLP takes the RLP encoded block components and writes them to the underlying e2store file. The builder automatically handles transition epochs where both pre and post-merge blocks exist.
func (*Builder) Finalize ¶
Finalize writes all collected block entries to the e2store file. For pre-merge or transition epochs, the accumulator root is computed over pre-merge blocks and written. For pure post-merge epochs, no accumulator is written. Always returns the last block hash as the epoch identifier.
type Era ¶
type Era struct {
// contains filtered or unexported fields
}
Era object represents an era file that contains blocks and their components.
func (*Era) Accumulator ¶
Accumulator reads the accumulator entry if present. Only pre-merge and merge-transition Ere files contain one.
func (*Era) GetBlockByNumber ¶
GetBlockByNumber retrieves the block if present within the era file.
func (*Era) GetHeader ¶
GetHeader retrieves the header from the era file through the cached offset table.
func (*Era) GetRawBodyByNumber ¶
GetRawBodyByNumber returns the RLP-encoded body for the given block number.
func (*Era) GetRawReceiptsByNumber ¶
GetRawReceiptsByNumber returns the RLP-encoded receipts for the given block number.
func (*Era) HasComponent ¶ added in v1.17.4
HasComponent reports whether the given component is recorded in the file's index, as detected from the on-disk e2store type tags.
func (*Era) InitialTD ¶
InitialTD returns initial total difficulty before the difficulty of the first block of the Era is applied. Returns an error if TD is not available (e.g., post-merge epoch).
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
func (*Iterator) BlockAndReceipts ¶
BlockAndReceipts is a convenience wrapper.
func (*Iterator) Error ¶
Error returns any iteration error (EOF is reported as nil, identical to the Era‑1 iterator behaviour).
type RawIterator ¶
type RawIterator struct {
Header io.Reader
Body io.Reader
Receipts io.Reader
TotalDifficulty io.Reader // nil when archive omits TD
// contains filtered or unexported fields
}
func NewRawIterator ¶
func NewRawIterator(e *Era) (*RawIterator, error)
NewRawIterator creates an iterator positioned *before* the first block.
func (*RawIterator) Error ¶
func (it *RawIterator) Error() error
func (*RawIterator) Next ¶
func (it *RawIterator) Next() bool
Next loads the next block’s components; returns false on EOF or error.
func (*RawIterator) Number ¶
func (it *RawIterator) Number() uint64