MCPcopy
hub / github.com/prometheus/prometheus / readMetaFile

Function readMetaFile

tsdb/block.go:258–273  ·  view source on GitHub ↗
(dir string)

Source from the content-addressed store, hash-verified

256func chunkDir(dir string) string { return filepath.Join(dir, "chunks") }
257
258func readMetaFile(dir string) (*BlockMeta, int64, error) {
259 b, err := os.ReadFile(filepath.Join(dir, metaFilename))
260 if err != nil {
261 return nil, 0, err
262 }
263 var m BlockMeta
264
265 if err := json.Unmarshal(b, &m); err != nil {
266 return nil, 0, err
267 }
268 if m.Version != metaVersion1 {
269 return nil, 0, fmt.Errorf("unexpected meta file version %d", m.Version)
270 }
271
272 return &m, int64(len(b)), nil
273}
274
275func writeMetaFile(logger *slog.Logger, dir string, meta *BlockMeta) (int64, error) {
276 meta.Version = metaVersion1

Callers 8

openBlocksFunction · 0.85
OpenBlockFunction · 0.85
PlanMethod · 0.85

Calls 1

UnmarshalMethod · 0.45

Used in the wild real call sites across dependent graphs

searching dependent graphs…