code: func (h *headChunkReader) Chunk(ref uint64) (chunkenc.Chunk, error) {
  	sid, cid := unpackChunkID(ref)
  
  	s := h.head.series.getByID(sid)
  	// This means that the series has been garbage collected.
  	if s == nil {
  		return nil, ErrNotFound
  	}
  
  	s.Lock()
  	c := s.chunk(int(cid))
  
  	// This means that the chunk has been garbage collected or is outside
  	// the specified range.
  	if c == nil || !c.OverlapsClosedInterval(h.mint, h.maxt) {
  		s.Unlock()
  		return nil, ErrNotFound
  	}
  	s.Unlock()
  
  	return &safeChunk{
  		Chunk: c.chunk,
  		s:     s,
  		cid:   int(cid),
  	}, nil
  }
docs: // Chunk returns the chunk for the reference number.