Browse Source

db: add Close() to db interface. closes #31

pull/33/head
Ethan Buchman 10 years ago
parent
commit
94c200711b
2 changed files with 5 additions and 0 deletions
  1. +1
    -0
      db/db.go
  2. +4
    -0
      db/mem_db.go

+ 1
- 0
db/db.go View File

@ -13,6 +13,7 @@ type DB interface {
SetSync([]byte, []byte)
Delete([]byte)
DeleteSync([]byte)
Close()
// For debugging
Print()


+ 4
- 0
db/mem_db.go View File

@ -33,6 +33,10 @@ func (db *MemDB) DeleteSync(key []byte) {
delete(db.db, string(key))
}
func (db *MemDB) Close() {
db = nil
}
func (db *MemDB) Print() {
for key, value := range db.db {
fmt.Printf("[%X]:\t[%X]\n", []byte(key), value)


Loading…
Cancel
Save