pruning

package
v2.0.0-beta.5 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AdditionalPruningThreshold is the additional threshold (to BMD), which is needed, because the blocks in the getMilestoneParents call in solidEntryPoints
	// can reference older blocks as well
	AdditionalPruningThreshold = 5
)

Variables

View Source
var (
	ErrNotEnoughHistory                                        = errors.New("not enough history")
	ErrNoPruningNeeded                                         = errors.New("no pruning needed")
	ErrPruningAborted                                          = errors.New("pruning was aborted")
	ErrDatabaseCompactionNotSupported                          = errors.New("database compaction not supported")
	ErrDatabaseCompactionRunning                               = errors.New("database compaction is running")
	ErrExistingDeltaSnapshotWrongFullSnapshotTargetMilestoneID = errors.New("existing delta ledger snapshot has wrong full snapshot target milestone ID")
)

Functions

func PruningMetricsCaller

func PruningMetricsCaller(handler interface{}, params ...interface{})

PruningMetricsCaller is used to signal updated pruning metrics.

Types

type Events

type Events struct {
	PruningMilestoneIndexChanged *events.Event
	PruningMetricsUpdated        *events.Event
}

type Manager

type Manager struct {
	// the logger used to log events.
	*logger.WrappedLogger

	Events *Events
	// contains filtered or unexported fields
}

Manager handles pruning of the database.

func NewPruningManager

func NewPruningManager(
	log *logger.Logger,
	storage *storagepkg.Storage,
	syncManager *syncmanager.SyncManager,
	tangleDatabase *database.Database,
	utxoDatabase *database.Database,
	getMinimumTangleHistory getMinimumTangleHistoryFunc,
	pruningMilestonesEnabled bool,
	pruningMilestonesMaxMilestonesToKeep syncmanager.MilestoneIndexDelta,
	pruningSizeEnabled bool,
	pruningSizeTargetSizeBytes int64,
	pruningSizeThresholdPercentage float64,
	pruningSizeCooldownTime time.Duration,
	pruneReceipts bool) *Manager

NewPruningManager creates a new pruning manager instance.

func (*Manager) HandleNewConfirmedMilestoneEvent

func (p *Manager) HandleNewConfirmedMilestoneEvent(ctx context.Context, confirmedMilestoneIndex iotago.MilestoneIndex)

HandleNewConfirmedMilestoneEvent handles new confirmed milestone events which may trigger a snapshot creation.

func (*Manager) IsPruning

func (p *Manager) IsPruning() bool

func (*Manager) PruneDatabaseByDepth

func (p *Manager) PruneDatabaseByDepth(ctx context.Context, depth iotago.MilestoneIndex) (iotago.MilestoneIndex, error)

func (*Manager) PruneDatabaseBySize

func (p *Manager) PruneDatabaseBySize(ctx context.Context, targetSizeBytes int64) (iotago.MilestoneIndex, error)

func (*Manager) PruneDatabaseByTargetIndex

func (p *Manager) PruneDatabaseByTargetIndex(ctx context.Context, targetIndex iotago.MilestoneIndex) (iotago.MilestoneIndex, error)

type PruningMetrics

type PruningMetrics struct {
	DurationPruneUnreferencedBlocks      time.Duration
	DurationTraverseMilestoneCone        time.Duration
	DurationPruneMilestone               time.Duration
	DurationPruneBlocks                  time.Duration
	DurationSetSnapshotInfo              time.Duration
	DurationPruningMilestoneIndexChanged time.Duration
	DurationTotal                        time.Duration
}

PruningMetrics holds metrics about a database pruning run.

Jump to

Keyboard shortcuts

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