prune

package
v0.1.0-alpha4 Latest Latest
Warning

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

Go to latest
Published: May 4, 2022 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package prune provides types that remove messages from topics that have fallen outside their retention period.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConsumerPruner

type ConsumerPruner interface {
	Prune(ctx context.Context, topic string, before time.Time) ([]string, error)
}

The ConsumerPruner interface describes types that can reset consumer indexes for a topic. It should return the names of all consumers on a topic that have been pruned as the first return value.

type MessagePruner

type MessagePruner interface {
	// Prune should remove all messages from a topic older than the before time. It should return the
	// count of all pruned messages as the first return value.
	Prune(ctx context.Context, topic string, before time.Time) (uint64, error)
}

The MessagePruner interface describes types that can remove messages from a topic.

type Pruner

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

The Pruner type is responsible for periodically removing messages from topics that are outside the topic's configured retention period.

func New

func New(topics TopicLister, messages MessagePruner, consumers ConsumerPruner, logger hclog.Logger) *Pruner

New returns a new instance of the Pruner type that will list topics via the TopicLister implementation and prune messages via the MessagePruner implementation.

func (*Pruner) Prune

func (p *Pruner) Prune(ctx context.Context, interval time.Duration) error

Prune regularly removes data from the store that has fallen outside its retention period. This method currently removes messages and consumer indexes that are outside a topic's configured retention period, where the retention period is not infinite.

type TopicLister

type TopicLister interface {
	// List should return a slice of all topics known to the current node.
	List(ctx context.Context) ([]*topic.Topic, error)
}

The TopicLister interface describes types that can list all known topics.

Jump to

Keyboard shortcuts

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