Skip to content

Commit 0588aca

Browse files
committed
object: Support numerical search queries
Previously, protocol did not support numerical search queries for objects. This may be needed for system attributes such as payload size or creation epoch, and for user ones if required by the client application. New values of `MatchType` enumeration are added: `>`, `>=`, `<`, `<=`. These attributes allow user to search for objects with any decimal attributes. While only base-10 numbers are allowed, additional bases may be supported in the future without new enumerations Note that the previously added `STRING_EQUAL` / `STRING_NOT_EQUAL` matchers are suitable for numerical `==` / `!=`. Closes #265. Signed-off-by: Leonard Lyubich <[email protected]>
1 parent 090f9bf commit 0588aca

File tree

4 files changed

+23
-0
lines changed

4 files changed

+23
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## [Unreleased]
44

55
### Added
6+
- Numeric operands for object search queries (#265)
67

78
### Changed
89

object/service.proto

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,9 @@ message SearchRequest {
496496
// objects. Most human users expect to get only object they can directly
497497
// work with. In that case, `$Object:ROOT` filter should be used.
498498
//
499+
// If `match_type` field is numerical, both `value` field and object
500+
// attribute MUST be base-10 integers.
501+
//
499502
// By default `key` field refers to the corresponding object's `Attribute`.
500503
// Some Object's header fields can also be accessed by adding `$Object:`
501504
// prefix to the name. Here is the list of fields available via this prefix:

object/types.proto

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,18 @@ enum MatchType {
4747

4848
// String prefix match
4949
COMMON_PREFIX = 4;
50+
51+
// Numerical 'greater than'
52+
NUM_GT = 5;
53+
54+
// Numerical 'greater or equal than'
55+
NUM_GE = 6;
56+
57+
// Numerical 'less than'
58+
NUM_LT = 7;
59+
60+
// Numerical 'less or equal than'
61+
NUM_LE = 8;
5062
}
5163

5264
// Short header fields

proto-docs/object.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -771,6 +771,9 @@ container, including Regular object, Tombstones and Storage Group
771771
objects. Most human users expect to get only object they can directly
772772
work with. In that case, `$Object:ROOT` filter should be used.
773773

774+
If `match_type` field is numerical, both `value` field and object
775+
attribute MUST be base-10 integers.
776+
774777
By default `key` field refers to the corresponding object's `Attribute`.
775778
Some Object's header fields can also be accessed by adding `$Object:`
776779
prefix to the name. Here is the list of fields available via this prefix:
@@ -1021,6 +1024,10 @@ Type of match expression
10211024
| STRING_NOT_EQUAL | 2 | Full string mismatch |
10221025
| NOT_PRESENT | 3 | Lack of key |
10231026
| COMMON_PREFIX | 4 | String prefix match |
1027+
| NUM_GT | 5 | Numerical 'greater than' |
1028+
| NUM_GE | 6 | Numerical 'greater or equal than' |
1029+
| NUM_LT | 7 | Numerical 'less than' |
1030+
| NUM_LE | 8 | Numerical 'less or equal than' |
10241031

10251032

10261033

0 commit comments

Comments
 (0)