Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrCompactionBusy = errors.New("database maintenance in progress")
Functions ¶
This section is empty.
Types ¶
type CompactOptions ¶ added in v0.34.0
type CompactOptions struct {
MinReclaimBytes int64
MinReclaimPercent int64
MinReclaimPercentFloor int64
// MinInterval also throttles failed attempts.
MinInterval time.Duration
// PauseTimeout bounds draining transactions. Zero selects the default.
PauseTimeout time.Duration
// CopyTimeout bounds copying independently of the drain. Zero uses the
// caller's context. Filesystem calls cannot be interrupted.
CopyTimeout time.Duration
// Progress receives phase changes without blocking maintenance. A full channel drops updates.
Progress chan<- string
}
CompactOptions controls when a database is compacted. The percentage floor applies even when the reclaimable byte threshold is met.
func (CompactOptions) MeetsReclaimThreshold ¶ added in v0.34.0
func (o CompactOptions) MeetsReclaimThreshold(size, reclaimable int64) bool
MeetsReclaimThreshold reports whether reclaimable space meets the percentage floor and at least one configured byte or percentage threshold.
type CompactResult ¶ added in v0.34.0
type CompactionStats ¶ added in v0.34.0
type CompactionStats struct {
Size int64
// Reclaimable includes pending pages, which become available after readers drain.
Reclaimable int64
}
func (CompactionStats) RequiredSpace ¶ added in v0.34.0
func (s CompactionStats) RequiredSpace() int64
RequiredSpace estimates the replacement file plus room for allocation overhead.
type Compactor ¶ added in v0.34.0
type Compactor interface {
// CompactionStats returns ErrCompactionBusy rather than waiting for maintenance.
CompactionStats() (CompactionStats, error)
Compact(ctx context.Context, opt CompactOptions) (CompactResult, error)
}
type DB ¶
type DB interface {
io.Closer
Transactor
}
Directories
¶
| Path | Synopsis |
|---|---|
|
Package compaction schedules database maintenance independently of the storage engine.
|
Package compaction schedules database maintenance independently of the storage engine. |
Click to show internal directories.
Click to hide internal directories.