policy

package
v0.12.0-rc1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 2, 2020 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package policy provides facilities for creating policy from SQL-like language.

eBNF grammar is provided in `grammar.ebnf` for illustration.

Current limitations:

  1. 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.
  2. 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.

func Parse

func Parse(s string) (*netmap.PlacementPolicy, error)

Parse parses s into a placement policy.

func ToJSON

func ToJSON(np *netmap.PlacementPolicy) ([]byte, error)

ToJSON converts placement policy to JSON.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL