writeconcurrencylimiter

package
v1.136.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2026 License: Apache-2.0 Imports: 11 Imported by: 17

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecConcurrency added in v1.110.28

func DecConcurrency()

DecConcurrency returns the token obtained via IncConcurrency(), so other goroutines could obtain it.

func IncConcurrency added in v1.110.28

func IncConcurrency() error

IncConcurrency obtains a concurrency token from -maxConcurrentInserts.

The obtained token must be returned back via DecConcurrency() call.

func PutReader added in v1.86.0

func PutReader(r *Reader)

PutReader returns the r to the pool.

It decreases the concurrency.

Types

type Reader added in v1.86.0

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

Reader is a reader, which decreases the concurrency before every Read() call and increases the concurrency after Read() call.

It effectively limits the number of concurrent goroutines, which may process results returned by concurrently processed Reader structs.

The Reader must be obtained via GetReader() call.

func GetReader added in v1.86.0

func GetReader(r io.Reader) (*Reader, error)

GetReader returns the Reader for r.

The PutReader() must be called when the returned Reader is no longer needed.

func (*Reader) Read added in v1.86.0

func (r *Reader) Read(p []byte) (int, error)

Read implements io.Reader.

Jump to

Keyboard shortcuts

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