Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions prefixdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var _ DB = (*PrefixDB)(nil)
// NewPrefixDB lets you namespace multiple DBs within a single DB.
func NewPrefixDB(db DB, prefix []byte) *PrefixDB {
return &PrefixDB{
prefix: prefix,
prefix: cp(prefix),
db: db,
}
}
Expand Down Expand Up @@ -160,11 +160,10 @@ func (pdb *PrefixDB) NewBatch() Batch {
}

// Close implements DB.
func (pdb *PrefixDB) Close() error {
pdb.mtx.Lock()
defer pdb.mtx.Unlock()

return pdb.db.Close()
func (*PrefixDB) Close() error {
// PrefixDB doesn't own the underlying database, so Close is a no-op.
// The underlying DB should be closed by its owner, not by prefix wrappers.
return nil
}

// Print implements DB.
Expand Down
Loading