Documentation ¶
Index ¶
- type Manager
- func (m *Manager) GetFlushAndResetPruningHeights() ([]int64, error)
- func (m *Manager) GetOptions() types.PruningOptions
- func (m *Manager) HandleHeight(previousHeight int64) int64
- func (m *Manager) HandleHeightSnapshot(height int64)
- func (m *Manager) LoadPruningHeights(db dbm.DB) error
- func (m *Manager) SetOptions(opts types.PruningOptions)
- func (m *Manager) SetSnapshotInterval(snapshotInterval uint64)
- func (m *Manager) ShouldPruneAtHeight(height int64) bool
- type NegativeHeightsError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is an abstraction to handle the logic needed for determinging when to prune old heights of the store based on the strategy described by the pruning options.
func NewManager ¶
NewManager returns a new Manager with the given db and logger. The retuned manager uses a pruning strategy of "nothing" which keeps all heights. Users of the Manager may change the strategy by calling SetOptions.
func (*Manager) GetFlushAndResetPruningHeights ¶
GetFlushAndResetPruningHeights returns all heights to be pruned during the next call to Prune(). It also flushes and resets the pruning heights.
func (*Manager) GetOptions ¶
func (m *Manager) GetOptions() types.PruningOptions
GetOptions fetches the pruning strategy from the manager.
func (*Manager) HandleHeight ¶
HandleHeight determines if previousHeight height needs to be kept for pruning at the right interval prescribed by the pruning strategy. Returns previousHeight, if it was kept to be pruned at the next call to Prune(), 0 otherwise. previousHeight must be greater than 0 for the handling to take effect since valid heights start at 1 and 0 represents the latest height. The latest height cannot be pruned. As a result, if previousHeight is less than or equal to 0, 0 is returned.
func (*Manager) HandleHeightSnapshot ¶
HandleHeightSnapshot persists the snapshot height to be pruned at the next appropriate height defined by the pruning strategy. Flushes the update to disk and panics if the flush fails The input height must be greater than 0 and pruning strategy any but pruning nothing. If one of these conditions is not met, this function does nothing.
func (*Manager) LoadPruningHeights ¶
LoadPruningHeights loads the pruning heights from the database as a crash recovery.
func (*Manager) SetOptions ¶
func (m *Manager) SetOptions(opts types.PruningOptions)
SetOptions sets the pruning strategy on the manager.
func (*Manager) SetSnapshotInterval ¶
SetSnapshotInterval sets the interval at which the snapshots are taken.
func (*Manager) ShouldPruneAtHeight ¶
ShouldPruneAtHeight return true if the given height should be pruned, false otherwise
type NegativeHeightsError ¶
type NegativeHeightsError struct {
Height int64
}
NegativeHeightsError is returned when a negative height is provided to the manager.
func (*NegativeHeightsError) Error ¶
func (e *NegativeHeightsError) Error() string