fix bug, internal ops must check that index is open
possibly fixes https://github.com/couchbaselabs/cbft/issues/49
This commit is contained in:
parent
867110e03b
commit
11262c793f
|
@ -668,6 +668,10 @@ func (i *indexImpl) GetInternal(key []byte) (val []byte, err error) {
|
|||
i.mutex.RLock()
|
||||
defer i.mutex.RUnlock()
|
||||
|
||||
if !i.open {
|
||||
return nil, ErrorIndexClosed
|
||||
}
|
||||
|
||||
reader, err := i.i.Reader()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -689,6 +693,10 @@ func (i *indexImpl) SetInternal(key, val []byte) error {
|
|||
i.mutex.RLock()
|
||||
defer i.mutex.RUnlock()
|
||||
|
||||
if !i.open {
|
||||
return ErrorIndexClosed
|
||||
}
|
||||
|
||||
return i.i.SetInternal(key, val)
|
||||
}
|
||||
|
||||
|
@ -696,6 +704,10 @@ func (i *indexImpl) DeleteInternal(key []byte) error {
|
|||
i.mutex.RLock()
|
||||
defer i.mutex.RUnlock()
|
||||
|
||||
if !i.open {
|
||||
return ErrorIndexClosed
|
||||
}
|
||||
|
||||
return i.i.DeleteInternal(key)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue