Close closes the underlying bolt database. Acquires wlock so no GC cycle is in progress when bolt is closed.
()
| 143 | // Close closes the underlying bolt database. |
| 144 | // Acquires wlock so no GC cycle is in progress when bolt is closed. |
| 145 | func (m *DB) Close() error { |
| 146 | m.wlock.Lock() |
| 147 | defer m.wlock.Unlock() |
| 148 | if c, ok := m.db.(io.Closer); ok { |
| 149 | return c.Close() |
| 150 | } |
| 151 | return nil |
| 152 | } |
| 153 | |
| 154 | // Init ensures the database is at the correct version |
| 155 | // and performs any needed migrations. |