mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-09-07 00:55:55 +00:00
add buffered snapshot writer
This commit wraps the snapshot in a `bufio.Writer`.
This commit is contained in:
parent
c9f1e26143
commit
677824c065
1 changed files with 5 additions and 1 deletions
|
|
@ -2,6 +2,7 @@ package pilosa
|
|||
|
||||
import (
|
||||
"archive/tar"
|
||||
"bufio"
|
||||
"bytes"
|
||||
"crypto/sha1"
|
||||
"encoding/binary"
|
||||
|
|
@ -906,8 +907,11 @@ func (f *Fragment) snapshot() error {
|
|||
defer file.Close()
|
||||
|
||||
// Write storage to snapshot.
|
||||
if _, err := f.storage.WriteTo(file); err != nil {
|
||||
bw := bufio.NewWriter(file)
|
||||
if _, err := f.storage.WriteTo(bw); err != nil {
|
||||
return fmt.Errorf("snapshot write to: %s", err)
|
||||
} else if err := bw.Flush(); err != nil {
|
||||
return fmt.Errorf("flush: %s", err)
|
||||
}
|
||||
|
||||
// Close current storage.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue