store

package
v0.0.0-...-93c852a Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clear

func Clear[V any, R Row](store Store[R], key R)

Clear clears the value for the given key.

func Get

func Get[V any, R Row](store Store[R], key R) (V, bool)

Get retrieves the given value. Get will not create a new column.

func Persist

func Persist[R Row](s Store[R], wr io.Writer) error

func PersistFS

func PersistFS[R Row](s Store[R], dir WritableFS, name string) error

func Push

func Push[V any](it Iterator[V]) iter.Seq[V]

func Push2

func Push2[U, V any](it Iterator2[U, V]) iter.Seq2[U, V]

func RegisterColumnImpl

func RegisterColumnImpl[C, D any]()

func RegisterColumnType

func RegisterColumnType[C any]()

func Restore

func Restore[R Row](store Store[R], rd io.Reader) error

func RestoreFS

func RestoreFS[R Row](s Store[R], dir WritableFS, name string) error

func RowMatrixFor

func RowMatrixFor[R Row](sets ...Rows[R]) bitset.Matrix[R]

func Set

func Set[V any, R Row](store Store[R], key R, value V)

Set sets the value for the given key.

func SimpleValueAs

func SimpleValueAs[U valued[V], V any, R Row](v *Value[R]) (V, bool)

func SimpleValueMustBe

func SimpleValueMustBe[U valued[V], V any, R Row](v *Value[R]) V

Types

type Allocator

type Allocator[V any] interface {
	New() *V
	Slice(int) []V
	Append(s []V, v ...V) []V
	// contains filtered or unexported methods
}

func AllocatorFor

func AllocatorFor[V any, R Row](a *Arena[R]) Allocator[V]

type Arena

type Arena[R Row] struct {
	// contains filtered or unexported fields
}

func (*Arena[R]) Copy

func (a *Arena[R]) Copy(v *Value[R]) *Value[R]

func (*Arena[R]) Empty

func (a *Arena[R]) Empty() *Value[R]

func (*Arena[R]) Group

func (a *Arena[R]) Group(key any, value *Value[R]) *Value[R]

func (*Arena[R]) Join

func (a *Arena[R]) Join(left, right *Value[R]) *Value[R]

func (*Arena[R]) Multi

func (a *Arena[R]) Multi(u []*Value[R]) *Value[R]

func (*Arena[R]) Release

func (a *Arena[R]) Release()

func (*Arena[R]) Simple

func (a *Arena[R]) Simple(u any) *Value[R]

func (*Arena[R]) Sub

func (a *Arena[R]) Sub() *Arena[R]

type BatchIterator

type BatchIterator[V any] interface {
	NextBatch([]V) int
	Stop()
}

type BatchIterator2

type BatchIterator2[U, V any] interface {
	NextBatch2([]U, []V) int
	Stop()
}

type Column

type Column[R Row, V any] interface {
	Rows() Rows[R]
	Has(R) bool
	Get(R) (V, bool)
	Set(R, V)
	Clear(R)
	Slot(int) Column[R, V]
	All() Iterator2[R, V]
	AllSlots() Iterator2[R, V]
}

func ColumnAs

func ColumnAs[V any, R Row](c Column[R, any]) (Column[R, V], bool)

func ColumnFor

func ColumnFor[V any, R Row](s Store[R]) Column[R, V]

func ReadColumn

func ReadColumn[R Row](s Store[R], col reflect.Type) Column[R, any]

func ReadColumnFor

func ReadColumnFor[V any, R Row](s Store[R]) Column[R, V]

type EmptyColumn

type EmptyColumn[R Row, V any] struct{}

func (EmptyColumn[R, V]) All

func (EmptyColumn[R, V]) All() Iterator2[R, V]

func (EmptyColumn[R, V]) AllSlots

func (EmptyColumn[R, V]) AllSlots() Iterator2[R, V]

func (EmptyColumn[R, V]) Clear

func (EmptyColumn[R, V]) Clear(R)

func (EmptyColumn[R, V]) Delete

func (EmptyColumn[R, V]) Delete()

func (EmptyColumn[R, V]) Get

func (EmptyColumn[R, V]) Get(R) (V, bool)

func (EmptyColumn[R, V]) Has

func (EmptyColumn[R, V]) Has(R) bool

func (EmptyColumn[R, V]) Rows

func (EmptyColumn[R, V]) Rows() Rows[R]

func (EmptyColumn[R, V]) Set

func (EmptyColumn[R, V]) Set(R, V)

func (EmptyColumn[R, V]) Slot

func (EmptyColumn[R, V]) Slot(int) Column[R, V]

type EmptyCursor

type EmptyCursor[R Row, V any] struct{}

func (EmptyCursor[R, V]) Next

func (EmptyCursor[R, V]) Next() (R, V, bool)

func (EmptyCursor[R, V]) Stop

func (EmptyCursor[R, V]) Stop()

type EmptyIterator

type EmptyIterator[V any] struct{}

func (EmptyIterator[V]) Next

func (EmptyIterator[V]) Next() (V, bool)

func (EmptyIterator[V]) NextBatch

func (EmptyIterator[V]) NextBatch([]V) int

func (EmptyIterator[V]) Stop

func (EmptyIterator[V]) Stop()

type EmptyIterator2

type EmptyIterator2[U, V any] struct{}

func (EmptyIterator2[U, V]) Next

func (EmptyIterator2[U, V]) Next() (U, V, bool)

func (EmptyIterator2[U, V]) NextBatch

func (EmptyIterator2[U, V]) NextBatch([]U, []V) int

func (EmptyIterator2[U, V]) Stop

func (EmptyIterator2[U, V]) Stop()

type EmptyResult

type EmptyResult[R Row] struct{}

func (EmptyResult[R]) Next

func (EmptyResult[R]) Next(*Arena[R]) (*Value[R], bool)

func (EmptyResult[R]) Stop

func (EmptyResult[R]) Stop()

type Iterator

type Iterator[V any] interface {
	Next() (V, bool)
	Stop()
}

func Pull

func Pull[V any](it iter.Seq[V]) Iterator[V]

type Iterator2

type Iterator2[U, V any] interface {
	Next() (U, V, bool)
	Stop()
}

func All

func All[V any, R Row](store Store[R]) Iterator2[R, V]

All returns a new cursor for iterating over the column. All will not create a new column; if the column does not exist, All will return an empty cursor.

func CursorAs

func CursorAs[V any, R Row](c Iterator2[R, any]) (Iterator2[R, V], bool)

func Pull2

func Pull2[U, V any](it iter.Seq2[U, V]) Iterator2[U, V]

type Marshaller

type Marshaller interface {
	cate.Marshaller
	cate.Unmarshaller
}

type Maybe

type Maybe[V any] struct {
	Value V
	Ok    bool
}

func NoneOf

func NoneOf[V any]() Maybe[V]

func SomeOf

func SomeOf[V any](v V) Maybe[V]

type None

type None struct{}

type Persister

type Persister[R Row] interface {
	Persist(R, Store[R], WritableFS) error
	Restore(R, Store[R], WritableFS) error
}

type Result

type Result[R Row] interface {
	Next(*Arena[R]) (*Value[R], bool)
	Stop()
}

type Row

type Row interface {
	~int | ~int8 | ~int16 | ~int32 | ~int64 |
		~uint | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~uintptr
}

type RowCursor

type RowCursor[R Row] = bitset.SetCursor[R]

type RowManager

type RowManager[R Row] interface {
	ManagedRows(R, Store[R]) Rows[R]
}

type RowSet

type RowSet[R Row, V any] struct {
	// contains filtered or unexported fields
}

RowSet is an ordered, mutable set of (row, value) pairs. An empty RowSet is implicitly sorted; it is only marked unsorted after an out-of-order insert.

func NewRowSet

func NewRowSet[R Row, V any](n int) *RowSet[R, V]

func (*RowSet[R, V]) All

func (s *RowSet[R, V]) All() RowSetIt[R, V]

func (*RowSet[R, V]) AllRows

func (s *RowSet[R, V]) AllRows() Rows[R]

func (*RowSet[R, V]) Clear

func (s *RowSet[R, V]) Clear(row R)

func (*RowSet[R, V]) Cleared

func (s *RowSet[R, V]) Cleared(row R) bool

func (*RowSet[R, V]) Get

func (s *RowSet[R, V]) Get(row R) (V, bool)

func (*RowSet[R, V]) GetOp

func (s *RowSet[R, V]) GetOp(row R) (Maybe[V], bool)

func (*RowSet[R, V]) Rows

func (s *RowSet[R, V]) Rows() Rows[R]

func (*RowSet[R, V]) Set

func (s *RowSet[R, V]) Set(row R, value V)

func (*RowSet[R, V]) Size

func (s *RowSet[R, V]) Size() int

func (*RowSet[R, V]) Sort

func (s *RowSet[R, V]) Sort()

type RowSetIt

type RowSetIt[R Row, V any] struct {
	*RowSet[R, V]
	// contains filtered or unexported fields
}

func (*RowSetIt[R, V]) At

func (it *RowSetIt[R, V]) At(row R) (Maybe[V], bool)

func (*RowSetIt[R, V]) Next

func (it *RowSetIt[R, V]) Next() (R, V, bool)

func (*RowSetIt[R, V]) NextOp

func (it *RowSetIt[R, V]) NextOp() (R, Maybe[V], bool)

func (*RowSetIt[R, V]) Stop

func (it *RowSetIt[R, V]) Stop()

type RowSetOp

type RowSetOp int

type Rows

type Rows[R Row] bitset.Set[R]

func NewRows

func NewRows[R Row](n int) Rows[R]

func RowsFrom

func RowsFrom[R Row](rows ...R) Rows[R]

func RowsFromAll

func RowsFromAll[R Row](sets ...Rows[R]) Rows[R]

func (*Rows[R]) Clear

func (s *Rows[R]) Clear(key R)

func (*Rows[R]) ClearAll

func (s *Rows[R]) ClearAll(r Rows[R])

func (Rows[R]) Copy

func (s Rows[R]) Copy() Rows[R]

func (Rows[R]) Cursor

func (s Rows[R]) Cursor() RowCursor[R]

func (Rows[R]) Has

func (s Rows[R]) Has(key R) bool

func (Rows[R]) HasAny

func (s Rows[R]) HasAny(r Rows[R]) bool

func (*Rows[R]) IntersectWith

func (s *Rows[R]) IntersectWith(r Rows[R])

func (Rows[R]) IsEmpty

func (s Rows[R]) IsEmpty() bool

func (*Rows[R]) MarshalCATE

func (s *Rows[R]) MarshalCATE(*cate.Encoder) (cate.Value, error)

func (Rows[R]) Rank

func (s Rows[R]) Rank(key R) int

func (*Rows[R]) Reset

func (s *Rows[R]) Reset()

func (*Rows[R]) Set

func (s *Rows[R]) Set(key R)

func (*Rows[R]) SetAll

func (s *Rows[R]) SetAll(r Rows[R])

func (Rows[R]) Size

func (s Rows[R]) Size() int

func (*Rows[R]) UnmarshalCATE

func (s *Rows[R]) UnmarshalCATE(_ *cate.Decoder, value cate.Value) error

type SimpleValueSet

type SimpleValueSet[R Row, V any] struct {
	// contains filtered or unexported fields
}

func SimpleValueAllocatorFor

func SimpleValueAllocatorFor[V any, R Row](a *Arena[R]) SimpleValueSet[R, V]

func (SimpleValueSet[R, V]) Value

func (s SimpleValueSet[R, V]) Value(value V) *Value[R]

type SliceIterator

type SliceIterator[V any] []V

func (*SliceIterator[V]) Next

func (it *SliceIterator[V]) Next() (V, bool)

func (*SliceIterator[V]) NextBatch

func (it *SliceIterator[V]) NextBatch(buf []V) int

func (*SliceIterator[V]) Stop

func (it *SliceIterator[V]) Stop()

type Store

type Store[R Row] interface {
	// For creates a new store scoped to the given rows.
	For(Rows[R]) Store[R]

	// Rows returns the set of all populated rows. Rows is optimistic - the
	// presence of a row in the row set does not guarantee that row is
	// present in any column.
	Rows() Rows[R]

	// Row iterates over the attributes of a row.
	Row(R) Iterator2[reflect.Type, any]

	// HasRow returns true if any column contains an entry for the given
	// row.
	HasRow(row R) bool

	// Columns iterates over all populated columns.
	Columns() Iterator[reflect.Type]

	// Column returns a specific column.
	Column(reflect.Type) Column[R, any]
}

type Value

type Value[R Row] struct {
	// contains filtered or unexported fields
}

func NewSimpleValue

func NewSimpleValue[R Row, V any](value V) *Value[R]

func NewSimpleValueFrom

func NewSimpleValueFrom[V any, R Row](a *Arena[R], value V) *Value[R]

func (*Value[R]) Equal

func (v *Value[R]) Equal(u *Value[R]) bool

func (*Value[R]) Group

func (v *Value[R]) Group() (any, *Value[R])

func (*Value[R]) HasRow

func (v *Value[R]) HasRow() bool

func (*Value[R]) Join

func (v *Value[R]) Join() (left, right *Value[R])

func (*Value[R]) Kind

func (v *Value[R]) Kind() ValueKind

func (*Value[R]) Multi

func (v *Value[R]) Multi() []*Value[R]

func (*Value[R]) Row

func (v *Value[R]) Row() R

func (*Value[R]) Simple

func (v *Value[R]) Simple() any

func (*Value[R]) WithGroup

func (v *Value[R]) WithGroup(key any, value *Value[R]) *Value[R]

func (*Value[R]) WithJoin

func (v *Value[R]) WithJoin(left, right *Value[R]) *Value[R]

func (*Value[R]) WithMulti

func (v *Value[R]) WithMulti(u []*Value[R]) *Value[R]

func (*Value[R]) WithRow

func (v *Value[R]) WithRow(row R) *Value[R]

func (*Value[R]) WithSimple

func (v *Value[R]) WithSimple(u any) *Value[R]

type ValueKind

type ValueKind int
const (
	EmptyValue ValueKind = iota
	SimpleValue
	MultiValue
	GroupedValue
	JoinedValue
)

type WritableFS

type WritableFS interface {
	fs.FS
	Subdir(string) (WritableFS, error)
	Create(string) (WritableFile, error)
}

func DirFS

func DirFS(dir string) WritableFS

type WritableFile

type WritableFile interface {
	fs.File
	io.Writer
}

Directories

Path Synopsis
Package store (v0) is a minimal, non-performant implementation store.Store.
Package store (v0) is a minimal, non-performant implementation store.Store.
Package store (v1) is the baseline implementation of store.Store.
Package store (v1) is the baseline implementation of store.Store.

Jump to

Keyboard shortcuts

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