Commit Graph

2 Commits

Author SHA1 Message Date
Josh van Leeuwen 24b59a803d
Adds generic ring (#108)
* Adds generic ring

Adds a generic implementation of the stdblib ring buffer so that each
ring `Value` can be a concrete type.
https://pkg.go.dev/container/ring

Adds `Len() int` and `Keys() []K` func to the generic Map cmap.

Changes `events/queue` Processor `Queueable` to be an exported type. No
functional change, but consumed types should be exported.

Signed-off-by: joshvanl <me@joshvanl.dev>

* Adds ring_test.go

Signed-off-by: joshvanl <me@joshvanl.dev>

* Linting

Signed-off-by: joshvanl <me@joshvanl.dev>

* Linting

Signed-off-by: joshvanl <me@joshvanl.dev>

* Update Do func to be typed

Signed-off-by: joshvanl <me@joshvanl.dev>

* Adds ring/buffered

Signed-off-by: joshvanl <me@joshvanl.dev>

---------

Signed-off-by: joshvanl <me@joshvanl.dev>
2024-11-20 13:48:57 -08:00
Josh van Leeuwen 866002abe6
Adds FIFO concurrent lock & generic concurrent Slice (#107)
* Adds FIFO concurrent lock & generic concurrent Slice

Adds a new concurrency/fifo package which implements a fifo mutex, as
well as a concurrently safe comparable indexed map of fifo mutexes.

Adds a simple generic concurrently safe slice implementation, which can
currently only grow.

Moves the map generic implementations in `/concurrency` to
`/concurrency/cmap`.

Signed-off-by: joshvanl <me@joshvanl.dev>

* Linting

Signed-off-by: joshvanl <me@joshvanl.dev>

* Move concurency/slice.go to concurency/slice/slice.go and add concurency/slice/string.go

Signed-off-by: joshvanl <me@joshvanl.dev>

---------

Signed-off-by: joshvanl <me@joshvanl.dev>
2024-10-15 06:03:26 -07:00