Documentation ¶
Overview ¶
Package index implements gSuneido database indexes.
Indexes store pairs of string keys and uint64 offsets. Keys must be unique within a particular index.
Suneido style iterators (i.e. Next/Prev/Rewind) have a current key value and behave as if Next/Prev get the first value greater than or less than the current value, regardless of modifications to the data. e.g. the current or next value could be deleted, or a new next value inserted. However, their implementations use a current position to be more efficient. Although the iterators expose a Cur method, this is for internal purposes. The current value is only really valid immediately after Next or Prev. At the Suneido level Next and Prev return the new current value.
Index ¶
- type MergeResult
- type OverIter
- type Overlay
- func (ov *Overlay) BtreeLevels() int
- func (ov *Overlay) Check(fn func(uint64)) int
- func (ov *Overlay) CheckMerged()
- func (ov *Overlay) Cksum() uint32
- func (ov *Overlay) Copy() *Overlay
- func (ov *Overlay) Delete(key string, off uint64)
- func (ov *Overlay) GetIxspec() *ixkey.Spec
- func (ov *Overlay) Insert(key string, off uint64)
- func (ov *Overlay) Lookup(key string) uint64
- func (ov *Overlay) Merge(nmerge int) MergeResult
- func (ov *Overlay) Modified() bool
- func (ov *Overlay) Mutable() *Overlay
- func (ov *Overlay) Nlayers() int
- func (ov *Overlay) Print()
- func (ov *Overlay) QuickCheck()
- func (ov *Overlay) RangeFrac(org, end string, nrecs int) float64
- func (ov *Overlay) Save() SaveResult
- func (ov *Overlay) SetIxspec(is *ixkey.Spec)
- func (ov *Overlay) Stats() btree.Stats
- func (ov *Overlay) StorSize() int
- func (ov *Overlay) Update(key string, off uint64)
- func (ov *Overlay) UpdateWith(latest *Overlay)
- func (ov *Overlay) WithMerged(mr MergeResult, nmerged int) *Overlay
- func (ov *Overlay) WithSaved(bt SaveResult) *Overlay
- func (ov *Overlay) Write(w *stor.Writer)
- type Range
- type SaveResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MergeResult ¶
type OverIter ¶
type OverIter struct {
// contains filtered or unexported fields
}
OverIter is a Suneido style iterator that merges several other Suneido style iterators.
OverIter also tracks read ranges for transaction conflict checking.
func NewOverIter ¶
type Overlay ¶
type Overlay struct {
// contains filtered or unexported fields
}
Overlay is the composite in-memory representation of an index
func OverlayFor ¶
func ReadOverlay ¶
ReadOverlay reads an Overlay from storage BUT without ixspec
func (*Overlay) BtreeLevels ¶
func (*Overlay) CheckMerged ¶
func (ov *Overlay) CheckMerged()
func (*Overlay) Delete ¶
Delete either deletes the key/offset from the mutable ixbuf.T or inserts a tombstone into the mutable ixbuf.T.
func (*Overlay) Lookup ¶
Lookup returns the offset of the record specified by the key or 0 if it's not found. It handles the Delete bit and removes the Update bit.
func (*Overlay) Merge ¶
func (ov *Overlay) Merge(nmerge int) MergeResult
Merge merges the base ixbuf with one or more of the transaction ixbuf's to produce a new base ixbuf. It does not modify the original ixbuf's.
func (*Overlay) Modified ¶
Modified is used by info.Persist. It only looks at the base ixbuf (layer[0]) which accumulates changes between persists via merging other per transaction ixbuf's.
func (*Overlay) QuickCheck ¶
func (ov *Overlay) QuickCheck()
func (*Overlay) Save ¶
func (ov *Overlay) Save() SaveResult
Save updates the stored btree with the base ixbuf and returns the new btree to later pass to WithSaved
func (*Overlay) UpdateWith ¶
UpdateWith combines the overlay result of a transaction with the latest overlay. It is called by Meta.LayeredOnto. The immutable part of ov was taken at the start of the transaction so it will be out of date. The checker ensures that the updates are independent.
func (*Overlay) WithMerged ¶
func (ov *Overlay) WithMerged(mr MergeResult, nmerged int) *Overlay
WithMerged is called by Meta.ApplyMerge
func (*Overlay) WithSaved ¶
func (ov *Overlay) WithSaved(bt SaveResult) *Overlay
WithSaved returns a new Overlay, combining the current state (ov) with the updated btree (in ov2)
type SaveResult ¶
Directories ¶
Path | Synopsis |
---|---|
Package ixbuf defines an ordered list ixbuf.T with a mutating Insert and a immutable persistent Merge.
|
Package ixbuf defines an ordered list ixbuf.T with a mutating Insert and a immutable persistent Merge. |
Package ixkey handles specifying and encoding index key strings that are directly comparable.
|
Package ixkey handles specifying and encoding index key strings that are directly comparable. |