aboutsummaryrefslogtreecommitdiff
path: root/cmd/bolt/check.go
diff options
context:
space:
mode:
Diffstat (limited to 'cmd/bolt/check.go')
-rw-r--r--cmd/bolt/check.go47
1 files changed, 0 insertions, 47 deletions
diff --git a/cmd/bolt/check.go b/cmd/bolt/check.go
deleted file mode 100644
index 125f2b8..0000000
--- a/cmd/bolt/check.go
+++ /dev/null
@@ -1,47 +0,0 @@
-package main
-
-import (
- "os"
-
- "github.com/boltdb/bolt"
-)
-
-// Check performs a consistency check on the database and prints any errors found.
-func Check(path string) {
- if _, err := os.Stat(path); os.IsNotExist(err) {
- fatal(err)
- return
- }
-
- db, err := bolt.Open(path, 0600, nil)
- if err != nil {
- fatal(err)
- return
- }
- defer db.Close()
-
- // Perform consistency check.
- _ = db.View(func(tx *bolt.Tx) error {
- var count int
- ch := tx.Check()
- loop:
- for {
- select {
- case err, ok := <-ch:
- if !ok {
- break loop
- }
- println(err)
- count++
- }
- }
-
- // Print summary of errors.
- if count > 0 {
- fatalf("%d errors found", count)
- } else {
- println("OK")
- }
- return nil
- })
-}