registry

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 5, 2025 License: GPL-3.0 Imports: 5 Imported by: 2

README

registry

Implementation of in-memory data store

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFoundEntity = errors.New("not found entity")
)

All kinds of errors for memory

View Source
var Nothing = struct{}{}

Nothing empty struct

Functions

This section is empty.

Types

type Constructable

type Constructable interface {
	Construct() error
}

Constructable able to be construct in memory

type Destroyable

type Destroyable interface {
	Destroy() error
}

Destroyable able to be destroyed in memory

type Group

type Group[K comparable, V any] struct {
	// contains filtered or unexported fields
}

Group contains all entities for given type

func NewGroup

func NewGroup[K comparable, V any]() *Group[K, V]

NewGroup return registry

func (*Group[K, V]) Add

func (g *Group[K, V]) Add(id K, e V) (err error)

func (*Group[K, V]) CallWithLock

func (g *Group[K, V]) CallWithLock(f func(d map[K]V) (e V, err error)) (V, error)

func (*Group[K, V]) Get

func (g *Group[K, V]) Get(id K) (e V, err error)

func (*Group[K, V]) GetKeys

func (g *Group[K, V]) GetKeys() []K

func (*Group[K, V]) GetMap

func (g *Group[K, V]) GetMap() map[K]V

func (*Group[K, V]) GetValues

func (g *Group[K, V]) GetValues() []V

func (*Group[K, V]) Iterator

func (g *Group[K, V]) Iterator() chan V

func (*Group[K, V]) Remove

func (g *Group[K, V]) Remove(id K) (err error)

func (*Group[K, V]) Search

func (g *Group[K, V]) Search(key any, result chan V, f SearchFunction)

func (*Group[K, V]) SearchOne

func (g *Group[K, V]) SearchOne(key any, f SearchFunction) (d V)

func (*Group[K, V]) Size

func (g *Group[K, V]) Size() int

func (*Group[K, V]) Tick

func (g *Group[K, V]) Tick()

func (*Group[K, V]) Truncate

func (g *Group[K, V]) Truncate()

type Registry

type Registry[G comparable, I comparable, V any] struct {
	// contains filtered or unexported fields
}

func NewRegistry

func NewRegistry[G comparable, I comparable, V any]() *Registry[G, I, V]

func (*Registry[G, I, V]) Add

func (r *Registry[G, I, V]) Add(key G, id I, e V) error

func (*Registry[G, I, V]) AddIndex

func (r *Registry[G, I, V]) AddIndex(id uint64, key I)

func (*Registry[G, I, V]) AsyncIterator

func (r *Registry[G, I, V]) AsyncIterator(keys ...G) chan V

func (*Registry[G, I, V]) AsyncTick

func (r *Registry[G, I, V]) AsyncTick(keys ...G)

func (*Registry[G, I, V]) DeleteGroup

func (r *Registry[G, I, V]) DeleteGroup(key G)

func (*Registry[G, I, V]) Get

func (r *Registry[G, I, V]) Get(key G, id I) (e V, err error)

func (*Registry[G, I, V]) GetGroup

func (r *Registry[G, I, V]) GetGroup(key G) (group *Group[I, V])

func (*Registry[G, I, V]) GetGroups

func (r *Registry[G, I, V]) GetGroups(keys ...G) (groups []*Group[I, V])

func (*Registry[G, I, V]) GetIndex

func (r *Registry[G, I, V]) GetIndex(id uint64) I

func (*Registry[G, I, V]) GetKeys

func (r *Registry[G, I, V]) GetKeys() []G

func (*Registry[G, I, V]) GetValues

func (r *Registry[G, I, V]) GetValues(key G) []V

func (*Registry[G, I, V]) Iterator

func (r *Registry[G, I, V]) Iterator(keys ...G) chan V

func (*Registry[G, I, V]) LatestID

func (r *Registry[G, I, V]) LatestID() uint64

func (*Registry[G, I, V]) NextID

func (r *Registry[G, I, V]) NextID() uint64

func (*Registry[G, I, V]) RemIndex

func (r *Registry[G, I, V]) RemIndex(id uint64)

func (*Registry[G, I, V]) Remove

func (r *Registry[G, I, V]) Remove(key G, id I) error

func (*Registry[G, I, V]) RemoveIDEverywhere

func (r *Registry[G, I, V]) RemoveIDEverywhere(id I) error

func (*Registry[G, I, V]) SearchInGroup

func (r *Registry[G, I, V]) SearchInGroup(key G, f SearchFunction) chan V

func (*Registry[G, I, V]) SearchOne

func (r *Registry[G, I, V]) SearchOne(key G, f SearchFunction) V

func (*Registry[G, I, V]) SetLatestID

func (r *Registry[G, I, V]) SetLatestID(id uint64)

func (*Registry[G, I, V]) Size

func (r *Registry[G, I, V]) Size() int

func (*Registry[G, I, V]) TickGroup

func (r *Registry[G, I, V]) TickGroup(key G)

func (*Registry[G, I, V]) TickGroups

func (r *Registry[G, I, V]) TickGroups(keys ...G)

func (*Registry[G, I, V]) TruncateGroup

func (r *Registry[G, I, V]) TruncateGroup(key G)

type SearchFunction

type SearchFunction func(key interface{}, id interface{}, data interface{}) bool

SearchFunction describe specification for filter function

type Ticker

type Ticker interface {
	Tick()
}

Ticker describe function for execute tick

Jump to

Keyboard shortcuts

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