Documentation
¶
Overview ¶
Package hashqueue provides a serialisation function call execution mechanism.
Index ¶
- func ResultChan[K comparable, V any](g *Group[K], key K, f func() (V, error)) <-chan Result[V]
- func ResultFunc[K comparable, T any](g *Group[K], key K, f func() (T, error)) (T, error)
- func TryValueFunc[K comparable, V any](g *Group[K], key K, f func() V) (V, bool)
- func ValueFunc[K comparable, T any](g *Group[K], key K, f func() T) T
- type Group
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResultChan ¶
func ResultChan[K comparable, V any](g *Group[K], key K, f func() (V, error)) <-chan Result[V]
ResultChan executes a function that returns a value and an error, and returns a channel that will receive the result. This allows for non-blocking usage patterns.
func ResultFunc ¶
func ResultFunc[K comparable, T any](g *Group[K], key K, f func() (T, error)) (T, error)
ResultFunc executes a function that returns a value and an error.
func TryValueFunc ¶
func TryValueFunc[K comparable, V any](g *Group[K], key K, f func() V) (V, bool)
TryValueFunc attempts to execute a function that returns a single value, without blocking if the channel is full. It returns the value and a boolean indicating success.
func ValueFunc ¶
func ValueFunc[K comparable, T any](g *Group[K], key K, f func() T) T
ValueFunc executes a function that returns a single value.
Types ¶
type Group ¶
type Group[K comparable] struct { // contains filtered or unexported fields }
Group provides a mechanism to deduplicate function calls by key. When multiple goroutines call functions with the same key concurrently, only one execution occurs while all callers receive the result of that execution.