func (q *MmapQueue) readLength(aid, offset int) (int, int, int, error) {
	if offset+cInt64Size > q.conf.arenaSize {
		aid, offset = aid+1, 0
	}
	aa, err := q.am.getArena(aid)
	if err != nil {
		return 0, 0, 0, err
	}
	length := int(aa.ReadUint64At(int64(offset)))
	offset += cInt64Size
	if offset == q.conf.arenaSize {
		aid, offset = aid+1, 0
	}
	return aid, offset, length, nil
}
readLength reads length of the message.
length is always written in 1 arena, it is never broken across arenas.
package bigqueue
import (
	"errors"
)
var (
	ErrEmptyQueue = errors.New("queue is empty")
)
func (q *MmapQueue) IsEmpty() bool {
	return q.isEmpty(q.dc)
}
func (q *MmapQueue) isEmpty(base int64) bool {
	q.lock.Lock()
	defer q.lock.Unlock()
	return q.isEmptyNoLock(base)
}
func (q *MmapQueue) isEmptyNoLock(base int64) bool {
	headAid, headOffset := q.md.getConsumerHead(base)
	tailAid, tailOffset := q.md.getTail()
	return headAid == tailAid && headOffset == tailOffset
}
func (q *MmapQueue) Dequeue() ([]byte, error) {
	return q.dequeue(q.dc)
}
func (q *MmapQueue) dequeue(base int64) ([]byte, error) {
	q.lock.Lock()
	defer q.lock.Unlock()
	if err := q.dequeueReader(&q.br, base); err != nil {
		q.br.b = nil
		return nil, err
	}
	r := q.br.b
	q.br.b = nil
	return r, nil
}
func (q *MmapQueue) DequeueString() (string, error) {
	return q.dequeueString(q.dc)
}
func (q *MmapQueue) dequeueString(base int64) (string, error) {
	q.lock.Lock()
	defer q.lock.Unlock()
	if err := q.dequeueReader(&q.sr, base); err != nil {
		q.sr.sb.Reset()
		return "", err
	}
	r := q.sr.sb.String()
	q.sr.sb.Reset()
	return r, nil
}
func (q *MmapQueue) dequeueReader(r reader, base int64) error {
	if q.isEmptyNoLock(base) {
		return ErrEmptyQueue
	}
	aid, offset := q.md.getConsumerHead(base)
	newAid, newOffset, length, err := q.readLength(aid, offset)
	if err != nil {
		return err
	}
	aid, offset = newAid, newOffset
	r.grow(length)
	aid, offset, err = q.readBytes(r, aid, offset, length)
	if err != nil {
		return err
	}
	q.md.putConsumerHead(base, aid, offset)
	q.incrMutOps()
	return nil
}