offset returns the current write offset.
()
| 517 | |
| 518 | // offset returns the current write offset. |
| 519 | func (b *bufWriter) offset() uint32 { |
| 520 | off, _ := b.file.Seek(0, 1) |
| 521 | off += int64(len(b.buf)) |
| 522 | if int64(uint32(off)) != off { |
| 523 | log.Fatalf("index is larger than 4GB") |
| 524 | } |
| 525 | return uint32(off) |
| 526 | } |
| 527 | |
| 528 | func (b *bufWriter) flush() { |
| 529 | if len(b.buf) == 0 { |