retention

package
v0.0.0-...-c26a9be Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AndPolicy

type AndPolicy interface {
	BinaryPolicy
}

AndPolicy is a Policy from which both Policies must request that messages be retained in order to do so

func And

func And(left Policy, right Policy) AndPolicy

And returns a Policy from which both Policies must request that messages be retained in order to do so

type BinaryPolicy

type BinaryPolicy interface {
	Policy
	Left() Policy
	Right() Policy
}

BinaryPolicy is a Policy where two Policies are combined in order to determine retention policy

type ConsumedPolicy

type ConsumedPolicy interface {
	Policy
}

ConsumedPolicy describes a Policy that discards messages that have been consumed by all active Consumers

func MakeConsumedPolicy

func MakeConsumedPolicy() ConsumedPolicy

MakeConsumedPolicy returns a Policy that allows for the discarding of messages that have already been consumed by active Consumers

type Count

type Count uint64

Count is the retained size of a Topic stream

type CountedPolicy

type CountedPolicy interface {
	Policy
	Count() Count
}

CountedPolicy describes a Policy that only retains the most recent specified Count of messages

func MakeCountedPolicy

func MakeCountedPolicy(c Count) CountedPolicy

MakeCountedPolicy returns a Policy that only retains the most recent specified count of messages

type EntriesStatistics

type EntriesStatistics struct {
	FirstOffset    uint64
	LastOffset     uint64
	FirstTimestamp time.Time
	LastTimestamp  time.Time
}

EntriesStatistics provides Retention information about a range of Log entries

type LogStatistics

type LogStatistics struct {
	Length        uint64
	CursorOffsets []uint64
}

LogStatistics provides Retention information about the Log

type NotPolicy

type NotPolicy interface {
	UnaryPolicy
}

NotPolicy is a Policy that negates the retention logic of its supplied Policy

func Not

func Not(policy Policy) NotPolicy

Not returns a Policy that negates the logic of its supplied Policy

type OrPolicy

type OrPolicy interface {
	BinaryPolicy
}

OrPolicy is a Policy from which either Policy can request that messages be retained in order to do so

func Or

func Or(left Policy, right Policy) OrPolicy

Or returns a Policy from which either Policy can request that messages be retained in order to do so

type PermanentPolicy

type PermanentPolicy interface {
	Policy
}

PermanentPolicy describes a Policy where all messages are retained without consideration.

func MakePermanentPolicy

func MakePermanentPolicy() PermanentPolicy

MakePermanentPolicy returns a Policy where all messages are retained without consideration

type Policy

type Policy interface {
	InitialState() State
	Retain(State, *Statistics) (State, bool)
}

Policy describes and implements a policy that a Topic will use to discard messages

type State

type State any

State allows a Policy to accumulate state between Retain calls

type Statistics

type Statistics struct {
	CurrentTime time.Time
	Log         *LogStatistics
	Entries     *EntriesStatistics
}

Statistics provides just enough information about the Log and a range entries to be useful to a Policy

type TimedPolicy

type TimedPolicy interface {
	Policy
	Duration() time.Duration
}

TimedPolicy describes a Policy that only retains messages retains messages produced in the last specified Duration

func MakeTimedPolicy

func MakeTimedPolicy(d time.Duration) TimedPolicy

MakeTimedPolicy returns a Policy that only retains messages produced in the last specified Duration

type UnaryPolicy

type UnaryPolicy interface {
	Policy
	Policy() Policy
}

UnaryPolicy is a Policy that applies some additional logic to a supplied Policy

Jump to

Keyboard shortcuts

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