compactor

package
v3.3.16+incompatible Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2019 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package compactor implements automated policies for compacting etcd's mvcc storage.

Index

Constants

View Source
const (
	ModePeriodic = "periodic"
	ModeRevision = "revision"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Compactable

type Compactable interface {
	Compact(ctx context.Context, r *pb.CompactionRequest) (*pb.CompactionResponse, error)
}

type Compactor

type Compactor interface {
	// Run starts the main loop of the compactor in background.
	// Use Stop() to halt the loop and release the resource.
	Run()
	// Stop halts the main loop of the compactor.
	Stop()
	// Pause temporally suspend the compactor not to run compaction. Resume() to unpose.
	Pause()
	// Resume restarts the compactor suspended by Pause().
	Resume()
}

Compactor purges old log from the storage periodically.

func New

func New(mode string, retention time.Duration, rg RevGetter, c Compactable) (Compactor, error)

type Periodic

type Periodic struct {
	// contains filtered or unexported fields
}

Periodic compacts the log by purging revisions older than the configured retention time.

func NewPeriodic

func NewPeriodic(h time.Duration, rg RevGetter, c Compactable) *Periodic

NewPeriodic creates a new instance of Periodic compactor that purges the log older than h Duration.

func (*Periodic) Pause

func (t *Periodic) Pause()

Pause pauses periodic compactor.

func (*Periodic) Resume

func (t *Periodic) Resume()

Resume resumes periodic compactor.

func (*Periodic) Run

func (t *Periodic) Run()

Run runs periodic compactor.

func (*Periodic) Stop

func (t *Periodic) Stop()

Stop stops periodic compactor.

type RevGetter

type RevGetter interface {
	Rev() int64
}

type Revision

type Revision struct {
	// contains filtered or unexported fields
}

Revision compacts the log by purging revisions older than the configured reivison number. Compaction happens every 5 minutes.

func NewRevision

func NewRevision(retention int64, rg RevGetter, c Compactable) *Revision

NewRevision creates a new instance of Revisonal compactor that purges the log older than retention revisions from the current revision.

func (*Revision) Pause

func (t *Revision) Pause()

Pause pauses revision-based compactor.

func (*Revision) Resume

func (t *Revision) Resume()

Resume resumes revision-based compactor.

func (*Revision) Run

func (t *Revision) Run()

Run runs revision-based compactor.

func (*Revision) Stop

func (t *Revision) Stop()

Stop stops revision-based compactor.

Jump to

Keyboard shortcuts

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