github.com/muhammadn/cortex@v1.9.1-0.20220510110439-46bb7000d03d/pkg/storage/tsdb/util.go (about)

     1  package tsdb
     2  
     3  import (
     4  	"github.com/oklog/ulid"
     5  
     6  	"github.com/cortexproject/cortex/pkg/ingester/client"
     7  )
     8  
     9  // HashBlockID returns a 32-bit hash of the block ID useful for
    10  // ring-based sharding.
    11  func HashBlockID(id ulid.ULID) uint32 {
    12  	h := client.HashNew32()
    13  	for _, b := range id {
    14  		h = client.HashAddByte32(h, b)
    15  	}
    16  	return h
    17  }