Browse Source

Update documentation.

pull/84/head
Matt T. Proud 12 years ago
parent
commit
d7b534e624
  1. 10
      storage/metric/operation.go

10
storage/metric/operation.go

@ -70,11 +70,15 @@ func (g *getValuesAtTimeOp) ExtractSamples(in []model.SamplePair) (out []model.S
return return
} }
// extractValuesAroundTime searches for the provided time in the list of
// available samples and emits a slice containing the data points that
// are adjacent to it.
//
// An assumption of this is that the provided samples are already sorted!
func extractValuesAroundTime(t time.Time, in []model.SamplePair) (out []model.SamplePair) { func extractValuesAroundTime(t time.Time, in []model.SamplePair) (out []model.SamplePair) {
i := sort.Search(len(in), func(i int) bool { i := sort.Search(len(in), func(i int) bool {
return !in[i].Timestamp.Before(t) return !in[i].Timestamp.Before(t)
}) })
fmt.Printf("I: %d\n", i)
switch i { switch i {
case len(in): case len(in):
out = in[len(in)-1:] out = in[len(in)-1:]
@ -268,7 +272,9 @@ func (s frequencySorter) Less(i, j int) bool {
return l.interval < r.interval return l.interval < r.interval
} }
// Selects and returns all operations that are getValuesAtIntervalOps operations. // Selects and returns all operations that are getValuesAtIntervalOp operations
// in a map whereby the operation interval is the key and the value are the
// operations sorted by respective level of greediness.
func collectIntervals(ops ops) (intervals map[time.Duration]getValuesAtIntervalOps) { func collectIntervals(ops ops) (intervals map[time.Duration]getValuesAtIntervalOps) {
intervals = make(map[time.Duration]getValuesAtIntervalOps) intervals = make(map[time.Duration]getValuesAtIntervalOps)

Loading…
Cancel
Save