idx

package
v0.0.0-...-157c9c8 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: GPL-3.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Index

type Index[Key any] interface {
	// Insert an ID. The first value returned is the index and the bool
	// indicates if an append is required.
	Insert(id Key) (int, bool)
	// Get by ID. If not found it should return (-1,false). If it is found the
	// first value is the index and the second value is True.
	Get(id Key) (int, bool)
	// Delete by ID. Removes the ID from the index, the value should be
	// recycled. This should be called before removing the value from the slice.
	Delete(id Key) (int, bool)
	// SliceLen of the Indexed slice.
	SliceLen() int
	// SetSliceLen can be used to grow the slice.
	SetSliceLen(int)
	// Next ID after the ID given
	Next(id Key) (Key, int)
}

Index a slice by a byte ID. Allows the equivalent of map[[]byte]<Type>. A slice of the desired type is kept seperatly and the Index values are managed.

type IndexFactory

type IndexFactory[Key any] func(slicelen int) Index[Key]

Directories

Path Synopsis
testsuite
Package testsuite provides tests to validate that an implementation of byteid.Index is correct.
Package testsuite provides tests to validate that an implementation of byteid.Index is correct.

Jump to

Keyboard shortcuts

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