[#143] object/search: Add notification filter

It allows searching object whose notification epoch fits passed
`SearchMatchType` and a value.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2022-02-16 17:48:53 +03:00 committed by LeL
parent e791793253
commit ddd6c08b6a

View file

@ -3,6 +3,7 @@ package object
import (
"encoding/json"
"fmt"
"strconv"
v2object "github.com/nspcc-dev/neofs-api-go/v2/object"
cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
@ -231,6 +232,10 @@ func (f *SearchFilters) AddObjectOwnerIDFilter(m SearchMatchType, id *owner.ID)
f.addReservedFilter(m, fKeyOwnerID, id)
}
func (f *SearchFilters) AddNotificationEpochFilter(epoch uint64) {
f.addFilter(MatchStringEqual, 0, v2object.SysAttributeTickEpoch, staticStringer(strconv.FormatUint(epoch, 10)))
}
func (f SearchFilters) ToV2() []*v2object.SearchFilter {
result := make([]*v2object.SearchFilter, 0, len(f))