From ddd6c08b6aee8525b1017e80eba8a84646c37194 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 16 Feb 2022 17:48:53 +0300 Subject: [PATCH] [#143] object/search: Add notification filter It allows searching object whose notification epoch fits passed `SearchMatchType` and a value. Signed-off-by: Pavel Karpy --- object/search.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/object/search.go b/object/search.go index 9dc40002..240a65d8 100644 --- a/object/search.go +++ b/object/search.go @@ -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))