You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: ring.go
    path of file: ./repos/franz-go/pkg/kgo
    
    the code of the file until where you have to start completion: package kgo

import "sync"

// The ring types below are fixed sized blocking MPSC ringbuffers. These
// replace channels in a few places in this client. The *main* advantage they
// provide is to allow loops that terminate.
//
// With channels, we always have to have a goroutine draining the channel.  We
// cannot start the goroutine when we add the first element, because the
// goroutine will immediately drain the first and if something produc
    
func (r *ringBatchPromise) push(b batchPromise) (first bool) {
	r.mu.Lock()
	defer r.mu.Unlock()

	// If the ring is full, we go into overflow; if overflow is non-empty,
	// for ordering purposes, we add to the end of overflow. We only go
	// back to using the ring once overflow is finally empty.
	if r.l == eight || len(r.overflow) > 0 {
		r.overflow = append(r.overflow, b)
		return false
	}

	r.elems[r.tail] = b
	r.tail = (r.tail + 1) & mask7
	r.l++

	return r.l == 1
}