Refactor Datafile.Size()

This commit is contained in:
James Mills
2019-03-22 17:33:24 +10:00
parent 2400dd86d5
commit c593bc966f
2 changed files with 3 additions and 7 deletions

View File

@@ -175,11 +175,7 @@ func (b *Bitcask) Fold(f func(key string) error) error {
}
func (b *Bitcask) put(key string, value []byte) (int64, error) {
size, err := b.curr.Size()
if err != nil {
return -1, err
}
size := b.curr.Size()
if size >= int64(b.config.maxDatafileSize) {
err := b.curr.Close()
if err != nil {