db

package
v0.0.4-0...-95ce5f7 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB[T constraints.Integer] interface {
	GetConfig() (T, T)
	Set(e Entry[T]) error
	Get(id T) (Entry[T], error)
	GetByLabel(selector labels.Selector) Entries[T]
	GetAll() Entries[T]
	Has(id T) bool
	Delete(id T) error
	Count() int
	Iterate() *Iterator[T]
	IterateFree() *Iterator[T]

	FindFree() (Entry[T], error)
	FindFreeID(id T) (Entry[T], error)
	FindFreeRange(min, size T) (Entries[T], error)
	FindFreeSize(size T) (Entries[T], error)
}

func NewDB

func NewDB[T constraints.Integer](cfg *DBConfig[T]) DB[T]

type DBConfig

type DBConfig[T constraints.Integer] struct {
	Offset           T
	MaxEntries       T
	InitEntries      Entries[T]
	SetValidation    ValidationFn[T]
	DeleteValidation ValidationFn[T]
}

type Entries

type Entries[T constraints.Integer] []Entry[T]

type Entry

type Entry[T constraints.Integer] interface {
	ID() T
	Labels() labels.Set
	String() string
}

func NewEntry

func NewEntry[T constraints.Integer](id T, l map[string]string) Entry[T]

type Iterator

type Iterator[T constraints.Integer] struct {
	// contains filtered or unexported fields
}

func (*Iterator[T]) IsConsecutive

func (r *Iterator[T]) IsConsecutive() bool

func (*Iterator[T]) Next

func (r *Iterator[T]) Next() bool

func (*Iterator[T]) Value

func (r *Iterator[T]) Value() Entry[T]

type ValidationFn

type ValidationFn[T constraints.Integer] func(id T) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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