package pool

import "github.com/ydb-platform/ydb-go-sdk/v3/internal/pool"

Index

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

func (p *Pool[T]) Close(ctx context.Context) (err error)

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

func (p *Pool[T]) With(ctx context.Context, f func(ctx context.Context, item *T) error, opts ...retry.Option) error

Source Files

errors.go pool.go

Version
v3.57.4
Published
Mar 12, 2024
Platform
linux/amd64
Imports
10 packages
Last checked
58 seconds ago

Tools for package owners.