raftwallogdb

package
v1.19.2 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package raftwallogdb implements LogsDB on top of hashicorp/raft-wal.

Each sealed block (block-record + all of its logs) is a single raft-wal entry. Entry index = block.Number + 1 (offset by 1 because raft-wal reserves index 0). StoreLog fsyncs the entry to disk before returning, so SealBlock is durable on return. AddLog buffers in memory and the entry is built on SealBlock — atomicity is therefore guaranteed by the single StoreLog call.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

func Open

func Open(dir string, chainID eth.ChainID) (*DB, error)

Open opens or creates a raft-wal-backed LogsDB at dir.

func (*DB) AddLog

func (d *DB) AddLog(logHash common.Hash, parentBlock eth.BlockID, logIdx uint32, execMsg *messages.ExecutingMessage) error

func (*DB) Clear

func (d *DB) Clear() error

func (*DB) Close

func (d *DB) Close() error

func (*DB) Contains

func (d *DB) Contains(query messages.ContainsQuery) (messages.BlockSeal, error)

func (*DB) FindSealedBlock

func (d *DB) FindSealedBlock(number uint64) (messages.BlockSeal, error)

func (*DB) FirstSealedBlock

func (d *DB) FirstSealedBlock() (messages.BlockSeal, error)

func (*DB) LatestSealedBlock

func (d *DB) LatestSealedBlock() (eth.BlockID, bool)

func (*DB) OpenBlock

func (d *DB) OpenBlock(blockNum uint64) (eth.BlockRef, uint32, map[uint32]*messages.ExecutingMessage, error)

func (*DB) Rewind

func (d *DB) Rewind(newHead eth.BlockID) error

func (*DB) SealBlock

func (d *DB) SealBlock(parentHash common.Hash, block eth.BlockID, timestamp uint64) error

Jump to

Keyboard shortcuts

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