func chunksEqual(c1, c2 chunk.Chunk) bool {
	it1 := c1.NewIterator()
	it2 := c2.NewIterator()
	for it1.Scan() && it2.Scan() {
		if !(it1.Value() == it2.Value()) {
			return false
		}
	}
	return it1.Err() == nil && it2.Err() == nil
}
Beispiel #2
0
func writeChunkHeader(header []byte, c chunk.Chunk) error {
	header[chunkHeaderTypeOffset] = byte(c.Encoding())
	binary.LittleEndian.PutUint64(
		header[chunkHeaderFirstTimeOffset:],
		uint64(c.FirstTime()),
	)
	lt, err := c.NewIterator().LastTimestamp()
	if err != nil {
		return err
	}
	binary.LittleEndian.PutUint64(
		header[chunkHeaderLastTimeOffset:],
		uint64(lt),
	)
	return nil
}