forked from TrueCloudLab/frostfs-node
[#177] metabase: Add index by object ID
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
dbf6c9efef
commit
ffeea2c003
4 changed files with 24 additions and 3 deletions
|
@ -124,6 +124,10 @@ func objectIndices(obj *object.Object, parent bool) []bucketItem {
|
|||
key: v2object.FilterHeaderParent,
|
||||
val: obj.ParentID().String(),
|
||||
},
|
||||
bucketItem{
|
||||
key: v2object.FilterHeaderObjectID,
|
||||
val: obj.ID().String(),
|
||||
},
|
||||
// TODO: add remaining fields after neofs-api#72
|
||||
)
|
||||
|
||||
|
|
|
@ -207,3 +207,20 @@ func TestSelectParentID(t *testing.T) {
|
|||
|
||||
testSelect(t, db, fs, obj1.Address())
|
||||
}
|
||||
|
||||
func TestSelectObjectID(t *testing.T) {
|
||||
db := newDB(t)
|
||||
defer releaseDB(db)
|
||||
|
||||
// generate object
|
||||
obj := generateObject(t, testPrm{})
|
||||
|
||||
// store objects
|
||||
require.NoError(t, db.Put(obj))
|
||||
|
||||
// filter by object ID
|
||||
fs := objectSDK.SearchFilters{}
|
||||
fs.AddObjectIDFilter(objectSDK.MatchStringEqual, obj.ID())
|
||||
|
||||
testSelect(t, db, fs, obj.Address())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue