diff --git a/doc/image/filter_illustration.svg b/doc/image/filter_illustration.svg index a57aa68..7eedf3d 100644 --- a/doc/image/filter_illustration.svg +++ b/doc/image/filter_illustration.svg @@ -1,4 +1,4 @@ -
FILTER Color EQ 'Red' AS RedNodes
FILTER Color EQ 'Red' AS RedNodes
FILTER Color EQ 'Blue' AS BlueNodes
FILTER Color EQ 'Blue' AS BlueNodes
FILTER @RedNodes OR @BlueNodes AS MyNodes
FILTER @RedNodes OR @BlueNodes AS MyNodes
*
*
MyNodes
MyNodes
Text is not SVG - cannot display
\ No newline at end of file +
FILTER Color EQ 'Red' AS RedNodes
FILTER Color EQ 'Red' AS RedNodes
FILTER Color EQ 'Blue' AS BlueNodes
FILTER Color EQ 'Blue' AS BlueNodes
FILTER @RedNodes OR @BlueNodes AS MyNodes
FILTER @RedNodes OR @BlueNodes AS MyNodes
*
*
MyNodes
MyNodes
Text is not SVG - cannot display
diff --git a/doc/image/placement_policy.svg b/doc/image/placement_policy.svg index 9cc8a1a..2820c64 100644 --- a/doc/image/placement_policy.svg +++ b/doc/image/placement_policy.svg @@ -1,4 +1,4 @@ -
FILTER
FILTER
FILTER
FILTER
FILTER
FILTER
SELECT
SELECT
SELECT
SELECT
SELECT
SELECT
FILTER
FILTER
FILTER
FILTER
FILTER
FILTER
REP
REP
REP
REP
REP
REP
netmap
netmap
Text is not SVG - cannot display
\ No newline at end of file +
FILTER
FILTER
FILTER
FILTER
FILTER
FILTER
SELECT
SELECT
SELECT
SELECT
SELECT
SELECT
FILTER
FILTER
FILTER
FILTER
FILTER
FILTER
REP
REP
REP
REP
REP
REP
netmap
netmap
Text is not SVG - cannot display
diff --git a/doc/image/rep_illustration.svg b/doc/image/rep_illustration.svg index 8bcc327..6955499 100644 --- a/doc/image/rep_illustration.svg +++ b/doc/image/rep_illustration.svg @@ -1,4 +1,4 @@ -
(...)
(...)
SELECT 2 IN DISTINCT Color FROM RedOrBlueNodes AS MyNodes
SELECT 2 IN DISTINCT Color FROM RedOrBlueNodes AS MyNodes
MyNodes
MyNodes
REP 1 IN MyNodes
REP 1 IN MyNodes
Text is not SVG - cannot display
\ No newline at end of file +
(...)
(...)
SELECT 2 IN DISTINCT Color FROM RedOrBlueNodes AS MyNodes
SELECT 2 IN DISTINCT Color FROM RedOrBlueNodes AS MyNodes
MyNodes
MyNodes
REP 1 IN MyNodes
REP 1 IN MyNodes
Text is not SVG - cannot display
diff --git a/doc/image/sample_netmap.svg b/doc/image/sample_netmap.svg index 3d0b39f..ea4928e 100644 --- a/doc/image/sample_netmap.svg +++ b/doc/image/sample_netmap.svg @@ -1,4 +1,4 @@ -
C
C
A
A
Netmap
Netmap
B
B
D
D
E
E
F
F
G
G
H
H
I
I
Text is not SVG - cannot display
\ No newline at end of file +
C
C
A
A
Netmap
Netmap
B
B
D
D
E
E
F
F
G
G
H
H
I
I
Text is not SVG - cannot display
diff --git a/doc/image/select_illustration.svg b/doc/image/select_illustration.svg index 3a0956a..83ee783 100644 --- a/doc/image/select_illustration.svg +++ b/doc/image/select_illustration.svg @@ -1,4 +1,4 @@ -
FILTER @RedNodes OR @BlueNodes AS RedOrBlueNodes
FILTER @RedNodes OR @BlueNodes AS RedOrBlueNodes
RedOrBlueNodes
RedOrBlueNodes
(...)
(...)
SELECT 2 IN DISTINCT Color FROM RedOrBlueNodes AS MyNodes
SELECT 2 IN DISTINCT Color FROM RedOrBlueNodes AS MyNodes
MyNodes
MyNodes
Text is not SVG - cannot display
\ No newline at end of file +
FILTER @RedNodes OR @BlueNodes AS RedOrBlueNodes
FILTER @RedNodes OR @BlueNodes AS RedOrBlueNodes
RedOrBlueNodes
RedOrBlueNodes
(...)
(...)
SELECT 2 IN DISTINCT Color FROM RedOrBlueNodes AS MyNodes
SELECT 2 IN DISTINCT Color FROM RedOrBlueNodes AS MyNodes
MyNodes
MyNodes
Text is not SVG - cannot display
diff --git a/doc/policy.md b/doc/policy.md index 6818468..c7597ea 100644 --- a/doc/policy.md +++ b/doc/policy.md @@ -101,16 +101,16 @@ In a nutshell, a `SELECT` takes a filter result as input and outputs a specific Let's see some examples ```sql -- Selects exactly one node from the entire netmap -SELECT 1 FROM * +SELECT 1 FROM * -- Same as above, but with an identifier for the selection -SELECT 1 FROM * AS ONE +SELECT 1 FROM * AS ONE --- Selects two nodes from the RedOrBlueNodes filter, such that both selected nodes +-- Selects two nodes from the RedOrBlueNodes filter, such that both selected nodes -- share the same value for the Color attribute, i.e. both red or both blue. -SELECT 2 IN SAME Color FROM RedOrBlueNodes +SELECT 2 IN SAME Color FROM RedOrBlueNodes --- Selects two nodes from the RedOrBlueNodes filter, such that the selected nodes +-- Selects two nodes from the RedOrBlueNodes filter, such that the selected nodes -- have distinct values for the Color attribute, i.e. one red and one blue. -- The selection is also given an identifier. SELECT 2 IN DISTINCT Color FROM RedOrBlueNodes AS MyNodes @@ -173,18 +173,18 @@ In additional to this basic syntax, there are a couple of additional useful opti ### The policy playground -> ℹ️ This section assumes you have an up-to-date version of the `frostfs-cli`. +> ℹ️ This section assumes you have an up-to-date version of the `frostfs-cli`. While simple placement policies have predictable results that can be understood at a glance, more complex ones need careful consideration before deployment. In order to simplify understanding a policy's outcome and experimenting while learning, a builtin tool is provided as part of the `frostfs-cli` for this purpose: the policy playground. -For the remainder of this guide, we will use the policy playground to setup a virtual netmap (that is, one that doesn't require any networking or deployment) and test various policies. In order to visualize this netmap easily, each node will have three attributes: a character, a shape and a color +For the remainder of this guide, we will use the policy playground to setup a virtual netmap (that is, one that doesn't require any networking or deployment) and test various policies. In order to visualize this netmap easily, each node will have three attributes: a character, a shape and a color ![Sample Netmap](./image/sample_netmap.svg) We can start the policy playground as follows: ```sh $ frostfs-cli container policy-playground -> +> ``` Since we didn't pass any endpoint, the initial netmap is empty, which we can verify with the `ls` command (to list the nodes in the netmap): @@ -400,7 +400,7 @@ FILTER Color EQ 'Green' AS GreenNodes #### Example #6 ```sql REP 1 IN MyNodes -REP 2 +REP 2 CBF 2 SELECT 1 FROM CuteNodes AS MyNodes FILTER (Color EQ 'Blue') AND NOT (Shape EQ 'Circle' OR Shape EQ 'Square') AS CuteNodes @@ -442,4 +442,4 @@ Others: - `ls`: list nodes in the current netmap and their attributes - `add`: add a node to the current netmap. If it already exists, it will be overwritten. - `remove`: remove a node from the current netmap. -- `eval`: evaluate a placement policy on the current netmap. \ No newline at end of file +- `eval`: evaluate a placement policy on the current netmap.