pruner

package
v0.0.0-...-c69f244 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2022 License: LGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Full pruner mode.
	Full = Mode("full")
	// Archive pruner mode.
	Archive = Mode("archive")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ArchiveNode

type ArchiveNode struct{}

ArchiveNode is a no-op since we don't prune nodes in archive mode.

func (*ArchiveNode) StoreJournalRecord

func (a *ArchiveNode) StoreJournalRecord(_, _ map[common.Hash]struct{},
	_ common.Hash, _ int64) error

StoreJournalRecord for archive node doesn't do anything.

type Config

type Config struct {
	Mode           Mode
	RetainedBlocks int64
}

Config holds state trie pruning mode and retained blocks

type FullNode

type FullNode struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

FullNode stores state trie diff and allows online state trie pruning

func (*FullNode) StoreJournalRecord

func (p *FullNode) StoreJournalRecord(deletedHashesSet, insertedHashesSet map[common.Hash]struct{},
	blockHash common.Hash, blockNum int64) error

StoreJournalRecord stores journal record into DB and add deathRow into deathList

type Mode

type Mode string

Mode online pruning mode of historical state tries

func (Mode) IsValid

func (p Mode) IsValid() bool

IsValid checks whether the pruning mode is valid

type Pruner

type Pruner interface {
	StoreJournalRecord(deletedHashesSet, insertedHashesSet map[common.Hash]struct{},
		blockHash common.Hash, blockNum int64) error
}

Pruner is implemented by FullNode and ArchiveNode.

func NewFullNode

func NewFullNode(db, storageDB chaindb.Database, retainBlocks int64, l log.LeveledLogger) (Pruner, error)

NewFullNode creates a Pruner for full node.

Jump to

Keyboard shortcuts

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