forked from TrueCloudLab/frostfs-sdk-go
[#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:
parent
e791793253
commit
ddd6c08b6a
1 changed files with 5 additions and 0 deletions
|
@ -3,6 +3,7 @@ package object
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strconv"
|
||||||
|
|
||||||
v2object "github.com/nspcc-dev/neofs-api-go/v2/object"
|
v2object "github.com/nspcc-dev/neofs-api-go/v2/object"
|
||||||
cid "github.com/nspcc-dev/neofs-sdk-go/container/id"
|
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)
|
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 {
|
func (f SearchFilters) ToV2() []*v2object.SearchFilter {
|
||||||
result := make([]*v2object.SearchFilter, 0, len(f))
|
result := make([]*v2object.SearchFilter, 0, len(f))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue