func (wb *fieldWriteBuf) totalLen() int {
	return len(wb.defaultBuf) + len(wb.blobBuf)
}
totalLen computes the total # of bytes stored in the buffer.
package fieldio
import (
	"encoding/binary"
	"fmt"
	"io"
	"sync"
	"github.com/grailbio/base/backgroundcontext"
	"github.com/grailbio/base/errors"
	"github.com/grailbio/base/file"
	"github.com/grailbio/base/log"
	"github.com/grailbio/base/recordio"
	"github.com/grailbio/base/recordio/recordioiov"
	"github.com/grailbio/base/syncqueue"
	grailunsafe "github.com/grailbio/base/unsafe"
	"github.com/grailbio/bio/biopb"
	gbam "github.com/grailbio/bio/encoding/bam"
	"github.com/grailbio/bio/encoding/pam/pamutil"
	"github.com/grailbio/hts/sam"
)
const (
	FieldIndexMagic = uint64(0xe360ac9026052aca)
)
type Writer struct {
	label string           
	out   file.File        
	wout  io.Writer        
	rio   recordio.Writer  
	nextBlockSeq int
	buf         *fieldWriteBuf
	bufFreePool *WriteBufPool  
	err *errors.Once  
	mu   *sync.Mutex
	cond *sync.Cond
	lastBlockFlushed int
	blockIndexes []biopb.PAMBlockIndexEntry
}
type fieldWriteBuf struct {
	label      string       
	seq        int          
	numRecords int          
	startAddr  biopb.Coord  
	endAddr    biopb.Coord  
	defaultBuf byteBuffer  
	blobBuf    byteBuffer  
	prevString []byte
	prevInt64Value0 int64
	prevInt64Value1 int64
}