Documentation ¶
Overview ¶
Package checkpoint implements a mechanism for tracking checkpointed integer offsets for sequential read at-least-once queue systems such as Kafka or Kinesis.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Capped ¶
type Capped[T any] struct { // contains filtered or unexported fields }
Capped receives an ordered feed of integer based offsets being tracked, and an unordered feed of integer based offsets that are resolved, and is able to return the highest offset currently able to be committed such that an unresolved offset is never committed.
If the number of unresolved tracked values meets a given cap the next attempt to track a value will be blocked until the next value is resolved.
This component is safe to use concurrently across goroutines.
func (*Capped[T]) Highest ¶
func (c *Capped[T]) Highest() *T
Highest returns the current highest checkpoint.
type Uncapped ¶ added in v4.12.0
type Uncapped[T any] struct { // contains filtered or unexported fields }
Uncapped keeps track of a sequence of pending checkpoint payloads, and as pending checkpoints are resolved it retains the latest fully resolved payload in the sequence where all prior sequence checkpoints are also resolved.
Also keeps track of the logical size of the unresolved sequence, which allows for limiting the number of pending checkpoints.
func NewUncapped ¶ added in v4.12.0
NewUncapped returns a new check pointer implemented via a linked list.
func (*Uncapped[T]) Highest ¶ added in v4.12.0
func (t *Uncapped[T]) Highest() *T
Highest returns the payload of the highest resolved checkpoint.
func (*Uncapped[T]) Pending ¶ added in v4.12.0
Pending returns the gap between the earliest and latest unresolved messages.
func (*Uncapped[T]) Track ¶ added in v4.12.0
Track a new unresolved payload. This payload will be cached until it is marked as resolved. While it is cached no more recent payload will ever be committed.
While the returned resolve funcs can be called from any goroutine, it is assumed that Track is called from a single goroutine.