func (e *Encoder) encodeHeader(idx *Idxfile) (int, error) { c, err := e.Write(idxHeader) if err != nil { return c, err } return c + 4, binary.WriteUint32(e, idx.Version) }
func (e *Encoder) encodeFanout(idx *Idxfile) (int, error) { fanout := idx.calculateFanout() for _, c := range fanout { if err := binary.WriteUint32(e, c); err != nil { return 0, err } } return 1024, nil }
func (e *Encoder) encodeOffsets(idx *Idxfile) (int, error) { sz := 0 for _, ent := range idx.Entries { if err := binary.WriteUint32(e, uint32(ent.Offset)); err != nil { return sz, err } sz += 4 } return sz, nil }