Documentation
¶
Overview ¶
Package readerpool retains immutable object handles within a bounded process-wide budget.
Index ¶
- func Append(ctx context.Context, namespace any, name string, dst []byte, off, n int64, ...) ([]byte, bool, error)
- func BeginMutation(namespace any, name string) func()
- func ID(ctx context.Context) uint64
- func Rebind(ctx, from context.Context) context.Context
- func RelievePressure(err error) bool
- func Scoped(ctx context.Context) bool
- func Supported(backend any) bool
- func Valid(ctx context.Context) bool
- type Batch
- type Reader
- type Scope
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Append ¶
func Append(ctx context.Context, namespace any, name string, dst []byte, off, n int64, open func() (Reader, error)) ([]byte, bool, error)
Append reads a clamped range into caller-owned storage without allocating a cursor lease.
func BeginMutation ¶
BeginMutation rotates scopes before publication; its callback rotates them again after publication, so new reads cannot retain an object opened mid-replacement.
func Rebind ¶
Rebind preserves an immutable owner while replacing operation values and cancellation.
func RelievePressure ¶
RelievePressure reclaims a bounded batch of idle current-generation handles.
Types ¶
type Batch ¶ added in v0.55.0
type Batch struct {
// contains filtered or unexported fields
}
Batch retains a bounded set of leases for one operation; reset it between parts. Reset and Close wait for reads using those leases.
func WithBatch ¶ added in v0.55.0
WithBatch lets scoped Append calls reuse leases until Reset or Close.
type Scope ¶
type Scope struct {
// contains filtered or unexported fields
}
Scope owns immutable generations and protects idle handles from ordinary LRU eviction.
func NewScope ¶
func NewScope() *Scope
NewScope creates an immutable object owner, initially unpinned.
func (*Scope) Acquire ¶
func (s *Scope) Acquire()
Acquire protects idle handles from ordinary LRU eviction until Release.
func (*Scope) Close ¶
Close releases idle handles; outstanding leases keep their handles until closed.
func (*Scope) ResidentBytes ¶
ResidentBytes bounds scope and registered/retained reader bookkeeping.