github.com/thanos-io/thanos@v0.32.5/pkg/info/infopb/custom.pb.go (about)

     1  package infopb
     2  
     3  import (
     4  	"math"
     5  
     6  	"github.com/prometheus/prometheus/model/labels"
     7  
     8  	"github.com/thanos-io/thanos/pkg/store/labelpb"
     9  )
    10  
    11  func NewTSDBInfo(mint, maxt int64, lbls []labelpb.ZLabel) TSDBInfo {
    12  	return TSDBInfo{
    13  		Labels: labelpb.ZLabelSet{
    14  			Labels: lbls,
    15  		},
    16  		MinTime: mint,
    17  		MaxTime: maxt,
    18  	}
    19  }
    20  
    21  type TSDBInfos []TSDBInfo
    22  
    23  func (infos TSDBInfos) MaxT() int64 {
    24  	var maxt int64 = math.MinInt64
    25  	for _, info := range infos {
    26  		if info.MaxTime > maxt {
    27  			maxt = info.MaxTime
    28  		}
    29  	}
    30  	return maxt
    31  }
    32  
    33  func (infos TSDBInfos) LabelSets() []labels.Labels {
    34  	lsets := make([]labels.Labels, 0, len(infos))
    35  	for _, info := range infos {
    36  		lsets = append(lsets, labelpb.ZLabelsToPromLabels(info.Labels.Labels))
    37  
    38  	}
    39  	return lsets
    40  }