Documentation
¶
Overview ¶
Package generation provides atomic collector generation swaps. Work leases stay attached to the generation in which they started, and reset waits for those leases before freezing the old value.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Lease ¶
Lease pins work to the generation in which it started.
func (*Lease[T, S]) Done ¶
func (l *Lease[T, S]) Done()
Done releases the lease. It is safe to call more than once.
func (*Lease[T, S]) Generation ¶
Generation returns the pinned generation number.
type Manager ¶
Manager owns a current generation and serializes resets.
func (*Manager[T, S]) CurrentGeneration ¶
CurrentGeneration returns the generation accepting new work.
func (*Manager[T, S]) Snapshot ¶
Snapshot takes a best-effort snapshot of the current generation. The value must provide its own synchronization against active leases.
func (*Manager[T, S]) SwapAndSnapshot ¶
SwapAndSnapshot publishes a new empty generation, waits for work pinned to the old generation, and then freezes the old value. Concurrent swaps are serialized so frozen generations are returned in order.