package pool
import "github.com/ydb-platform/ydb-go-sdk/v3/internal/pool"
Index ¶
- type Pool
- func New[T any]( limit int, createItem func(ctx context.Context, onClose func(item *T)) (*T, error), deleteItem func(ctx context.Context, item *T) error, checkErr func(err error) bool, opts ...option[T], ) *Pool[T]
- func (p *Pool[T]) Close(ctx context.Context) (err error)
- func (p *Pool[T]) With(ctx context.Context, f func(ctx context.Context, item *T) error) error
Types ¶
type Pool ¶
type Pool[T any] struct { // contains filtered or unexported fields }
func New ¶
func New[T any]( limit int, createItem func(ctx context.Context, onClose func(item *T)) (*T, error), deleteItem func(ctx context.Context, item *T) error, checkErr func(err error) bool, opts ...option[T], ) *Pool[T]
func (*Pool[T]) Close ¶
Close deletes all stored items inside Pool. It also stops all underlying timers and goroutines. It returns first error occurred during stale items' deletion. Note that even on error it calls Close() on each item.
func (*Pool[T]) With ¶
Source Files ¶
- Version
- v3.57.0
- Published
- Mar 7, 2024
- Platform
- linux/amd64
- Imports
- 10 packages
- Last checked
- 1 minute ago –
Tools for package owners.