Documentation ¶
Overview ¶
Package timeseries defines the interface for managing time seres objects and provides time range manipulation capabilities
Index ¶
- Constants
- type Extent
- type ExtentList
- func (el ExtentList) Clone() ExtentList
- func (el ExtentList) Compress(step time.Duration) ExtentList
- func (el ExtentList) Crop(e Extent) ExtentList
- func (el ExtentList) InsideOf(e Extent) bool
- func (el ExtentList) Len() int
- func (el ExtentList) Less(i, j int) bool
- func (el ExtentList) OutsideOf(e Extent) bool
- func (el ExtentList) Size() int
- func (el ExtentList) String() string
- func (el ExtentList) Swap(i, j int)
- type ExtentListLRU
- type TimeRangeQuery
- type Timeseries
Constants ¶
const FastForwardUserDisableFlag = "trickster-fast-forward:off"
FastForwardUserDisableFlag is a string that is checked to determine if Fast Forward should be selectively disabled for the provided query
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Extent ¶
type Extent struct { Start time.Time `json:"start"` End time.Time `json:"end"` LastUsed time.Time `json:"-"` }
Extent describes the start and end times for a given range of data
func (*Extent) After ¶
After returns true if the range of the Extent is completely after the provided time
type ExtentList ¶
type ExtentList []Extent
ExtentList is a type of []Extent used for sorting the slice
func (ExtentList) Clone ¶
func (el ExtentList) Clone() ExtentList
Clone returns a true copy of the ExtentList
func (ExtentList) Compress ¶
func (el ExtentList) Compress(step time.Duration) ExtentList
Compress sorts an ExtentList and merges time-adjacent Extents so that the total extent of data is accurately represented in as few Extents as possible
func (ExtentList) Len ¶
func (el ExtentList) Len() int
Len returns the length of a slice of type ExtentList
func (ExtentList) Less ¶
func (el ExtentList) Less(i, j int) bool
Less returns true if element i in the ExtentList comes before j
func (ExtentList) Size ¶
func (el ExtentList) Size() int
Size returns the approximate memory utilization in bytes of the timeseries
func (ExtentList) String ¶
func (el ExtentList) String() string
String returns a string representation of the extentlist in the format startEpochSec1-endEpochSec1;startEpochSec2-endEpochSec2
func (ExtentList) Swap ¶
func (el ExtentList) Swap(i, j int)
Swap modifies an ExtentList by swapping the values in indexes i and j
type ExtentListLRU ¶
type ExtentListLRU []Extent
ExtentListLRU is a type of []Extent used for sorting the slice by LRU
func (ExtentListLRU) Clone ¶
func (el ExtentListLRU) Clone() ExtentListLRU
Clone returns a true copy of the ExtentListLRU
func (ExtentListLRU) Len ¶
func (el ExtentListLRU) Len() int
Len returns the length of an slice of type ExtentListLRU
func (ExtentListLRU) Less ¶
func (el ExtentListLRU) Less(i, j int) bool
Less returns true if element i in the ExtentListLRU comes before j
func (ExtentListLRU) String ¶
func (el ExtentListLRU) String() string
func (ExtentListLRU) Swap ¶
func (el ExtentListLRU) Swap(i, j int)
Swap modifies an ExtentListLRU by swapping the values in indexes i and j
func (ExtentListLRU) UpdateLastUsed ¶
func (el ExtentListLRU) UpdateLastUsed(lur Extent, step time.Duration) ExtentListLRU
UpdateLastUsed updates the ExtentListLRU's LastUsed field for the provided extent. The step is required in order to properly split extents.
type TimeRangeQuery ¶
type TimeRangeQuery struct { // Statement is the timeseries database query (with tokenized timeranges where present) requested by the user Statement string // Extent provides the start and end times for the request from a timeseries database Extent Extent // Step indicates the amount of time in seconds between each datapoint in a TimeRangeQuery's resulting timeseries Step time.Duration // IsOffset is true if the query uses a relative offset modifier IsOffset bool // TimestampFieldName indicates the database field name for the timestamp field TimestampFieldName string // FastForwardDisable indicates whether the Time Range Query result should include fast forward data FastForwardDisable bool // TemplateURL is used by some Origin Types for templatization of url parameters containing timestamps TemplateURL *url.URL }
TimeRangeQuery represents a timeseries database query parsed from an inbound HTTP request
func (*TimeRangeQuery) CalculateDeltas ¶
func (trq *TimeRangeQuery) CalculateDeltas(have ExtentList) ExtentList
CalculateDeltas provides a list of extents that are not in a cached timeseries, when provided a list of extents that are cached.
func (*TimeRangeQuery) Clone ¶
func (trq *TimeRangeQuery) Clone() *TimeRangeQuery
Clone returns an exact copy of a TimeRangeQuery
func (*TimeRangeQuery) GetBackfillTolerance ¶
func (trq *TimeRangeQuery) GetBackfillTolerance(def time.Duration) time.Duration
GetBackfillTolerance will return the backfill tolerance for the query based on the provided default, and any query-specific tolerance directives included in the query comments
func (*TimeRangeQuery) NormalizeExtent ¶
func (trq *TimeRangeQuery) NormalizeExtent()
NormalizeExtent adjusts the Start and End of a TimeRangeQuery's Extent to align against normalized boundaries.
func (*TimeRangeQuery) String ¶
func (trq *TimeRangeQuery) String() string
type Timeseries ¶
type Timeseries interface { // SetExtents sets the Extents of the Timeseries SetExtents(ExtentList) // Extents should return the list of time Extents having data present in the Timeseries Extents() ExtentList // TimeStampCount should return the number of unique timestamps across the timeseries TimestampCount() int // Step should return the Step Interval of the Timeseries Step() time.Duration // SetStep should update the Step Interval of the Timeseries SetStep(time.Duration) // Merge should merge the Timeseries collection into the source Timeseries Merge(bool, ...Timeseries) // Sort should uniqueify and sort all series by Timestamp Sort() // Clone should returns an exact duplicate source the Timeseries Clone() Timeseries // CropToRange should reduce time range of the Timeseries to the provided Extent CropToRange(Extent) // CropToSize should reduce time range of the Timeseries to the provided element size using // a least-recently-used methodology, while limiting the upper extent to the provided time, // in order to support backfill tolerance CropToSize(int, time.Time, Extent) // SeriesCount returns the number of individual Series in the Timeseries object SeriesCount() int // ValueCount returns the count of all values across all Series in the Timeseries object ValueCount() int // Size returns the approximate memory byte size of the timeseries object Size() int }
Timeseries represents a Response Object from a Timeseries Database