semaphore

package
v0.1.606 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2025 License: Apache-2.0 Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	contract.SemaphoreOperator
}

func NewClient

func NewClient(opts ClientOptions) Client

type ClientOption added in v0.1.6

type ClientOption func(*ClientOptions)

func WithConcurrency

func WithConcurrency(x int) ClientOption

type ClientOptions added in v0.1.6

type ClientOptions struct {
	Concurrency int
}

func ApplyClientOptions added in v0.1.9

func ApplyClientOptions(opts *ClientOptions, modifiers ...ClientOption) ClientOptions

type DefaultTool added in v0.1.11

type DefaultTool struct {
	T *contract.Tool[Client]
}

func NewTool

func NewTool(c Client, opts contract.ToolOptions[Client]) *DefaultTool

func (*DefaultTool) Acquire added in v0.1.11

func (d *DefaultTool) Acquire(ctx context.Context) error

Acquire reserves a slot in the semaphore, ensuring controlled concurrency.

func (*DefaultTool) GetConcurrency added in v0.1.246

func (d *DefaultTool) GetConcurrency(ctx context.Context) (int, error)

GetConcurrency returns the configured concurrency limit.

func (*DefaultTool) Release added in v0.1.11

func (d *DefaultTool) Release(ctx context.Context) error

Release frees a previously acquired semaphore slot.

func (*DefaultTool) WaitAll added in v0.1.11

func (d *DefaultTool) WaitAll(ctx context.Context) error

WaitAll blocks until all acquired semaphore slots are released.

type Tool added in v0.1.245

type Tool interface {
	Client
}

Jump to

Keyboard shortcuts

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