From ea61d4e0e98d735bfaddb76d79dd61331198cab5 Mon Sep 17 00:00:00 2001 From: Stanislav Bogatyrev Date: Mon, 7 Sep 2020 14:32:37 +0300 Subject: [PATCH] [#68] Add SAME|DISTINCT selector clause Helps to define how selection is formed Signed-off-by: Stanislav Bogatyrev --- netmap/types.proto | 21 +++++++++++++++++++-- proto-docs/netmap.md | 16 ++++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/netmap/types.proto b/netmap/types.proto index 40bad0b..e7f0ae7 100644 --- a/netmap/types.proto +++ b/netmap/types.proto @@ -35,6 +35,20 @@ enum Operation { AND = 8; } +// Selector modifier showing how the node set will be formed +// By default selector just groups by attribute into a bucket selecting nodes +// only by their hash distance. +enum Clause{ + // No modifier defined. Will select nodes from bucket randomly. + CLAUSE_UNSPECIFIED = 0; + + // SAME will select only nodes having the same value of bucket attribute + SAME = 1; + + // DISTINCT will select nodes having different values of bucket attribute + DISTINCT = 2; +} + // Filter message Filter { // Name of the filter or a reference to the named filter. @@ -64,11 +78,14 @@ message Selector { // How many nodes to select from bucket uint32 count = 2; + // Selector modifier showing how to form a bucket + Clause clause = 3; + // Attribute bucket to select from - string attribute = 3; + string attribute = 4; // Filter reference to select from - string filter = 4; + string filter = 5; } // Exact bucket for each replica diff --git a/proto-docs/netmap.md b/proto-docs/netmap.md index 9315cfe..efe659e 100644 --- a/proto-docs/netmap.md +++ b/proto-docs/netmap.md @@ -194,12 +194,28 @@ Selector | ----- | ---- | ----- | ----------- | | name | [string](#string) | | Selector name to reference in object placement section | | count | [uint32](#uint32) | | How many nodes to select from bucket | +| clause | [Clause](#neo.fs.v2.netmap.Clause) | | Selector modifier showing how to form a bucket | | attribute | [string](#string) | | Attribute bucket to select from | | filter | [string](#string) | | Filter reference to select from | + + +### Clause +Selector modifier showing how the node set will be formed +By default selector just groups by attribute into a bucket selecting nodes +only by their hash distance. + +| Name | Number | Description | +| ---- | ------ | ----------- | +| CLAUSE_UNSPECIFIED | 0 | No modifier defined | +| SAME | 1 | SAME will select only nodes having the same value of bucket attribute | +| DISTINCT | 2 | DISTINCT will select nodes having different values of bucket attribute | + + + ### NodeInfo.State