Sync flushes the buffer and syncs the file to disk
()
| 439 | |
| 440 | // Sync flushes the buffer and syncs the file to disk |
| 441 | func (w *HintFileWriter) Sync() error { |
| 442 | if w.writer != nil { |
| 443 | if err := w.writer.Flush(); err != nil { |
| 444 | return err |
| 445 | } |
| 446 | } |
| 447 | |
| 448 | if w.file != nil { |
| 449 | return w.file.Sync() |
| 450 | } |
| 451 | |
| 452 | return nil |
| 453 | } |
| 454 | |
| 455 | // Close closes the hint file |
| 456 | func (w *HintFileWriter) Close() error { |