Version: v0.10.0 Latest Latest

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

Go to latest
Published: Jul 2, 2019 License: Apache-2.0 Imports: 12 Imported by: 0



package batchDeleter provides a wrapper around the db.Pruner to provide a way to get expired records at a given interval and delete them at a separate given interval.



View Source
const (
	DeletingQueueDepth = "deleting_queue_depth"


This section is empty.


func Metrics

func Metrics() []xmetrics.Metric


type BatchDeleter

type BatchDeleter struct {
	// contains filtered or unexported fields

BatchDeleter manages getting records that have expired and then deleting them.

func NewBatchDeleter

func NewBatchDeleter(config Config, logger log.Logger, metricsRegistry provider.Provider, pruner db.Pruner) (*BatchDeleter, error)

NewBatchDeleter creates a BatchDeleter with the given values, ensuring that the configuration and other values given are valid. If configuration values aren't valid, a default value is used.

func (*BatchDeleter) Start

func (d *BatchDeleter) Start()

Start starts the batcher, which includes a ticker for getting expired records at an interval and the workers that do the deleting.

func (*BatchDeleter) Stop

func (d *BatchDeleter) Stop()

Stop closes the internal queue and waits for the workers to finish processing what has already been added. This can block as it waits for everything to stop.

type Config

type Config struct {
	Shard          int
	MaxWorkers     int
	MaxBatchSize   int
	SetSize        int
	DeleteWaitTime time.Duration
	GetLimit       int
	GetWaitTime    time.Duration

Config holds the configuration values for a batch deleter.

type Measures

type Measures struct {
	DeletingQueue metrics.Gauge

func NewMeasures

func NewMeasures(p provider.Provider) *Measures

NewMeasures constructs a Measures given a go-kit metrics Provider

Jump to

Keyboard shortcuts

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