forked from TrueCloudLab/frostfs-api
[#58] netmap: Simplify Placement Policy
Proposed protobuf format for Placement Policy simplifies direct editing in visual editors and import/export from other formats like JSON. Signed-off-by: Stanislav Bogatyrev <stanislav@nspcc.ru>
This commit is contained in:
parent
e72dceebd3
commit
c8054c5daa
3 changed files with 129 additions and 138 deletions
|
@ -5,21 +5,7 @@ package neo.fs.v2.netmap;
|
||||||
option go_package = "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc;netmap";
|
option go_package = "github.com/nspcc-dev/neofs-api-go/v2/netmap/grpc;netmap";
|
||||||
option csharp_namespace = "NeoFS.API.v2.Netmap";
|
option csharp_namespace = "NeoFS.API.v2.Netmap";
|
||||||
|
|
||||||
// Set of rules to select a subset of nodes able to store container's objects
|
// Operations on filters
|
||||||
message PlacementPolicy {
|
|
||||||
// Replication factor
|
|
||||||
uint32 repl_factor = 1;
|
|
||||||
|
|
||||||
// Filters to apply to Network Map
|
|
||||||
message FilterGroup {
|
|
||||||
// Filter definition
|
|
||||||
message Filter {
|
|
||||||
// Filter identifier
|
|
||||||
string key = 1;
|
|
||||||
|
|
||||||
// Minimal simple filter
|
|
||||||
message SimpleFilter {
|
|
||||||
// Filtering operation
|
|
||||||
enum Operation {
|
enum Operation {
|
||||||
// No Operation defined
|
// No Operation defined
|
||||||
OPERATION_UNSPECIFIED = 0;
|
OPERATION_UNSPECIFIED = 0;
|
||||||
|
@ -48,46 +34,66 @@ message PlacementPolicy {
|
||||||
// Logical AND
|
// Logical AND
|
||||||
AND = 8;
|
AND = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Filter
|
||||||
|
message Filter {
|
||||||
|
// Name of the filter or a reference to the named filter.
|
||||||
|
// '*' means application to the whole unfiltered NetworkMap
|
||||||
|
// At top level it's used as a filter name. At lower levels it's considered to
|
||||||
|
// be a reference to another named filter
|
||||||
|
string name = 1;
|
||||||
|
|
||||||
|
// Key to filter
|
||||||
|
string key = 2;
|
||||||
|
|
||||||
// Filtering operation
|
// Filtering operation
|
||||||
Operation op = 1;
|
Operation op = 3;
|
||||||
|
|
||||||
// List of filters
|
// Value to match
|
||||||
message SimpleFilters {
|
string value = 4;
|
||||||
// List of filters
|
|
||||||
repeated SimpleFilter filters = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Filtering operation argument
|
// List of inner filters. Top level operation will be applied to the whole list.
|
||||||
oneof args {
|
repeated Filter filters = 5;
|
||||||
// Value
|
|
||||||
string value = 2;
|
|
||||||
// Result of other filter application
|
|
||||||
SimpleFilters f_args = 3;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// The rest of filter
|
|
||||||
SimpleFilter f = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resulting filter list
|
|
||||||
repeated Filter filters = 1;
|
|
||||||
|
|
||||||
// Selector
|
// Selector
|
||||||
message Selector {
|
message Selector {
|
||||||
// How many to select
|
// Selector name to reference in object placement section
|
||||||
|
string name = 1;
|
||||||
|
|
||||||
|
// How many nodes to select from bucket
|
||||||
|
uint32 count = 2;
|
||||||
|
|
||||||
|
// Attribute bucket to select from
|
||||||
|
string attribute = 3;
|
||||||
|
|
||||||
|
// Filter reference to select from
|
||||||
|
string filter = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Exact bucket for each replica
|
||||||
|
message Replica {
|
||||||
|
// How many object replicas to put
|
||||||
uint32 count = 1;
|
uint32 count = 1;
|
||||||
// Key to select
|
|
||||||
string key = 2;
|
// Named selector bucket to put in
|
||||||
|
string selector = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// List of selectors
|
// Set of rules to select a subset of nodes able to store container's objects
|
||||||
repeated Selector selectors = 2;
|
message PlacementPolicy {
|
||||||
|
// Rules to set number of object replicas and place each one into a particular bucket
|
||||||
|
repeated Replica replicas = 1;
|
||||||
|
|
||||||
// Parts of graph to exclude. Internal use.
|
// Container backup factor controls how deep NeoFS will search for nodes
|
||||||
repeated uint32 exclude = 3;
|
// alternatives to include into container.
|
||||||
}
|
uint32 container_backup_factor = 2;
|
||||||
// List of filter groups
|
|
||||||
repeated FilterGroup filter_groups = 2;
|
// Set of Selectors to form the container's nodes subset
|
||||||
|
repeated Selector selectors = 3;
|
||||||
|
|
||||||
|
// List of named filters to reference in selectors
|
||||||
|
repeated Filter filters = 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
// NeoFS node description
|
// NeoFS node description
|
||||||
|
@ -105,6 +111,10 @@ message NodeInfo {
|
||||||
|
|
||||||
// Value of the node attribute.
|
// Value of the node attribute.
|
||||||
string value = 2;
|
string value = 2;
|
||||||
|
|
||||||
|
// Parent keys, if any
|
||||||
|
// Example: For City it can be Region or Country
|
||||||
|
repeated string parents = 3;
|
||||||
}
|
}
|
||||||
// Carries list of the NeoFS node attributes in a string key-value format.
|
// Carries list of the NeoFS node attributes in a string key-value format.
|
||||||
repeated Attribute attributes = 3;
|
repeated Attribute attributes = 3;
|
||||||
|
|
|
@ -6,14 +6,12 @@
|
||||||
- [netmap/types.proto](#netmap/types.proto)
|
- [netmap/types.proto](#netmap/types.proto)
|
||||||
|
|
||||||
- Messages
|
- Messages
|
||||||
|
- [Filter](#neo.fs.v2.netmap.Filter)
|
||||||
- [NodeInfo](#neo.fs.v2.netmap.NodeInfo)
|
- [NodeInfo](#neo.fs.v2.netmap.NodeInfo)
|
||||||
- [NodeInfo.Attribute](#neo.fs.v2.netmap.NodeInfo.Attribute)
|
- [NodeInfo.Attribute](#neo.fs.v2.netmap.NodeInfo.Attribute)
|
||||||
- [PlacementPolicy](#neo.fs.v2.netmap.PlacementPolicy)
|
- [PlacementPolicy](#neo.fs.v2.netmap.PlacementPolicy)
|
||||||
- [PlacementPolicy.FilterGroup](#neo.fs.v2.netmap.PlacementPolicy.FilterGroup)
|
- [Replica](#neo.fs.v2.netmap.Replica)
|
||||||
- [PlacementPolicy.FilterGroup.Filter](#neo.fs.v2.netmap.PlacementPolicy.FilterGroup.Filter)
|
- [Selector](#neo.fs.v2.netmap.Selector)
|
||||||
- [PlacementPolicy.FilterGroup.Filter.SimpleFilter](#neo.fs.v2.netmap.PlacementPolicy.FilterGroup.Filter.SimpleFilter)
|
|
||||||
- [PlacementPolicy.FilterGroup.Filter.SimpleFilter.SimpleFilters](#neo.fs.v2.netmap.PlacementPolicy.FilterGroup.Filter.SimpleFilter.SimpleFilters)
|
|
||||||
- [PlacementPolicy.FilterGroup.Selector](#neo.fs.v2.netmap.PlacementPolicy.FilterGroup.Selector)
|
|
||||||
|
|
||||||
|
|
||||||
- [Scalar Value Types](#scalar-value-types)
|
- [Scalar Value Types](#scalar-value-types)
|
||||||
|
@ -29,6 +27,21 @@
|
||||||
<!-- end services -->
|
<!-- end services -->
|
||||||
|
|
||||||
|
|
||||||
|
<a name="neo.fs.v2.netmap.Filter"></a>
|
||||||
|
|
||||||
|
### Message Filter
|
||||||
|
Filter
|
||||||
|
|
||||||
|
|
||||||
|
| Field | Type | Label | Description |
|
||||||
|
| ----- | ---- | ----- | ----------- |
|
||||||
|
| name | [string](#string) | | Name of the filter or a reference to the named filter. '*' means application to the whole unfiltered NetworkMap At top level it's used as a filter name. At lower levels it's considered to be a reference to another named filter |
|
||||||
|
| key | [string](#string) | | Key to filter |
|
||||||
|
| op | [Operation](#neo.fs.v2.netmap.Operation) | | Filtering operation |
|
||||||
|
| value | [string](#string) | | Value to match |
|
||||||
|
| filters | [Filter](#neo.fs.v2.netmap.Filter) | repeated | List of inner filters. Top level operation will be applied to the whole list. |
|
||||||
|
|
||||||
|
|
||||||
<a name="neo.fs.v2.netmap.NodeInfo"></a>
|
<a name="neo.fs.v2.netmap.NodeInfo"></a>
|
||||||
|
|
||||||
### Message NodeInfo
|
### Message NodeInfo
|
||||||
|
@ -53,6 +66,7 @@ Attributes of the NeoFS node.
|
||||||
| ----- | ---- | ----- | ----------- |
|
| ----- | ---- | ----- | ----------- |
|
||||||
| key | [string](#string) | | Key of the node attribute. |
|
| key | [string](#string) | | Key of the node attribute. |
|
||||||
| value | [string](#string) | | Value of the node attribute. |
|
| value | [string](#string) | | Value of the node attribute. |
|
||||||
|
| parents | [string](#string) | repeated | Parent keys, if any Example: For City it can be Region or Country |
|
||||||
|
|
||||||
|
|
||||||
<a name="neo.fs.v2.netmap.PlacementPolicy"></a>
|
<a name="neo.fs.v2.netmap.PlacementPolicy"></a>
|
||||||
|
@ -63,69 +77,36 @@ Set of rules to select a subset of nodes able to store container's objects
|
||||||
|
|
||||||
| Field | Type | Label | Description |
|
| Field | Type | Label | Description |
|
||||||
| ----- | ---- | ----- | ----------- |
|
| ----- | ---- | ----- | ----------- |
|
||||||
| repl_factor | [uint32](#uint32) | | Replication factor |
|
| replicas | [Replica](#neo.fs.v2.netmap.Replica) | repeated | Rules to set number of object replicas and place each one into a particular bucket |
|
||||||
| filter_groups | [PlacementPolicy.FilterGroup](#neo.fs.v2.netmap.PlacementPolicy.FilterGroup) | repeated | List of filter groups |
|
| container_backup_factor | [uint32](#uint32) | | Container backup factor controls how deep NeoFS will search for nodes alternatives to include into container. |
|
||||||
|
| selectors | [Selector](#neo.fs.v2.netmap.Selector) | repeated | Set of Selectors to form the container's nodes subset |
|
||||||
|
| filters | [Filter](#neo.fs.v2.netmap.Filter) | repeated | List of named filters to reference in selectors |
|
||||||
|
|
||||||
|
|
||||||
<a name="neo.fs.v2.netmap.PlacementPolicy.FilterGroup"></a>
|
<a name="neo.fs.v2.netmap.Replica"></a>
|
||||||
|
|
||||||
### Message PlacementPolicy.FilterGroup
|
### Message Replica
|
||||||
Filters to apply to Network Map
|
Exact bucket for each replica
|
||||||
|
|
||||||
|
|
||||||
| Field | Type | Label | Description |
|
| Field | Type | Label | Description |
|
||||||
| ----- | ---- | ----- | ----------- |
|
| ----- | ---- | ----- | ----------- |
|
||||||
| filters | [PlacementPolicy.FilterGroup.Filter](#neo.fs.v2.netmap.PlacementPolicy.FilterGroup.Filter) | repeated | Resulting filter list |
|
| count | [uint32](#uint32) | | How many object replicas to put |
|
||||||
| selectors | [PlacementPolicy.FilterGroup.Selector](#neo.fs.v2.netmap.PlacementPolicy.FilterGroup.Selector) | repeated | List of selectors |
|
| selector | [string](#string) | | Named selector bucket to put in |
|
||||||
| exclude | [uint32](#uint32) | repeated | Parts of graph to exclude. Internal use. |
|
|
||||||
|
|
||||||
|
|
||||||
<a name="neo.fs.v2.netmap.PlacementPolicy.FilterGroup.Filter"></a>
|
<a name="neo.fs.v2.netmap.Selector"></a>
|
||||||
|
|
||||||
### Message PlacementPolicy.FilterGroup.Filter
|
### Message Selector
|
||||||
Filter definition
|
|
||||||
|
|
||||||
|
|
||||||
| Field | Type | Label | Description |
|
|
||||||
| ----- | ---- | ----- | ----------- |
|
|
||||||
| key | [string](#string) | | Filter identifier |
|
|
||||||
| f | [PlacementPolicy.FilterGroup.Filter.SimpleFilter](#neo.fs.v2.netmap.PlacementPolicy.FilterGroup.Filter.SimpleFilter) | | The rest of filter |
|
|
||||||
|
|
||||||
|
|
||||||
<a name="neo.fs.v2.netmap.PlacementPolicy.FilterGroup.Filter.SimpleFilter"></a>
|
|
||||||
|
|
||||||
### Message PlacementPolicy.FilterGroup.Filter.SimpleFilter
|
|
||||||
Minimal simple filter
|
|
||||||
|
|
||||||
|
|
||||||
| Field | Type | Label | Description |
|
|
||||||
| ----- | ---- | ----- | ----------- |
|
|
||||||
| op | [PlacementPolicy.FilterGroup.Filter.SimpleFilter.Operation](#neo.fs.v2.netmap.PlacementPolicy.FilterGroup.Filter.SimpleFilter.Operation) | | Filtering operation |
|
|
||||||
| value | [string](#string) | | Value |
|
|
||||||
| f_args | [PlacementPolicy.FilterGroup.Filter.SimpleFilter.SimpleFilters](#neo.fs.v2.netmap.PlacementPolicy.FilterGroup.Filter.SimpleFilter.SimpleFilters) | | Result of other filter application |
|
|
||||||
|
|
||||||
|
|
||||||
<a name="neo.fs.v2.netmap.PlacementPolicy.FilterGroup.Filter.SimpleFilter.SimpleFilters"></a>
|
|
||||||
|
|
||||||
### Message PlacementPolicy.FilterGroup.Filter.SimpleFilter.SimpleFilters
|
|
||||||
List of filters
|
|
||||||
|
|
||||||
|
|
||||||
| Field | Type | Label | Description |
|
|
||||||
| ----- | ---- | ----- | ----------- |
|
|
||||||
| filters | [PlacementPolicy.FilterGroup.Filter.SimpleFilter](#neo.fs.v2.netmap.PlacementPolicy.FilterGroup.Filter.SimpleFilter) | repeated | List of filters |
|
|
||||||
|
|
||||||
|
|
||||||
<a name="neo.fs.v2.netmap.PlacementPolicy.FilterGroup.Selector"></a>
|
|
||||||
|
|
||||||
### Message PlacementPolicy.FilterGroup.Selector
|
|
||||||
Selector
|
Selector
|
||||||
|
|
||||||
|
|
||||||
| Field | Type | Label | Description |
|
| Field | Type | Label | Description |
|
||||||
| ----- | ---- | ----- | ----------- |
|
| ----- | ---- | ----- | ----------- |
|
||||||
| count | [uint32](#uint32) | | How many to select |
|
| name | [string](#string) | | Selector name to reference in object placement section |
|
||||||
| key | [string](#string) | | Key to select |
|
| count | [uint32](#uint32) | | How many nodes to select from bucket |
|
||||||
|
| attribute | [string](#string) | | Attribute bucket to select from |
|
||||||
|
| filter | [string](#string) | | Filter reference to select from |
|
||||||
|
|
||||||
<!-- end messages -->
|
<!-- end messages -->
|
||||||
|
|
||||||
|
@ -143,10 +124,10 @@ Represents the enumeration of various states of the NeoFS node.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="neo.fs.v2.netmap.PlacementPolicy.FilterGroup.Filter.SimpleFilter.Operation"></a>
|
<a name="neo.fs.v2.netmap.Operation"></a>
|
||||||
|
|
||||||
### PlacementPolicy.FilterGroup.Filter.SimpleFilter.Operation
|
### Operation
|
||||||
Filtering operation
|
Operations on filters
|
||||||
|
|
||||||
| Name | Number | Description |
|
| Name | Number | Description |
|
||||||
| ---- | ------ | ----------- |
|
| ---- | ------ | ----------- |
|
||||||
|
|
Loading…
Reference in a new issue