// Close closes the wal, including flushing any unsaved writes.
Close closes the wal, including flushing any unsaved writes.
// Close closes the wal including flushing any unsaved writes .
func (wal *WAL) Close() error {
	wal.mx.Lock()
	close(wal.bufChan)
	<-wal.exit
	flushErr := wal.writer.Flush()
	syncErr := wal.file.Sync()
	wal.closed = true
	wal.mx.Unlock()
	closeErr := wal.file.Close()
	if flushErr != nil {
		return flushErr
	}
	if syncErr != nil {
		return syncErr
	}
	return closeErr
}
func ( wal * WAL ) Close ( ) error { wal . mx . Lock ( ) close ( wal . bufChan ) <- wal . exit flushErr := wal . writer . Flush ( ) syncErr := wal . file . Sync ( ) wal . closed = true wal . mx . Unlock ( ) closeErr := wal . file . Close ( ) if flushErr != nil { return flushErr } if syncErr != nil { return syncErr } return closeErr }
Close closes the wal, including flushing any unsaved writes.
Close closes the wal including flushing any unsaved writes .