MCPcopy Create free account
hub / github.com/AbelChe/evil_minio / migrateCacheFormatJSON

Function migrateCacheFormatJSON

cmd/format-disk-cache.go:480–498  ·  view source on GitHub ↗
(cacheFormatPath string)

Source from the content-addressed store, hash-verified

478}
479
480func migrateCacheFormatJSON(cacheFormatPath string) error {
481 // now migrate format.json
482 f, err := os.OpenFile(cacheFormatPath, os.O_RDWR, 0o666)
483 if err != nil {
484 return err
485 }
486 defer f.Close()
487 formatV1 := formatCacheV1{}
488 if err := jsonLoad(f, &formatV1); err != nil {
489 return err
490 }
491
492 formatV2 := &formatCacheV2{}
493 formatV2.formatMetaV1 = formatV1.formatMetaV1
494 formatV2.Version = formatMetaVersion1
495 formatV2.Cache = formatV1.Cache
496 formatV2.Cache.Version = formatCacheVersionV2
497 return jsonSave(f, formatV2)
498}

Callers 1

migrateOldCacheFunction · 0.85

Calls 3

jsonLoadFunction · 0.85
jsonSaveFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected