5f800458a3
With UN/LOCODE support, storage node may have `UN-LOCODE` attribute. Policy parser should support both `Ident` and `Strings` as filter keys to parse rules such as `FILTER "UN-LOCODE" EQ "RU LED" AS F`. Signed-off-by: Alex Vanin <alexey@nspcc.ru>
55 lines
1.1 KiB
EBNF
55 lines
1.1 KiB
EBNF
Policy ::=
|
|
RepStmt, [RepStmt],
|
|
CbtStmt?,
|
|
[SelectStmt],
|
|
[FilterStmt],
|
|
;
|
|
|
|
RepStmt ::=
|
|
'REP', Number1, (* number of object replicas *)
|
|
('AS', Ident)? (* optional selector name *)
|
|
;
|
|
|
|
CbtStmt ::= 'CBF', Number1 (* container backup factor *)
|
|
;
|
|
|
|
SelectStmt ::=
|
|
'SELECT', Number1, (* number of nodes to select without container backup factor *)
|
|
('IN', Clause?, Ident)?, (* bucket name *)
|
|
FROM, (Ident | '*'), (* filter reference or whole netmap *)
|
|
('AS', Ident)? (* optional selector name *)
|
|
;
|
|
|
|
Clause ::=
|
|
'SAME' (* nodes from the same bucket *)
|
|
| 'DISTINCT' (* nodes from distinct buckets *)
|
|
;
|
|
|
|
FilterStmt ::=
|
|
'FILTER', AndChain, ['OR', AndChain],
|
|
'AS', Ident (* obligatory filter name *)
|
|
;
|
|
|
|
AndChain ::=
|
|
Expr, ['AND', Expr]
|
|
;
|
|
|
|
Expr ::=
|
|
'@' Ident (* filter reference *)
|
|
| Key, Op, Value (* attribute filter *)
|
|
;
|
|
|
|
Op ::= 'EQ' | 'NE' | 'GE' | 'GT' | 'LT' | 'LE'
|
|
;
|
|
|
|
Key ::= Ident | String
|
|
;
|
|
|
|
Value ::= Ident | Number | String
|
|
;
|
|
|
|
Number1 ::= Digit1 [Digit];
|
|
Number ::= Digit [Digit];
|
|
|
|
Digit1 ::= '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' ;
|
|
Digit ::= '0' | Digit1;
|