Documentation ¶
Index ¶
- Constants
- Variables
- func ClampTime(t int64, pw uint8) int64
- type ChangedRange
- type QTree
- func (tr *QTree) Commit()
- func (tr *QTree) DeleteRange(start int64, end int64) error
- func (tr *QTree) FindChangedSince(gen uint64, resolution uint8) chan ChangedRange
- func (tr *QTree) FindChangedSinceSlice(gen uint64, resolution uint8) []ChangedRange
- func (n *QTree) FindNearestValue(time int64, backwards bool) (Record, error)
- func (n *QTree) Generation() uint64
- func (n *QTree) GetAllReferencedVAddrs() chan uint64
- func (tr *QTree) GetReferencedAddrsDebug() map[uint64]bool
- func (tr *QTree) InsertValues(records []Record) (e error)
- func (tr *QTree) LoadNode(addr uint64, impl_Generation uint64, impl_Pointwidth uint8, ...) (*QTreeNode, error)
- func (tr *QTree) NewCoreNode(startTime int64, pointWidth uint8) (*QTreeNode, error)
- func (tr *QTree) NewVectorNode(startTime int64, pointWidth uint8) (*QTreeNode, error)
- func (tr *QTree) QueryStatisticalValues(rv chan StatRecord, err chan error, start int64, end int64, pw uint8)
- func (tr *QTree) QueryStatisticalValuesBlock(start int64, end int64, pw uint8) ([]StatRecord, error)
- func (tr *QTree) QueryWindow(start int64, end int64, width uint64, depth uint8, rv chan StatRecord)
- func (tr *QTree) ReadStandardValuesBlock(start int64, end int64) ([]Record, error)
- func (tr *QTree) ReadStandardValuesCI(rv chan Record, err chan error, start int64, end int64)
- type QTreeNode
- func (n *QTreeNode) ArbitraryStartTime(idx uint64, pw uint8) int64
- func (n *QTreeNode) AssertNewUpPatch() (*QTreeNode, error)
- func (n *QTreeNode) Child(i uint16) *QTreeNode
- func (n *QTreeNode) ChildEndTime(idx uint16) int64
- func (n *QTreeNode) ChildPW() uint8
- func (n *QTreeNode) ChildStartTime(idx uint16) int64
- func (n *QTreeNode) ClampBucket(t int64) uint16
- func (n *QTreeNode) ClampVBucket(t int64, pw uint8) uint64
- func (n *QTreeNode) ConvertToCore(newvals []Record) *QTreeNode
- func (n *QTreeNode) DeleteRange(start int64, end int64) *QTreeNode
- func (n *QTreeNode) EndTime() int64
- func (n *QTreeNode) FindChangedSince(gen uint64, rchan chan ChangedRange, resolution uint8) ChangedRange
- func (n *QTreeNode) FindNearestValue(time int64, backwards bool) (Record, error)
- func (n *QTreeNode) FindParentIndex() (uint16, error)
- func (n *QTreeNode) Free()
- func (n *QTreeNode) Generation() uint64
- func (n *QTreeNode) GetAllReferencedVAddrs(rchan chan uint64)
- func (n *QTreeNode) HasChild(i uint16) bool
- func (n *QTreeNode) InsertValues(records []Record) (*QTreeNode, error)
- func (n *QTreeNode) MergeIntoVector(r []Record)
- func (n *QTreeNode) OpCountMean() (uint64, float64)
- func (n *QTreeNode) OpMax() float64
- func (n *QTreeNode) OpMin() float64
- func (n *QTreeNode) OpReduce(pointwidth uint8, index uint64) (uint64, float64, float64, float64)
- func (n *QTreeNode) Parent() *QTreeNode
- func (n *QTreeNode) PointWidth() uint8
- func (n *QTreeNode) PrebufferChild(i uint16)
- func (n *QTreeNode) PrintCounts(indent int)
- func (n *QTreeNode) QueryStatisticalValues(rv chan StatRecord, err chan error, start int64, end int64, pw uint8)
- func (n *QTreeNode) QueryWindow(end int64, nxtstart *int64, width uint64, depth uint8, rv chan StatRecord, ...)
- func (n *QTreeNode) ReadStandardValuesCI(rv chan Record, err chan error, start int64, end int64)
- func (n *QTreeNode) SetChild(idx uint16, c *QTreeNode)
- func (n *QTreeNode) StartTime() int64
- func (n *QTreeNode) ThisAddr() uint64
- func (n *QTreeNode) TreePath() string
- func (n *QTreeNode) WidthTime() int64
- type Record
- type RecordSlice
- type StatRecord
- type WindowContext
Constants ¶
const DAY = 24 * HOUR
const HOUR = 60 * MINUTE
const KFACTOR = bstore.KFACTOR
const MICROSECOND = 1000
const MILLISECOND = 1000 * MICROSECOND
const MINUTE = 60 * SECOND
const MaximumTime = (48 << 56)
const MinimumTime = -(16 << 56)
const PWFACTOR = bstore.PWFACTOR
const ROOTPW = 56 //This makes each bucket at the root ~= 2.2 years
const ROOTSTART = -1152921504606846976 //This makes the 16th bucket start at 1970 (0)
so the root spans 146.23 years
const SECOND = 1000 * MILLISECOND
Variables ¶
var ErrBadDelete = errors.New("Bad delete")
var ErrBadInsert = errors.New("Bad insert")
var ErrBadTimeRange error = errors.New("Invalid time range")
var ErrIdxNotFound = errors.New("Index not found")
var ErrImmutableTree = errors.New("Tree is immutable")
var ErrNoSuchPoint = errors.New("No such point")
var ErrNoSuchStream = errors.New("No such stream")
var ErrNotLeafNode = errors.New("Not a leaf node")
Functions ¶
Types ¶
type ChangedRange ¶
type QTree ¶
type QTree struct {
// contains filtered or unexported fields
}
func NewWriteQTree ¶
func (*QTree) FindChangedSince ¶
func (tr *QTree) FindChangedSince(gen uint64, resolution uint8) chan ChangedRange
func (*QTree) FindChangedSinceSlice ¶
func (tr *QTree) FindChangedSinceSlice(gen uint64, resolution uint8) []ChangedRange
func (*QTree) FindNearestValue ¶
func (*QTree) Generation ¶
func (*QTree) GetAllReferencedVAddrs ¶
Holy shit these take a long time
func (*QTree) GetReferencedAddrsDebug ¶
func (*QTree) InsertValues ¶
*
- This function is for inserting a large chunk of data. It is required
- that the data is sorted, so we do that here
func (*QTree) NewCoreNode ¶
func (*QTree) NewVectorNode ¶
func (*QTree) QueryStatisticalValues ¶
func (*QTree) QueryStatisticalValuesBlock ¶
func (*QTree) QueryWindow ¶
QueryWindow queries for windows between start and end, with an explicit (arbitrary) width. End is exclusive
func (*QTree) ReadStandardValuesBlock ¶
type QTreeNode ¶
type QTreeNode struct {
// contains filtered or unexported fields
}
func (*QTreeNode) ArbitraryStartTime ¶
func (*QTreeNode) AssertNewUpPatch ¶
func (*QTreeNode) ChildEndTime ¶
func (*QTreeNode) ChildStartTime ¶
func (*QTreeNode) ClampBucket ¶
func (*QTreeNode) ClampVBucket ¶
Unlike core nodes, vectors have infinitely many buckets. This function allows you to get a bucket idx for a time and an arbitrary point width
func (*QTreeNode) ConvertToCore ¶
We need to create a core node, insert all the vector data into it, and patch up the parent
func (*QTreeNode) FindChangedSince ¶
func (n *QTreeNode) FindChangedSince(gen uint64, rchan chan ChangedRange, resolution uint8) ChangedRange
TODO: consider deletes. I think that it will require checking if the generation of a core node is higher than all it's non-nil children. This implies that one or more children got deleted entirely, and then the node must report its entire time range as changed. it's not possible for a child to have an equal generation to the parent AND another node got deleted, as deletes and inserts do not get batched together. Also, if we know that a generation always corresponds to a contiguous range deletion (i.e we don't coalesce deletes) then we know that we couldn't have got a partial delete that bumped up a gen and masked another full delete. NOTE: We should return changes SINCE a generation, so strictly greater than.
func (*QTreeNode) FindNearestValue ¶
It is important to note that if backwards is true, then time is exclusive. So if a record exists with t=80 and t=100, and you query with t=100, backwards=true, you will get the t=80 record. For forwards, time is inclusive.
func (*QTreeNode) FindParentIndex ¶
func (*QTreeNode) Free ¶
func (n *QTreeNode) Free()
Although we keep caches of datablocks in the bstore, we can't actually free them until they are unreferenced. This dropcache actually just makes sure they are unreferenced
func (*QTreeNode) Generation ¶
func (*QTreeNode) GetAllReferencedVAddrs ¶
func (*QTreeNode) InsertValues ¶
*
- the process is:
- call insertvalues - returns new QTreeNode.
- this must have: address, stats
- and it must have put whatever it touched in the generation
- replace it in the child cache, change address + stats
- and return to parent
func (*QTreeNode) MergeIntoVector ¶
Here is where we would replace with fancy delta compression
func (*QTreeNode) OpCountMean ¶
func (*QTreeNode) OpReduce ¶
ok so here is the problem. If we call opreduce on a core node, then we can only deliver pointwidths GREATER than our pointwidth and less than pointwidth + 6 right? but as a leaf we can potentially deliver pointwidths down to 0...
func (*QTreeNode) PointWidth ¶
func (*QTreeNode) PrebufferChild ¶
func (*QTreeNode) PrintCounts ¶
func (*QTreeNode) QueryStatisticalValues ¶
func (*QTreeNode) QueryWindow ¶
func (n *QTreeNode) QueryWindow(end int64, nxtstart *int64, width uint64, depth uint8, rv chan StatRecord, ctx *WindowContext)
QueryWindow queries this node for an arbitrary window of time. ctx must be initialized, especially with Time. Holes will be emitted as blank records
func (*QTreeNode) ReadStandardValuesCI ¶
func (*QTreeNode) WidthTime ¶
So this might be the only explanation of how PW really relates to time: If the node is core, the node's PW is the log of the amount of time that each child covers. So a pw of 8 means that each child covers 1<<8 nanoseconds If the node is a vector, the PW represents what the PW would be if it were a core. It does NOT represent the PW of the vector itself.
type RecordSlice ¶
type RecordSlice []Record
func (RecordSlice) Len ¶
func (s RecordSlice) Len() int
func (RecordSlice) Less ¶
func (s RecordSlice) Less(i, j int) bool
func (RecordSlice) Swap ¶
func (s RecordSlice) Swap(i, j int)