prune

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

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func Override

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

Types

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
	Blocks      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, distanceHistory, distanceBlocks 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