concurrent

package
v0.0.0-...-e204074 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2024 License: AGPL-3.0 Imports: 4 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Map

type Map[K comparable, V any] struct {
	// contains filtered or unexported fields
}

func NewMap

func NewMap[K comparable, V any]() Map[K, V]

func (Map[K, V]) Compute

func (cm Map[K, V]) Compute(k K, f func(V, bool) V) V

func (Map[K, V]) Delete

func (cm Map[K, V]) Delete(k K)

func (Map[K, V]) Load

func (cm Map[K, V]) Load(k K) (V, bool)

func (Map[K, V]) LoadAndDelete

func (cm Map[K, V]) LoadAndDelete(k K) (V, bool)

func (Map[K, V]) LoadOrStore

func (cm Map[K, V]) LoadOrStore(k K, v V) (V, bool)

func (Map[K, V]) Locked

func (cm Map[K, V]) Locked(f func(m RWMap[K, V]))

func (Map[K, V]) RLocked

func (cm Map[K, V]) RLocked(f func(m RMap[K, V]))

func (Map[K, V]) Range

func (cm Map[K, V]) Range(f func(k K, v V) bool)

func (Map[K, V]) Store

func (cm Map[K, V]) Store(k K, v V)

func (Map[K, V]) Swap

func (cm Map[K, V]) Swap(k K, v V) (V, bool)

type RMap

type RMap[K comparable, V any] interface {
	Load(k K) (V, bool)
	Range(f func(k K, v V) bool)
	RLocked(f func(m RMap[K, V]))
}

type RWMap

type RWMap[K comparable, V any] interface {
	RMap[K, V]
	Store(k K, v V)
	Delete(k K)
	LoadAndDelete(k K) (V, bool)
	LoadOrStore(k K, v V) (V, bool)
	Compute(k K, f func(V, bool) V) V
	Swap(k K, v V) (V, bool)
	Locked(f func(m RWMap[K, V]))
}

type WorkGroup

type WorkGroup[In any, Acc any, Out any] struct {
	Parallelism uint
	Worker      func(ctx context.Context, v In, acc Acc) (Acc, error)
	Combiner    func(ctx context.Context, a, b Acc) (Acc, error)
	Finisher    func(ctx context.Context, acc Acc) (Out, error)
}

func (WorkGroup[In, Acc, Out]) RunChan

func (wg WorkGroup[In, Acc, Out]) RunChan(ctx context.Context, ch <-chan In) (Out, error)

func (WorkGroup[In, Acc, Out]) RunSeq

func (wg WorkGroup[In, Acc, Out]) RunSeq(ctx context.Context, seq iter.Seq[In]) (Out, error)

Jump to

Keyboard shortcuts

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