pool

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AsyncPool

type AsyncPool struct {
	// contains filtered or unexported fields
}

func NewAsync

func NewAsync(logger *zap.Logger, concurrency int, timeout time.Duration, bufferSize int) *AsyncPool

func (*AsyncPool) Add

func (p *AsyncPool) Add(task AsyncTask)

func (*AsyncPool) Len

func (p *AsyncPool) Len() int64

func (*AsyncPool) Start

func (p *AsyncPool) Start()

func (*AsyncPool) Stop

func (p *AsyncPool) Stop()

func (*AsyncPool) Total

func (p *AsyncPool) Total() int64

type AsyncTask

type AsyncTask interface {
	Do(context.Context) error
}

type AsyncTaskFunc

type AsyncTaskFunc func(context.Context) error

func (AsyncTaskFunc) Do

func (f AsyncTaskFunc) Do(ctx context.Context) error

type Guard

type Guard struct {
	// contains filtered or unexported fields
}

func (*Guard) Done

func (g *Guard) Done()

func (*Guard) ID

func (g *Guard) ID() int64

func (*Guard) Name

func (g *Guard) Name() string

func (*Guard) SuppressWarning

func (g *Guard) SuppressWarning(suppressWarning bool) *Guard

type OSFile

type OSFile interface {
	Name() string
	Close() error
}

type ReleasePool

type ReleasePool struct {
	// contains filtered or unexported fields
}

func NewRelease

func NewRelease(logger *zap.Logger) *ReleasePool

func (*ReleasePool) Clean

func (p *ReleasePool) Clean()

func (*ReleasePool) Len

func (p *ReleasePool) Len() int64

func (*ReleasePool) Total

func (p *ReleasePool) Total() int64

func (*ReleasePool) Watch

func (p *ReleasePool) Watch(r Resource) *Guard

type Resource

type Resource interface {
	Name() string
	Release() error
}

func NewIOReadCloserResource

func NewIOReadCloserResource(name string, rc io.ReadCloser) Resource

func NewIOReadWriteCloserResource

func NewIOReadWriteCloserResource(name string, rc io.ReadWriteCloser) Resource

func NewIOWriteCloserResource

func NewIOWriteCloserResource(name string, rc io.WriteCloser) Resource

func NewOSFileResource

func NewOSFileResource(f OSFile) Resource

func NewReleaseFunc

func NewReleaseFunc(name string, f func() error) Resource

type ResourceFunc

type ResourceFunc struct {
	// contains filtered or unexported fields
}

func (*ResourceFunc) Name

func (f *ResourceFunc) Name() string

func (*ResourceFunc) Release

func (f *ResourceFunc) Release() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL