MCPcopy Create free account
hub / github.com/cortexproject/cortex / updateCachedShippedBlocks

Method updateCachedShippedBlocks

pkg/ingester/ingester.go:608–629  ·  view source on GitHub ↗

updateCachedShippedBlocks reads the shipper meta file and updates the cached shipped blocks.

()

Source from the content-addressed store, hash-verified

606
607// updateCachedShippedBlocks reads the shipper meta file and updates the cached shipped blocks.
608func (u *userTSDB) updateCachedShippedBlocks() error {
609 shipperMeta, err := shipper.ReadMetaFile(u.shipperMetadataFilePath)
610 if os.IsNotExist(err) || os.IsNotExist(errors.Cause(err)) {
611 // If the meta file doesn't exist it means the shipper hasn't run yet.
612 shipperMeta = &shipper.Meta{}
613 } else if err != nil {
614 return err
615 }
616
617 // Build a map.
618 shippedBlocks := make(map[ulid.ULID]struct{}, len(shipperMeta.Uploaded))
619 for _, blockID := range shipperMeta.Uploaded {
620 shippedBlocks[blockID] = struct{}{}
621 }
622
623 // Cache it.
624 u.shippedBlocksMtx.Lock()
625 u.shippedBlocks = shippedBlocks
626 u.shippedBlocksMtx.Unlock()
627
628 return nil
629}
630
631// getCachedShippedBlocks returns the cached shipped blocks.
632func (u *userTSDB) getCachedShippedBlocks() map[ulid.ULID]struct{} {

Callers 4

createTSDBMethod · 0.95
shipBlocksMethod · 0.80

Calls 1

CauseMethod · 0.80