Documentation
¶
Index ¶
- Constants
- Variables
- func CompareAevt(ai, bi interface{}) int
- func CompareAevtIndex(tData TransposedData, idx int, datom Datom) int
- func CompareAvet(ai, bi interface{}) int
- func CompareAvetIndex(tData TransposedData, idx int, datom Datom) int
- func CompareEavt(ai, bi interface{}) int
- func CompareEavtIndex(tData TransposedData, idx int, datom Datom) int
- func CompareVaet(ai, bi interface{}) int
- func CompareVaetIndex(tData TransposedData, idx int, datom Datom) int
- func GetFromCache(store store.Store, id string) interface{}
- func SegmentWriteHandler(w *fressian.Writer, val interface{}) error
- type Cache
- type CompareFn
- type Datom
- func (d Datom) A() int
- func (d Datom) Added() bool
- func (d Datom) Attribute() int
- func (d Datom) E() int
- func (d Datom) Entity() int
- func (d Datom) Retraction() Datom
- func (d Datom) String() string
- func (d Datom) Transaction() int
- func (d Datom) Tx() int
- func (d Datom) V() Value
- func (d Datom) Value() Value
- type Directory
- type Index
- type Iterator
- type MemoryIndex
- func (mi MemoryIndex) AddDatoms(datoms []Datom) *MemoryIndex
- func (i *MemoryIndex) Count() int
- func (mi MemoryIndex) Datoms() Iterator
- func (mi MemoryIndex) DatomsAt(start, end Datom) Iterator
- func (mi MemoryIndex) SeekDatoms(start Datom) Iterator
- func (i *MemoryIndex) UseCompare(compare comparable.CompareFn)
- type MergedIndex
- type Root
- type SegmentedIndex
- type TransposedData
- type Type
- type Value
- type ValueType
Constants ¶
View Source
const ( Eavt = Type("eavt") Aevt = Type("aevt") Avet = Type("avet") Vaet = Type("vaet") )
Variables ¶
View Source
var MemoryReadHandlers = map[string]fressian.ReadHandler{ "mu.memory.Index": func(r *fressian.Reader, tag string, fieldCount int) interface{} { datomsRaw, _ := r.ReadValue() datoms := datomsRaw.(*btset.Set) return &MemoryIndex{datoms} }, "btset.Set": btset.ReadHandlers["btset.Set"], "btset.PointerNode": btset.ReadHandlers["btset.PointerNode"], "btset.LeafNode": btset.ReadHandlers["btset.LeafNode"], }
View Source
var MemoryWriteHandler fressian.WriteHandler = func(w *fressian.Writer, val interface{}) error { switch val := val.(type) { case *MemoryIndex: return w.WriteExt("mu.memory.Index", val.datoms) case *MergedIndex: return w.WriteExt("mu.memory.Index", val.memory.datoms) default: return defaultHandler(w, val) } }
View Source
var MinDatom = Datom{0, 0, MinValue, 0, false}
View Source
var ReadHandlers = map[string]fressian.ReadHandler{ "mu.Datom": func(r *fressian.Reader, tag string, fieldCount int) interface{} { entityRaw, _ := r.ReadValue() attributeRaw, _ := r.ReadValue() valueRaw, _ := r.ReadValue() addedRaw, _ := r.ReadValue() transactionRaw, _ := r.ReadValue() return &Datom{ entityRaw.(int), attributeRaw.(int), NewValue(valueRaw), txOffset + transactionRaw.(int), addedRaw.(bool), } }, }
View Source
var SegmentReadHandlers = map[string]fressian.ReadHandler{ "index-root-node": func(r *fressian.Reader, tag string, fieldCount int) interface{} { tData, _ := r.ReadValue() directoriesRaw, _ := r.ReadValue() directories := make([]string, len(directoriesRaw.([]interface{}))) for i, dir := range directoriesRaw.([]interface{}) { directories[i] = dir.(fressian.UUID).String() } return Root{ tData: tData.(TransposedData), directories: directories, } }, "index-tdata": func(r *fressian.Reader, tag string, fieldCount int) interface{} { vs, _ := r.ReadValue() es, _ := r.ReadValue() as, _ := r.ReadValue() txs, _ := r.ReadValue() addeds, _ := r.ReadValue() transactions := make([]int, len(txs.([]int))) for i, tx := range txs.([]int) { transactions[i] = 3*(1<<42) + tx } var values []interface{} if values != nil { values = vs.([]interface{}) } return TransposedData{ entities: es.([]int), attributes: as.([]int), values: values, transactions: transactions, addeds: addeds.([]bool), } }, "index-dir-node": func(r *fressian.Reader, tag string, fieldCount int) interface{} { tData, _ := r.ReadValue() segmentsRaw, _ := r.ReadValue() mystery1, _ := r.ReadValue() mystery2, _ := r.ReadValue() segments := make([]string, len(segmentsRaw.([]interface{}))) for i, dir := range segmentsRaw.([]interface{}) { segments[i] = dir.(fressian.UUID).String() } return Directory{ tData: tData.(TransposedData), segments: segments, mystery1: mystery1.([]int), mystery2: mystery2.([]int), } }, }
View Source
var WriteHandler fressian.WriteHandler = func(w *fressian.Writer, val interface{}) error { switch val := val.(type) { case *Datom: return w.WriteExt("mu.Datom", val.entity, val.attribute, val.value, val.added, val.transaction%txOffset) case Value: return w.WriteValue(val.val) default: return fressian.DefaultHandler(w, val) } }
Functions ¶
func CompareAevt ¶
func CompareAevt(ai, bi interface{}) int
func CompareAevtIndex ¶
func CompareAevtIndex(tData TransposedData, idx int, datom Datom) int
func CompareAvet ¶
func CompareAvet(ai, bi interface{}) int
func CompareAvetIndex ¶
func CompareAvetIndex(tData TransposedData, idx int, datom Datom) int
func CompareEavt ¶
func CompareEavt(ai, bi interface{}) int
func CompareEavtIndex ¶
func CompareEavtIndex(tData TransposedData, idx int, datom Datom) int
func CompareVaet ¶
func CompareVaet(ai, bi interface{}) int
func CompareVaetIndex ¶
func CompareVaetIndex(tData TransposedData, idx int, datom Datom) int
func GetFromCache ¶
func SegmentWriteHandler ¶
Types ¶
type Datom ¶
type Datom struct {
// contains filtered or unexported fields
}
func (Datom) Retraction ¶
func (Datom) Transaction ¶
type MemoryIndex ¶
type MemoryIndex struct {
// contains filtered or unexported fields
}
func NewMemoryIndex ¶
func NewMemoryIndex(compare comparable.CompareFn) *MemoryIndex
func (MemoryIndex) AddDatoms ¶
func (mi MemoryIndex) AddDatoms(datoms []Datom) *MemoryIndex
func (*MemoryIndex) Count ¶
func (i *MemoryIndex) Count() int
func (MemoryIndex) Datoms ¶
func (mi MemoryIndex) Datoms() Iterator
func (MemoryIndex) DatomsAt ¶
func (mi MemoryIndex) DatomsAt(start, end Datom) Iterator
func (MemoryIndex) SeekDatoms ¶
func (mi MemoryIndex) SeekDatoms(start Datom) Iterator
func (*MemoryIndex) UseCompare ¶
func (i *MemoryIndex) UseCompare(compare comparable.CompareFn)
type MergedIndex ¶
type MergedIndex struct {
// contains filtered or unexported fields
}
func NewMergedIndex ¶
func NewMergedIndex(mi *MemoryIndex, si *SegmentedIndex, compare comparable.CompareFn) *MergedIndex
func (MergedIndex) AddDatoms ¶
func (mi MergedIndex) AddDatoms(datoms []Datom) *MergedIndex
func (MergedIndex) Datoms ¶
func (mi MergedIndex) Datoms() Iterator
func (MergedIndex) DatomsAt ¶
func (mi MergedIndex) DatomsAt(start, end Datom) Iterator
func (MergedIndex) SeekDatoms ¶
func (mi MergedIndex) SeekDatoms(start Datom) Iterator
type SegmentedIndex ¶
type SegmentedIndex struct {
// contains filtered or unexported fields
}
func NewSegmentedIndex ¶
func NewSegmentedIndex(root *Root, store store.Store, compare CompareFn) *SegmentedIndex
func (SegmentedIndex) Datoms ¶
func (si SegmentedIndex) Datoms() Iterator
func (SegmentedIndex) DatomsAt ¶
func (si SegmentedIndex) DatomsAt(start, end Datom) Iterator
func (SegmentedIndex) SeekDatoms ¶
func (si SegmentedIndex) SeekDatoms(start Datom) Iterator
type TransposedData ¶
type TransposedData struct {
// contains filtered or unexported fields
}
func (TransposedData) DatomAt ¶
func (t TransposedData) DatomAt(idx int) Datom
func (TransposedData) Find ¶
func (t TransposedData) Find(compare CompareFn, datom Datom) int
Find finds the closest (first) datom that is greater or equal to `datom`.
invariants:
- returns len(t.entities) if all datoms are smaller
- the datom at the index is greater or equal
func (TransposedData) FindApprox ¶
func (t TransposedData) FindApprox(compare CompareFn, datom Datom) int
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
func (Value) Compare ¶
func (v Value) Compare(ovc comparable.Comparable) int
Click to show internal directories.
Click to hide internal directories.