forked from TrueCloudLab/frostfs-api-go
[#254] object: Support new values of search match type
Support STRING_NOT_EQUAL and NOT_PRESENT match types of object search filters. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
e9ae408c3a
commit
ebff07aaf2
5 changed files with 38 additions and 9 deletions
|
@ -15,12 +15,18 @@ type SearchMatchType uint32
|
|||
const (
|
||||
MatchUnknown SearchMatchType = iota
|
||||
MatchStringEqual
|
||||
MatchStringNotEqual
|
||||
MatchNotPresent
|
||||
)
|
||||
|
||||
func (m SearchMatchType) ToV2() v2object.MatchType {
|
||||
switch m {
|
||||
case MatchStringEqual:
|
||||
return v2object.MatchStringEqual
|
||||
case MatchStringNotEqual:
|
||||
return v2object.MatchStringNotEqual
|
||||
case MatchNotPresent:
|
||||
return v2object.MatchNotPresent
|
||||
default:
|
||||
return v2object.MatchUnknown
|
||||
}
|
||||
|
@ -30,6 +36,10 @@ func SearchMatchFromV2(t v2object.MatchType) (m SearchMatchType) {
|
|||
switch t {
|
||||
case v2object.MatchStringEqual:
|
||||
m = MatchStringEqual
|
||||
case v2object.MatchStringNotEqual:
|
||||
m = MatchStringNotEqual
|
||||
case v2object.MatchNotPresent:
|
||||
m = MatchNotPresent
|
||||
default:
|
||||
m = MatchUnknown
|
||||
}
|
||||
|
|
|
@ -14,6 +14,8 @@ var (
|
|||
eqV2Matches = map[object.SearchMatchType]v2object.MatchType{
|
||||
object.MatchUnknown: v2object.MatchUnknown,
|
||||
object.MatchStringEqual: v2object.MatchStringEqual,
|
||||
object.MatchStringNotEqual: v2object.MatchStringNotEqual,
|
||||
object.MatchNotPresent: v2object.MatchNotPresent,
|
||||
}
|
||||
)
|
||||
|
||||
|
|
4
v2/object/grpc/service.pb.go
generated
4
v2/object/grpc/service.pb.go
generated
|
@ -1952,6 +1952,10 @@ func (x *SearchRequest_Body) GetFilters() []*SearchRequest_Body_Filter {
|
|||
// * $Object:PHY \
|
||||
// Returns only objects physically stored in the system. This filter is
|
||||
// activated if the `key` exists, disregarding the value and matcher type.
|
||||
//
|
||||
// Note: using filters with a key with prefix `$Object:` and match type
|
||||
// `NOT_PRESENT `is not recommended since this is not a cross-version approach.
|
||||
// Behavior when processing this kind of filters is undefined.
|
||||
type SearchRequest_Body_Filter struct {
|
||||
state protoimpl.MessageState
|
||||
sizeCache protoimpl.SizeCache
|
||||
|
|
25
v2/object/grpc/types.pb.go
generated
25
v2/object/grpc/types.pb.go
generated
|
@ -96,6 +96,10 @@ const (
|
|||
MatchType_MATCH_TYPE_UNSPECIFIED MatchType = 0
|
||||
// Full string match
|
||||
MatchType_STRING_EQUAL MatchType = 1
|
||||
// Full string mismatch
|
||||
MatchType_STRING_NOT_EQUAL MatchType = 2
|
||||
// Lack of key
|
||||
MatchType_NOT_PRESENT MatchType = 3
|
||||
)
|
||||
|
||||
// Enum value maps for MatchType.
|
||||
|
@ -103,10 +107,14 @@ var (
|
|||
MatchType_name = map[int32]string{
|
||||
0: "MATCH_TYPE_UNSPECIFIED",
|
||||
1: "STRING_EQUAL",
|
||||
2: "STRING_NOT_EQUAL",
|
||||
3: "NOT_PRESENT",
|
||||
}
|
||||
MatchType_value = map[string]int32{
|
||||
"MATCH_TYPE_UNSPECIFIED": 0,
|
||||
"STRING_EQUAL": 1,
|
||||
"STRING_NOT_EQUAL": 2,
|
||||
"NOT_PRESENT": 3,
|
||||
}
|
||||
)
|
||||
|
||||
|
@ -839,16 +847,19 @@ var file_v2_object_grpc_types_proto_rawDesc = []byte{
|
|||
0x0a, 0x0a, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x0b, 0x0a, 0x07,
|
||||
0x52, 0x45, 0x47, 0x55, 0x4c, 0x41, 0x52, 0x10, 0x00, 0x12, 0x0d, 0x0a, 0x09, 0x54, 0x4f, 0x4d,
|
||||
0x42, 0x53, 0x54, 0x4f, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x53, 0x54, 0x4f, 0x52,
|
||||
0x41, 0x47, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x02, 0x2a, 0x39, 0x0a, 0x09, 0x4d,
|
||||
0x41, 0x47, 0x45, 0x5f, 0x47, 0x52, 0x4f, 0x55, 0x50, 0x10, 0x02, 0x2a, 0x60, 0x0a, 0x09, 0x4d,
|
||||
0x61, 0x74, 0x63, 0x68, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x16, 0x4d, 0x41, 0x54, 0x43,
|
||||
0x48, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49,
|
||||
0x45, 0x44, 0x10, 0x00, 0x12, 0x10, 0x0a, 0x0c, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47, 0x5f, 0x45,
|
||||
0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x42, 0x4f, 0x5a, 0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62,
|
||||
0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e,
|
||||
0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d, 0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f,
|
||||
0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70, 0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63,
|
||||
0x74, 0xaa, 0x02, 0x13, 0x4e, 0x65, 0x6f, 0x46, 0x53, 0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32,
|
||||
0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
0x51, 0x55, 0x41, 0x4c, 0x10, 0x01, 0x12, 0x14, 0x0a, 0x10, 0x53, 0x54, 0x52, 0x49, 0x4e, 0x47,
|
||||
0x5f, 0x4e, 0x4f, 0x54, 0x5f, 0x45, 0x51, 0x55, 0x41, 0x4c, 0x10, 0x02, 0x12, 0x0f, 0x0a, 0x0b,
|
||||
0x4e, 0x4f, 0x54, 0x5f, 0x50, 0x52, 0x45, 0x53, 0x45, 0x4e, 0x54, 0x10, 0x03, 0x42, 0x4f, 0x5a,
|
||||
0x37, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63,
|
||||
0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x61, 0x70, 0x69, 0x2d,
|
||||
0x67, 0x6f, 0x2f, 0x76, 0x32, 0x2f, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x2f, 0x67, 0x72, 0x70,
|
||||
0x63, 0x3b, 0x6f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0xaa, 0x02, 0x13, 0x4e, 0x65, 0x6f, 0x46, 0x53,
|
||||
0x2e, 0x41, 0x50, 0x49, 0x2e, 0x76, 0x32, 0x2e, 0x4f, 0x62, 0x6a, 0x65, 0x63, 0x74, 0x62, 0x06,
|
||||
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
|
|
@ -226,6 +226,8 @@ const (
|
|||
const (
|
||||
MatchUnknown MatchType = iota
|
||||
MatchStringEqual
|
||||
MatchStringNotEqual
|
||||
MatchNotPresent
|
||||
)
|
||||
|
||||
func (h *ShortHeader) GetVersion() *refs.Version {
|
||||
|
|
Loading…
Reference in a new issue