Page 39, Print Edition
The description of how the offset is calculated for the index under the definition of Append() is confusing and I believe it’s the result of a mix up with the wording.
Since index offsets are relative to the base offset, we subtract the segment’s next offset from its base offset (which are both absolute offsets) to get the entry’s relative offset in the segment.
This contradicts what is actually happening in the code where we see:
uint32(s.nextOffset-uint64(s.baseOffset))
I believe that this sentence should probably read:
Since index offsets are relative to the base offset, we subtract the segment’s base offset from its next offset (which are both absolute offsets) to get the entry’s relative offset in the segment.