github.com/thanos-io/thanos@v0.32.5/pkg/metadata/metadatapb/custom.go (about)

     1  // Copyright (c) The Thanos Authors.
     2  // Licensed under the Apache License 2.0.
     3  
     4  package metadatapb
     5  
     6  import (
     7  	"unsafe"
     8  )
     9  
    10  func NewMetricMetadataResponse(metadata *MetricMetadata) *MetricMetadataResponse {
    11  	return &MetricMetadataResponse{
    12  		Result: &MetricMetadataResponse_Metadata{
    13  			Metadata: metadata,
    14  		},
    15  	}
    16  }
    17  
    18  func NewWarningMetadataResponse(warning error) *MetricMetadataResponse {
    19  	return &MetricMetadataResponse{
    20  		Result: &MetricMetadataResponse_Warning{
    21  			Warning: warning.Error(),
    22  		},
    23  	}
    24  }
    25  
    26  func FromMetadataMap(m map[string][]Meta) *MetricMetadata {
    27  	return &MetricMetadata{Metadata: *(*map[string]MetricMetadataEntry)(unsafe.Pointer(&m))}
    28  }