Example #1
0
// UseDB allow Storm to use an existing open Bolt.DB.
// Warning: storm.DB.Close() will close the bolt.DB instance.
func UseDB(b *bolt.DB) func(*DB) error {
	return func(d *DB) error {
		d.Path = b.Path()
		d.Bolt = b
		return nil
	}
}
Example #2
0
// tearDownBoltDB closes and deletes boltdb
func tearDownBoltDB(db *bolt.DB) error {
	p := db.Path()
	err := db.Close()
	if err != nil {
		return err
	}

	return os.Remove(p)
}
Example #3
0
// closedb closes and deletes a ReportifyDB database.
func closedb(db *bolt.DB) {
	if db == nil {
		return
	}
	path := db.Path()
	db.Close()
	if path != "" {
		os.Remove(path)
	}
}
Example #4
0
func clean_bolt(db *bolt.DB) {
	db.Close()
	os.Remove(db.Path())
}