package
0.0.0-20240428053259-a7bab56e60d6
Repository: https://github.com/zeroflucs-given/generics.git
Documentation: pkg.go.dev

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# README

collections

Generic structures for Go 1.18+ developers

Interfaces

The following core interfaces are defined in collections package:

InterfaceRoleNotes
Queue[T]Queue, Order InvariantThis interface defines a any queue where you can Push a value, Pop a value and Count the contents of the object.

Included Packages

These packages are thread-safe, using mutexes to maintain consistency.

PackageThread SafetyInterfacesNotes
collections/bplustreeConcurrent Reads & Single WriterTreeMap[K, V]A B+ tree implementation that implements a seekable list of key-values.
collections/linkedlistConcurrent Reads & Single WriterQueue[T]A linked list that implements Queue[T] with FIFO semantics. Capacity limited by system resources.
collections/ringbufferConcurrent Reads & Single WriterQueue[T]A linked list with a fixed upper size that implements Queue[T] with FIFO semantics, optimised for fixed sets of data. Attempts tow write data when full will return errors.
collections/stackConcurrent Reads & Single WriterQueue[T]A fixed size stack that implements Queue[T] with LIFO semantics. Attempts to exceed stack capacity will return errors.
collections/weightedrandomConcurrent Reads & Single WriterN/AAllows selection of a value from a set of values in accordance with their relative weights/frequencies. Weights can be any Comparable type, but you must supply a mapper function that reduces these values to the space of float64(0>maxFloat64)

Non-Thread Safe

The lockless sub-package contains variants of the existing packages. These packages are not thread safe, and concurrent operations must be controlled by consuming code.

PackageNotes
collections/lockless/ringbufferA non-locking version of the circular ring buffer. Assumes that it is used only in contexts that prevent concurrent operations.