Skip to content

Commit ad519d0

Browse files
Merge pull request #381 from nspcc-dev/initial-placement
2 parents 8fb324b + 9e51142 commit ad519d0

3 files changed

Lines changed: 72 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## [Unreleased]
44

55
### Added
6+
- Support for initial placement policy of containers (#381)
67

78
### Changed
89

netmap/types.proto

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,41 @@ message PlacementPolicy {
178178
}
179179
// Erasure coding rules. Limited to 4 items.
180180
repeated ECRule ec_rules = 6 [json_name = "ecRules"];
181+
182+
// Rules applied during initial data placement.
183+
//
184+
// `replica_limits` allows to override `Replica.count` and EC partitions. If
185+
// set, `replica_limits` must have a length equal to the sum of `replicas`
186+
// (`RN`) and `ec_rules` length. Each of first `RN` elements of
187+
// `replica_limits` must be less than or equal to corresponding
188+
// `Replica.count`. The remaining elements must be either 0 (corresponding
189+
// EC rule is skipped) or 1 (done). At least one `replica_limits` element
190+
// must be non-zero.
191+
//
192+
// `max_replicas` allows to limit total number of replicas and EC partitions
193+
// for successful operation. If set, `max_replicas` must not overflow total
194+
// replica limit (`replica_limits` or main ones).
195+
//
196+
// `prefer_local` allows to tell server to try to store `MaxReplicas`
197+
// replicas in locations that include this server. `prefer_local` must be set
198+
// along with `max_replicas` only.
199+
//
200+
// Either `replica_limits` or `max_replicas` must be specified.
201+
//
202+
// Initial policy must not repeat the main one. In particular, policy with
203+
// `replica_limits` equal to main ones only is invalid.
204+
message Initial {
205+
// Limits on the number of replicas and EC partitions
206+
repeated uint32 replica_limits = 1 [json_name = "replicaLimits"];
207+
208+
// Maximum total number of replicas
209+
uint32 max_replicas = 2 [json_name = "maxReplicas"];
210+
211+
// Flag to prefer local placement over regular one
212+
bool prefer_local = 3 [json_name = "preferLocal"];
213+
}
214+
// Initial placement rules.
215+
Initial initial = 7 [json_name = "initial"];
181216
}
182217

183218
// NeoFS node description

proto-docs/netmap.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
- [NodeInfo.Attribute](#neo.fs.v2.netmap.NodeInfo.Attribute)
3535
- [PlacementPolicy](#neo.fs.v2.netmap.PlacementPolicy)
3636
- [PlacementPolicy.ECRule](#neo.fs.v2.netmap.PlacementPolicy.ECRule)
37+
- [PlacementPolicy.Initial](#neo.fs.v2.netmap.PlacementPolicy.Initial)
3738
- [Replica](#neo.fs.v2.netmap.Replica)
3839
- [Selector](#neo.fs.v2.netmap.Selector)
3940

@@ -488,6 +489,7 @@ storage policy definition languages.
488489
| filters | [Filter](#neo.fs.v2.netmap.Filter) | repeated | List of named filters to reference in selectors |
489490
| subnet_id | [neo.fs.v2.refs.SubnetID](#neo.fs.v2.refs.SubnetID) | | DEPRECATED. Was used for subnetwork ID to select nodes from, currently ignored. |
490491
| ec_rules | [PlacementPolicy.ECRule](#neo.fs.v2.netmap.PlacementPolicy.ECRule) | repeated | Erasure coding rules. Limited to 4 items. |
492+
| initial | [PlacementPolicy.Initial](#neo.fs.v2.netmap.PlacementPolicy.Initial) | | Initial placement rules. |
491493

492494

493495
<a name="neo.fs.v2.netmap.PlacementPolicy.ECRule"></a>
@@ -537,6 +539,40 @@ because they have no payload.
537539
| selector | [string](#string) | | Name of the linked selector |
538540

539541

542+
<a name="neo.fs.v2.netmap.PlacementPolicy.Initial"></a>
543+
544+
### Message PlacementPolicy.Initial
545+
Rules applied during initial data placement.
546+
547+
`replica_limits` allows to override `Replica.count` and EC partitions. If
548+
set, `replica_limits` must have a length equal to the sum of `replicas`
549+
(`RN`) and `ec_rules` length. Each of first `RN` elements of
550+
`replica_limits` must be less than or equal to corresponding
551+
`Replica.count`. The remaining elements must be either 0 (corresponding
552+
EC rule is skipped) or 1 (done). At least one `replica_limits` element
553+
must be non-zero.
554+
555+
`max_replicas` allows to limit total number of replicas and EC partitions
556+
for successful operation. If set, `max_replicas` must not overflow total
557+
replica limit (`replica_limits` or main ones).
558+
559+
`prefer_local` allows to tell server to try to store `MaxReplicas`
560+
replicas in locations that include this server. `prefer_local` must be set
561+
along with `max_replicas` only.
562+
563+
Either `replica_limits` or `max_replicas` must be specified.
564+
565+
Initial policy must not repeat the main one. In particular, policy with
566+
`replica_limits` equal to main ones only is invalid.
567+
568+
569+
| Field | Type | Label | Description |
570+
| ----- | ---- | ----- | ----------- |
571+
| replica_limits | [uint32](#uint32) | repeated | Limits on the number of replicas and EC partitions |
572+
| max_replicas | [uint32](#uint32) | | Maximum total number of replicas |
573+
| prefer_local | [bool](#bool) | | Flag to prefer local placement over regular one |
574+
575+
540576
<a name="neo.fs.v2.netmap.Replica"></a>
541577

542578
### Message Replica

0 commit comments

Comments
 (0)