Documentation ¶
Index ¶
- Constants
- type DISTIL
- func (d *DISTIL) BTrDBConn() *btrdb.BTrDB
- func (ds *DISTIL) MakeOrGetByPath(path string, unit string) *Stream
- func (ds *DISTIL) MakeOrGetByPaths(paths []string, units []string) []*Stream
- func (ds *DISTIL) RegisterDistillate(r *Registration)
- func (ds *DISTIL) StartEngine()
- func (ds *DISTIL) StreamFromPath(path string) *Stream
- func (ds *DISTIL) StreamFromUUID(id uuid.UUID) *Stream
- func (ds *DISTIL) StreamsFromPaths(paths []string) ([]*Stream, error)
- func (ds *DISTIL) StreamsFromUUIDs(ids []uuid.UUID) []*Stream
- type Distillate
- type DistillateTools
- type InputSet
- type IterationResult
- type OutputSet
- type Point
- type Rebaser
- type Registration
- type Stream
- func (s *Stream) ChangesBetween(oldversion uint64, newversion uint64) []TimeRange
- func (s *Stream) CurrentVersion() uint64
- func (s *Stream) EraseRange(r TimeRange)
- func (s *Stream) Exists() bool
- func (s *Stream) GetPoints(r TimeRange, rebase Rebaser, version uint64) []Point
- func (s *Stream) SetTagVersion(uniqueName string, version uint64)
- func (s *Stream) TagVersion(uniqueName string) uint64
- func (s *Stream) WritePoints(pts []Point)
- type TimeRange
Constants ¶
const MaxVersionSet = 100
This is the maximum number of versions that will be processed at once
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DISTIL ¶
type DISTIL struct {
// contains filtered or unexported fields
}
DISTIL is a handle to the distil engine, including it's connections to BTrDB
func NewDISTIL ¶
func NewDISTIL() *DISTIL
NewDISTIL creates a DISTIL handle by connecting to the given BTrDB and MongoDB addresses
func (*DISTIL) MakeOrGetByPath ¶
This is the same as StreamFromPath, but if the path does not exist, it will create the stream NOTE: This function should NOT be called concurrently with the same path.
func (*DISTIL) MakeOrGetByPaths ¶
Same as MakeOrGetByPath but does multiple
func (*DISTIL) RegisterDistillate ¶
func (ds *DISTIL) RegisterDistillate(r *Registration)
RegisterDistillate needs to be called once per instance of distillate with a populated Registration struct. Do not reuse the Registration struct, it is owned by the engine after this call.
func (*DISTIL) StartEngine ¶
func (ds *DISTIL) StartEngine()
StartEngine begins processing distillates. It does not return
func (*DISTIL) StreamFromPath ¶
Obtain a stream based on a path
func (*DISTIL) StreamFromUUID ¶
Obtain a Stream given a UUID
func (*DISTIL) StreamsFromPaths ¶
Obtain multiple streams based on paths
type Distillate ¶
type Distillate interface { // Get the version of the algorithm implemented by this distillate. // Future revisions of the DISTIL engine will allow for recalculation // of the entire stream when the Version() changes. Version() int // Get the number of nanoseconds that should be loaded ahead of the // time range that has changed, available as negative sample indices // in Process() LeadNanos() int64 // Get the Rebase stage for this distillate Rebase() Rebaser // This is used by the Engine to configure a handle for your // distillate to access DISTIL. The handle can be used any time // after registration with the DS field: // // var handle *distil.DISTIL = myDistillate.DS // SetEngine(ds *DISTIL) // This is called once per changed range to compute the output data // corresponding to the changes in the input data Process(*InputSet, *OutputSet) }
Distillate is the interface that all algorithms must implement in order for them to be registerable with the DISTIL engine. DistillateTools can be used to obtain default implementations
type DistillateTools ¶
type DistillateTools struct {
DS *DISTIL
}
DistillateTools is intended to provide default implementations of the Distillate interface, and is included in a Distillate like so:
type MyDistillate struct { distil.DistillateTools //your additional fields }
func (*DistillateTools) LeadNanos ¶
func (dd *DistillateTools) LeadNanos() int64
Default LeadNanos() that returns 0
func (*DistillateTools) Rebase ¶
func (dd *DistillateTools) Rebase() Rebaser
Default Rebase() which does not modify the data
func (*DistillateTools) SetEngine ¶
func (dd *DistillateTools) SetEngine(ds *DISTIL)
func (*DistillateTools) Version ¶
func (dd *DistillateTools) Version() int
Default Version() that returns 1
type InputSet ¶
type InputSet struct {
// contains filtered or unexported fields
}
An InputSet is passed to the Process method of a distillate, it contains preloaded data for the changed time range (plus any lead time).
func (*InputSet) Get ¶
Get a data point from the InputSet, stream is an index into the InputPaths declared in the registration, sample is the point you wish to get. Sample 0 is the first sample in the changed range. Negative indices are lead samples (see LeadNanos) that can be used for context.
func (*InputSet) GetRange ¶
Get the time range that has changed that is being processed. This does not include lead time
func (*InputSet) NumLeadSamples ¶
Get the number of negative samples (lead samples) in the given stream
func (*InputSet) NumSamples ¶
Get the number of positive samples in the given stream
type IterationResult ¶
type IterationResult int
const Abort IterationResult = 3
const NoData IterationResult = 2
const ProcessedData IterationResult = 1
type OutputSet ¶
type OutputSet struct {
// contains filtered or unexported fields
}
OutputSet is a handle onto the output streams and is used for writing back data from processing
func (*OutputSet) SetRange ¶
Set the time range that this OutputSet is responsible for. This must be done before any points are added, and any points outside this range will be discarded. Any points that existed in the stream before the current Process that lie within this range will be deleted and replaced by the data in the current output set
type Rebaser ¶
This specifies an input data preprocessor. It may do anything, but is typically used for rebasing input streams (removing duplicates and) padding missing values
func RebasePadSnap ¶
func RebasePassthrough ¶
func RebasePassthrough() Rebaser
Return a rebaser that does not modify input data
type Registration ¶
type Registration struct { Instance Distillate UniqueName string InputPaths []string OutputPaths []string OutputUnits []string }
Registration is a handle to a specific instance of a distillate, along with the information required to prepare it it
type Stream ¶
type Stream struct {
// contains filtered or unexported fields
}
Stream represents a handle on a specific stream and can be used for querying and inserting data on it. You should not need to use this directly
func (*Stream) ChangesBetween ¶
Obtain the changed ranges between the two versions
func (*Stream) CurrentVersion ¶
Get the current version of the stream
func (*Stream) EraseRange ¶
Erase everything in the stream that falls inside the given time range
func (*Stream) SetTagVersion ¶
Set the last version of the stream that uniqueName processed
func (*Stream) TagVersion ¶
Get the last version of the stream that uniqueName processed
func (*Stream) WritePoints ¶
Write the given points to the stream