mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-26 22:19:40 -08:00
Implied simplifications.
This commit is contained in:
parent
51a0f21cf8
commit
fd47ac570f
|
@ -370,18 +370,15 @@ func optimizeForward(pending ops) (out ops) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
firstOperation = pending[0]
|
head op = pending[0]
|
||||||
|
tail ops
|
||||||
)
|
)
|
||||||
|
|
||||||
pending = pending[1:len(pending)]
|
pending = pending[1:len(pending)]
|
||||||
|
|
||||||
switch t := firstOperation.(type) {
|
switch t := head.(type) {
|
||||||
case *getValuesAtTimeOp:
|
case *getValuesAtTimeOp:
|
||||||
out = ops{firstOperation}
|
out = ops{head}
|
||||||
tail := optimizeForward(pending)
|
|
||||||
|
|
||||||
return append(out, tail...)
|
|
||||||
|
|
||||||
case *getValuesAtIntervalOp:
|
case *getValuesAtIntervalOp:
|
||||||
// If the last value was a scan at a given frequency along an interval,
|
// If the last value was a scan at a given frequency along an interval,
|
||||||
// several optimizations may exist.
|
// several optimizations may exist.
|
||||||
|
@ -448,8 +445,6 @@ func optimizeForward(pending ops) (out ops) {
|
||||||
)
|
)
|
||||||
|
|
||||||
pending = append(head, tail...)
|
pending = append(head, tail...)
|
||||||
|
|
||||||
return optimizeForward(pending)
|
|
||||||
}
|
}
|
||||||
case *getValuesAtIntervalOp:
|
case *getValuesAtIntervalOp:
|
||||||
pending = pending[1:len(pending)]
|
pending = pending[1:len(pending)]
|
||||||
|
@ -464,9 +459,7 @@ func optimizeForward(pending ops) (out ops) {
|
||||||
if t.After(next.through) {
|
if t.After(next.through) {
|
||||||
next.from = t
|
next.from = t
|
||||||
|
|
||||||
pending = append(ops{next}, pending...)
|
tail = append(ops{next}, pending...)
|
||||||
|
|
||||||
return optimizeForward(pending)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -481,9 +474,9 @@ func optimizeForward(pending ops) (out ops) {
|
||||||
// Strictly needed?
|
// Strictly needed?
|
||||||
sort.Sort(startsAtSort{pending})
|
sort.Sort(startsAtSort{pending})
|
||||||
|
|
||||||
tail := optimizeForward(pending)
|
tail = optimizeForward(pending)
|
||||||
|
|
||||||
return append(ops{firstOperation}, tail...)
|
return append(ops{head}, tail...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// selectQueriesForTime chooses all subsequent operations from the slice that
|
// selectQueriesForTime chooses all subsequent operations from the slice that
|
||||||
|
|
Loading…
Reference in a new issue