github.com/sequix/cortex@v1.1.6/pkg/chunk/storage/by_key_test.go (about) 1 package storage 2 3 import ( 4 "github.com/sequix/cortex/pkg/chunk" 5 ) 6 7 // ByKey allow you to sort chunks by ID 8 type ByKey []chunk.Chunk 9 10 func (cs ByKey) Len() int { return len(cs) } 11 func (cs ByKey) Swap(i, j int) { cs[i], cs[j] = cs[j], cs[i] } 12 func (cs ByKey) Less(i, j int) bool { return cs[i].ExternalKey() < cs[j].ExternalKey() }