memorytable

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Max max
View Source
var Min min

Functions

func ToOrdered

func ToOrdered(v any) any

func TypeMatch

func TypeMatch(v any, typ types.T) bool

Types

type Atomic

type Atomic[T any] struct {
	// contains filtered or unexported fields
}

func NewAtomic

func NewAtomic[T any](value T) *Atomic[T]

func (*Atomic[T]) Load

func (a *Atomic[T]) Load() T

func (*Atomic[T]) Store

func (a *Atomic[T]) Store(value T)

type BatchIter

type BatchIter func() (tuple []Nullable)

func NewBatchIter

func NewBatchIter(b *batch.Batch) BatchIter

type Bool

type Bool bool

func (Bool) Less

func (b Bool) Less(than Bool) bool

type Bytes

type Bytes []byte

func (Bytes) Less

func (b Bytes) Less(than Bytes) bool

type Float

type Float float64

func (Float) Less

func (f Float) Less(than Float) bool

type ID

type ID = memoryengine.ID

type IndexEntry

type IndexEntry[
	K Ordered[K],
	V any,
] struct {
	Index Tuple
	Key   K
}

type IndexIter

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

func (*IndexIter[K, V]) Close

func (i *IndexIter[K, V]) Close() error

func (*IndexIter[K, V]) First

func (i *IndexIter[K, V]) First() bool

func (*IndexIter[K, V]) Next

func (i *IndexIter[K, V]) Next() bool

func (*IndexIter[K, V]) Read

func (i *IndexIter[K, V]) Read() (*IndexEntry[K, V], error)

type Int

type Int int64

func (Int) Less

func (i Int) Less(than Int) bool

type Iter

type Iter[T any] interface {
	First() bool
	Next() bool
	Close() error
	Read() (T, error)
}

type KVIter

type KVIter[K any, V any] interface {
	First() bool
	Seek(K) bool
	Next() bool
	Close() error
	Read() (K, V, error)
}

type KVPair

type KVPair[
	K Ordered[K],
	V any,
] struct {
	Key K

	ID      int64
	Value   V
	Indexes []Tuple
}

func (*KVPair[K, V]) String

func (k *KVPair[K, V]) String() string

type Nullable

type Nullable struct {
	IsNull bool
	Value  any
}

func VectorAt

func VectorAt(vec *vector.Vector, i int) (value Nullable)

func (Nullable) AppendVector

func (n Nullable) AppendVector(
	vec *vector.Vector, mp *mpool.MPool)

func (Nullable) Equal

func (n Nullable) Equal(n2 Nullable) bool

type Ordered

type Ordered[To any] interface {
	Less(to To) bool
}

type Row

type Row[K any, V any] interface {
	Key() K
	Value() V
	Indexes() []Tuple
	UniqueIndexes() []Tuple
}

type Table

type Table[
	K Ordered[K],
	V any,
	R Row[K, V],
] struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewTable

func NewTable[
	K Ordered[K],
	V any,
	R Row[K, V],
]() *Table[K, V, R]

func (*Table[K, V, R]) Delete

func (t *Table[K, V, R]) Delete(
	tx *Transaction,
	key K,
) (
	err error,
)

func (*Table[K, V, R]) EraseHistory

func (t *Table[K, V, R]) EraseHistory(before Time)

func (*Table[K, V, R]) Get

func (t *Table[K, V, R]) Get(
	tx *Transaction,
	key K,
) (
	value V,
	err error,
)

func (*Table[K, V, R]) Index

func (t *Table[K, V, R]) Index(tx *Transaction, index Tuple) (entries []*IndexEntry[K, V], err error)

func (*Table[K, V, R]) Insert

func (t *Table[K, V, R]) Insert(
	tx *Transaction,
	row R,
) (
	err error,
)

func (*Table[K, V, R]) NewIndexIter

func (t *Table[K, V, R]) NewIndexIter(tx *Transaction, min Tuple, max Tuple) (*IndexIter[K, V], error)

func (*Table[K, V, R]) NewIter

func (t *Table[K, V, R]) NewIter(tx *Transaction) (*TableIter[K, V], error)

func (*Table[K, V, R]) Update

func (t *Table[K, V, R]) Update(
	tx *Transaction,
	row R,
) (
	err error,
)

func (*Table[K, V, R]) Upsert

func (t *Table[K, V, R]) Upsert(
	tx *Transaction,
	row R,
) (
	err error,
)

type TableIter

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

func (*TableIter[K, V]) Close

func (t *TableIter[K, V]) Close() error

func (*TableIter[K, V]) First

func (t *TableIter[K, V]) First() bool

func (*TableIter[K, V]) Next

func (t *TableIter[K, V]) Next() bool

func (*TableIter[K, V]) Read

func (t *TableIter[K, V]) Read() (key K, value V, err error)

func (*TableIter[K, V]) Seek

func (t *TableIter[K, V]) Seek(key K) bool

type Text

type Text string

func (Text) Less

func (t Text) Less(than Text) bool

type Time

type Time = timestamp.Timestamp

func Now

func Now(clock clock.Clock) Time

type Transaction

type Transaction struct {
	State     *Atomic[TransactionState]
	BeginTime Time
	// contains filtered or unexported fields
}

func NewTransaction

func NewTransaction(
	beginTime Time,
) *Transaction

func (*Transaction) Abort

func (t *Transaction) Abort() error

func (*Transaction) Commit

func (t *Transaction) Commit(commitTime Time) error

type TransactionState

type TransactionState uint8
const (
	Active TransactionState = iota
	Committed
	Aborted
)

func (TransactionState) String

func (t TransactionState) String() string

type Tuple

type Tuple []any

func (Tuple) Less

func (t Tuple) Less(than Tuple) bool

type Uint

type Uint int64

func (Uint) Less

func (i Uint) Less(than Uint) bool

Jump to

Keyboard shortcuts

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