Documentation
¶
Overview ¶
Package gomemindexer - simple versioned, deduplicated in-memory index library.
Goals:
- Generic, type-safe field indexes (equality + range + time as-of)
- Versioned objects with per-object fine-grained locking
- Interning (dedup) table for repeated values
- Top-level Indexer to register fields and operate on objects
- Designed for real-time updates (e.g., stream consumer) and concurrent queries
NOTE: This is a focused demo-quality library designed to be extended.
Index ¶
- func AddToIndex[T any, V constraints.Ordered](idx *Indexer[T], field string, value V, objectID string, ts time.Time)
- func Intersect(a, b []string) []string
- func QueryEquals[T any, V constraints.Ordered](idx *Indexer[T], field string, value V, asOf *time.Time) []string
- func QueryRange[T any, V constraints.Ordered](idx *Indexer[T], field string, min, max V, asOf *time.Time) []string
- func RegisterField[T any, V constraints.Ordered](idx *Indexer[T], name string)
- func Union(a, b []string) []string
- type FieldIndex
- type Indexer
- type InternTable
- type VersionedObject
- type VersionedStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddToIndex ¶
func QueryEquals ¶
func QueryRange ¶
func RegisterField ¶
func RegisterField[T any, V constraints.Ordered](idx *Indexer[T], name string)
----------------------------- Generic functions for field operations -----------------------------
Types ¶
type FieldIndex ¶
type FieldIndex[T constraints.Ordered] struct { // contains filtered or unexported fields }
FieldIndex requires T to be ordered for range queries
func NewFieldIndex ¶
func NewFieldIndex[T constraints.Ordered]() *FieldIndex[T]
type Indexer ¶
type Indexer[T any] struct { Intern *InternTable // contains filtered or unexported fields }
----------------------------- Indexer: top-level API -----------------------------
func NewIndexer ¶
func (*Indexer[T]) AddVersion ¶
----------------------------- Non-generic methods remain -----------------------------
type InternTable ¶
type InternTable struct {
// contains filtered or unexported fields
}
----------------------------- InternTable: deduplicate & intern values -----------------------------
func NewInternTable ¶
func NewInternTable() *InternTable
func (*InternTable) Intern ¶
func (it *InternTable) Intern(hash, val string) *string
type VersionedObject ¶
----------------------------- VersionedStore: per-object version slices with per-object locking -----------------------------
type VersionedStore ¶
type VersionedStore[T any] struct { // contains filtered or unexported fields }
func NewVersionedStore ¶
func NewVersionedStore[T any]() *VersionedStore[T]
func (*VersionedStore[T]) Add ¶
func (vs *VersionedStore[T]) Add(objectID string, ts time.Time, data *T)
func (*VersionedStore[T]) AsOf ¶
func (vs *VersionedStore[T]) AsOf(objectID string, asOf time.Time) (*T, bool)
func (*VersionedStore[T]) Latest ¶
func (vs *VersionedStore[T]) Latest(objectID string) (*T, bool)
func (*VersionedStore[T]) ObjectIDs ¶
func (vs *VersionedStore[T]) ObjectIDs() []string