Documentation ¶
Overview ¶
Package policy provides facilities for creating policy from SQL-like language.
eBNF grammar is provided in `grammar.ebnf` for illustration.
Current limitations:
- Grouping filter expressions in parenthesis is not supported right now. Requiring this will make query too verbose, making it optional makes our grammar not LL(1). This can be supported in future.
- Filters must be defined before they are used. This requirement may be relaxed in future.
Example query: REP 1 in SPB REP 2 in Americas CBF 4 SELECT 1 Node IN City FROM SPBSSD AS SPB SELECT 2 Node IN SAME City FROM Americas AS Americas FILTER SSD EQ true AS IsSSD FILTER @IsSSD AND Country eq "RU" AND City eq "St.Petersburg" AS SPBSSD FILTER 'Continent' == 'North America' OR Continent == 'South America' AS Americas
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidNumber = errors.New("policy: expected positive integer") ErrUnknownClause = errors.New("policy: unknown clause") ErrUnknownOp = errors.New("policy: unknown operation") ErrUnknownFilter = errors.New("policy: filter not found") ErrUnknownSelector = errors.New("policy: selector not found") )
Functions ¶
func FromJSON ¶
func FromJSON(data []byte) (*netmap.PlacementPolicy, error)
ToJSON creates placement policy from JSON.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.