Documentation
¶
Overview ¶
Package observation shares bounded, process-local read-only probes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidated = errors.New("observation invalidated")
ErrInvalidated asks an owner to retry with its current observation identity.
Functions ¶
Types ¶
type Cache ¶
type Cache[K comparable, V any] struct { // contains filtered or unexported fields }
Cache holds at most one running probe, including a canceled native call that has not returned yet. Values must be immutable; callers clone mutable data.
func (*Cache[K, V]) Close ¶
func (c *Cache[K, V]) Close()
Close cancels probes owned by this cache and rejects future requests.
func (*Cache[K, V]) Get ¶
func (c *Cache[K, V]) Get(ctx context.Context, key K, ttl time.Duration, probe func(context.Context) (V, error)) (V, error)
Get reuses successful, unexpired results. A canceled waiter never owns the other waiters' execution context. Probe lifetime belongs to Cache.
func (*Cache[K, V]) Invalidate ¶
func (c *Cache[K, V]) Invalidate()
Invalidate retires cached and in-flight observations.