prune

package
v0.0.0-...-92d349b Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultMode = Mode{
	Initialised: true,
	History:     Distance(math.MaxUint64),
	Receipts:    Distance(math.MaxUint64),
	TxIndex:     Distance(math.MaxUint64),
	CallTraces:  Distance(math.MaxUint64),
	Experiments: Experiments{},
}

Functions

func Override

func Override(db kv.RwTx, sm Mode) error

Types

type Before

type Before uint64

Before number after which keep in DB

func (Before) Enabled

func (b Before) Enabled() bool

func (Before) PruneTo

func (b Before) PruneTo(uint64) uint64

type BlockAmount

type BlockAmount interface {
	PruneTo(stageHead uint64) uint64
	Enabled() bool
	// contains filtered or unexported methods
}

type Distance

type Distance uint64

Distance amount of blocks to keep in DB but manual manipulation with such distance is very unsafe for example:

deleteUntil := currentStageProgress - pruningDistance

may delete whole db - because of uint64 underflow when pruningDistance > currentStageProgress

func (Distance) Enabled

func (p Distance) Enabled() bool

func (Distance) PruneTo

func (p Distance) PruneTo(stageHead uint64) uint64

type Experiments

type Experiments struct {
}

type Mode

type Mode struct {
	Initialised bool // Set when the values are initialised (not default)
	History     BlockAmount
	Receipts    BlockAmount
	TxIndex     BlockAmount
	CallTraces  BlockAmount
	Experiments Experiments
}

func EnsureNotChanged

func EnsureNotChanged(tx kv.GetPut, pruneMode Mode) (Mode, error)

EnsureNotChanged - prohibit change some configs after node creation. prohibit from human mistakes

func FromCli

func FromCli(chainId uint64, flags string, exactHistory, exactReceipts, exactTxIndex, exactCallTraces,
	beforeH, beforeR, beforeT, beforeC uint64, experiments []string) (Mode, error)

func Get

func Get(db kv.Getter) (Mode, error)

func (Mode) String

func (m Mode) String() string

Jump to

Keyboard shortcuts

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