Commit ebf8fd11 authored by Kirill Smelkov's avatar Kirill Smelkov

X fs1: TODO buffering for index save

parent d9cfa3c0
...@@ -161,6 +161,8 @@ func (fsi *fsIndex) SaveFile(topPos int64, path string) (err error) { ...@@ -161,6 +161,8 @@ func (fsi *fsIndex) SaveFile(topPos int64, path string) (err error) {
return &IndexSaveError{err} return &IndexSaveError{err}
} }
// TODO use buffering for f (ogórek does not buffer itself on encoding)
defer func() { defer func() {
err2 := f.Close() err2 := f.Close()
if err2 != nil && err == nil { if err2 != nil && err == nil {
...@@ -330,11 +332,12 @@ func LoadIndexFile(path string) (topPos int64, fsi *fsIndex, err error) { ...@@ -330,11 +332,12 @@ func LoadIndexFile(path string) (topPos int64, fsi *fsIndex, err error) {
} }
}() }()
// NOTE no explicit bufferring needed - ogórek and LoadIndex use bufio.Reader internally
return LoadIndex(f) return LoadIndex(f)
} }
// TODO move vvv to common place // TODO move vvv to common place -> xio
// CountReader is an io.Reader that count total bytes read // CountReader is an io.Reader that count total bytes read
type CountReader struct { type CountReader struct {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment