containers

package module
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2023 License: ISC Imports: 1 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IDTable

type IDTable[T any] map[uint64]T

IDTable is a map with random indexes for jobs and other cases where a random but unique index is required

func (IDTable[T]) Assign

func (id IDTable[T]) Assign(val T) uint64

Assign adds an object to the map and returns its assigned index

func (IDTable[T]) Delete added in v0.3.5

func (id IDTable[T]) Delete(index uint64)

func (IDTable[T]) Get added in v0.3.1

func (id IDTable[T]) Get(index uint64) (T, bool)

func (IDTable[T]) Replace added in v0.3.5

func (id IDTable[T]) Replace(index uint64, val T)

type OrderedIDTable added in v0.3.1

type OrderedIDTable[T any] struct {
	// contains filtered or unexported fields
}

OrderedIDTable is a map with incremental indexes, it's faster than IDTable by orders of magnitude, but will eventually run out of IDs (after 2^64 assignments)

func (OrderedIDTable[T]) Assign added in v0.3.1

func (id OrderedIDTable[T]) Assign(val T) uint64

func (OrderedIDTable[T]) Delete added in v0.3.1

func (id OrderedIDTable[T]) Delete(index uint64)

func (OrderedIDTable[T]) Get added in v0.3.1

func (id OrderedIDTable[T]) Get(index uint64) (T, bool)

func (OrderedIDTable[T]) Replace added in v0.3.1

func (id OrderedIDTable[T]) Replace(index uint64, val T)

type Table added in v0.3.1

type Table[T any] interface {
	Assign(T)
	Get(uint64) (T, bool)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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