[#1094] metabase: move Select
filters sanity check outside of transaction
Signed-off-by: Evgenii Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
651adf46c6
commit
5a03a14940
1 changed files with 5 additions and 8 deletions
|
@ -75,13 +75,15 @@ func Select(db *DB, cid *cid.ID, fs object.SearchFilters) ([]*object.Address, er
|
|||
func (db *DB) Select(prm *SelectPrm) (res *SelectRes, err error) {
|
||||
res = new(SelectRes)
|
||||
|
||||
err = db.boltDB.View(func(tx *bbolt.Tx) error {
|
||||
if blindlyProcess(prm.filters) {
|
||||
return res, nil
|
||||
}
|
||||
|
||||
return res, db.boltDB.View(func(tx *bbolt.Tx) error {
|
||||
res.addrList, err = db.selectObjects(tx, prm.cid, prm.filters)
|
||||
|
||||
return err
|
||||
})
|
||||
|
||||
return res, err
|
||||
}
|
||||
|
||||
func (db *DB) selectObjects(tx *bbolt.Tx, cid *cid.ID, fs object.SearchFilters) ([]*object.Address, error) {
|
||||
|
@ -89,11 +91,6 @@ func (db *DB) selectObjects(tx *bbolt.Tx, cid *cid.ID, fs object.SearchFilters)
|
|||
return nil, ErrMissingContainerID
|
||||
}
|
||||
|
||||
// TODO: consider the option of moving this check to a level higher than the metabase
|
||||
if blindlyProcess(fs) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
group, err := groupFilters(fs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in a new issue