diff options
author | Ben Johnson <benbjohnson@yahoo.com> | 2014-05-27 11:31:55 -0600 |
---|---|---|
committer | Ben Johnson <benbjohnson@yahoo.com> | 2014-05-27 11:31:55 -0600 |
commit | 92a9f2e200e83fd0b3ddef177f9a454b0273c17e (patch) | |
tree | fe1fdb4aed24d100cac337e18afce207674fd65e /cmd | |
parent | Merge branch 'master' of https://github.com/boltdb/bolt (diff) | |
download | dedo-92a9f2e200e83fd0b3ddef177f9a454b0273c17e.tar.gz dedo-92a9f2e200e83fd0b3ddef177f9a454b0273c17e.tar.xz |
Remove DB.Check(). Allow read-only Tx.Check().
This commit removes the DB.Check() function and instead makes the user decide
whether a transaction should be writable or read-only. Tx.Check() is not safe
to use concurrently on a read-only transaction, however, it significantly
improves the performance of it.
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/bolt/check.go | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/cmd/bolt/check.go b/cmd/bolt/check.go index ec2ea69..1436aba 100644 --- a/cmd/bolt/check.go +++ b/cmd/bolt/check.go @@ -21,7 +21,12 @@ func Check(path string) { defer db.Close() // Perform consistency check. - if err := db.Check(); err != nil { + err = db.View(func(tx *bolt.Tx) error { + return tx.Check() + }) + + // Print out any errors that occur. + if err != nil { if errors, ok := err.(bolt.ErrorList); ok { for _, err := range errors { println(err) |