mirror of
https://github.com/jeremyd/ergo.git
synced 2026-04-26 23:49:59 -07:00
upgrade buntdb and dependencies
This commit is contained in:
15
vendor/github.com/tidwall/buntdb/buntdb.go
generated
vendored
15
vendor/github.com/tidwall/buntdb/buntdb.go
generated
vendored
@@ -7,6 +7,7 @@ package buntdb
|
||||
import (
|
||||
"bufio"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"sort"
|
||||
@@ -749,13 +750,13 @@ func (db *DB) Shrink() error {
|
||||
if err := db.file.Close(); err != nil {
|
||||
return err
|
||||
}
|
||||
// Any failures below here is really bad. So just panic.
|
||||
// Any failures below here are really bad. So just panic.
|
||||
if err := os.Rename(tmpname, fname); err != nil {
|
||||
panic(err)
|
||||
panicErr(err)
|
||||
}
|
||||
db.file, err = os.OpenFile(fname, os.O_CREATE|os.O_RDWR, 0666)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
panicErr(err)
|
||||
}
|
||||
pos, err := db.file.Seek(0, 2)
|
||||
if err != nil {
|
||||
@@ -766,6 +767,10 @@ func (db *DB) Shrink() error {
|
||||
}()
|
||||
}
|
||||
|
||||
func panicErr(err error) error {
|
||||
panic(fmt.Errorf("buntdb: %w", err))
|
||||
}
|
||||
|
||||
// readLoad reads from the reader and loads commands into the database.
|
||||
// modTime is the modified time of the reader, should be no greater than
|
||||
// the current time.Now().
|
||||
@@ -1209,10 +1214,10 @@ func (tx *Tx) Commit() error {
|
||||
// should be killed to avoid corrupting the file.
|
||||
pos, err := tx.db.file.Seek(-int64(n), 1)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
panicErr(err)
|
||||
}
|
||||
if err := tx.db.file.Truncate(pos); err != nil {
|
||||
panic(err)
|
||||
panicErr(err)
|
||||
}
|
||||
}
|
||||
tx.rollbackInner()
|
||||
|
||||
Reference in New Issue
Block a user