Documentation
¶
Overview ¶
Package pool provides a concurrency-safe pool of instances for libraries whose types are not safe for concurrent use. pgstream shares a single transformer per column across all snapshot worker goroutines, so transformers backed by stateful libraries (shared rng, internal buffers) hand out one underlying instance per concurrent caller instead of serializing calls with a lock.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Pool ¶
type Pool[T any] struct { // contains filtered or unexported fields }
Pool hands out dedicated instances of T so that concurrent callers never share one. Instances are created lazily with the provided constructor and reused across calls once released.
func New ¶
New returns a pool that creates instances with newFn. The constructor is invoked eagerly once so that invalid configuration fails at build time rather than on first use.