Skip to content

Support EC+REP policies #3592

@cthulhu-rider

Description

@cthulhu-rider

Is your feature request related to a problem? Please describe.

with #3570, EC policies became available, but mutually exclusive w/ REP ones. It can make sense to support container policies having both EC and REP encoding/placement rules

Describe the solution you'd like

Now

drop IR condition

mostly, code is already ok to work w/ both lists. But not everywhere. Two definite places i know are

repRules := t.containerNodes.PrimaryCounts()
if len(repRules) > 0 {
typ := obj.Type()
broadcast := typ == objectSDK.TypeTombstone || typ == objectSDK.TypeLink || (!t.localOnly && typ == objectSDK.TypeLock) || len(obj.Children()) > 0
return t.distributeObject(obj, objMeta, encObj, func(obj objectSDK.Object, objMeta object.ContentMeta, encObj encodedObject) error {
return t.placementIterator.iterateNodesForObject(obj.GetID(), repRules, objNodeLists, broadcast, func(node nodeDesc) error {
return t.sendObject(obj, objMeta, encObj, node)
})
})
}
if ecRules := t.containerNodes.ECRules(); len(ecRules) > 0 {
if t.ecPart.RuleIndex >= 0 { // already encoded EC part
total := int(ecRules[t.ecPart.RuleIndex].DataPartNum + ecRules[t.ecPart.RuleIndex].ParityPartNum)
nodes := objNodeLists[len(repRules)+t.ecPart.RuleIndex]
return t.saveECPart(obj, objMeta, encObj, t.ecPart.Index, total, nodes)
}
if t.sessionSigner != nil {
if err := t.ecAndSaveObject(t.sessionSigner, obj, ecRules, objNodeLists[len(repRules):]); err != nil {
return err
}
}
}

if ecp.RuleIndex >= 0 {
if len(ecRules) > 0 {
p.processECPart(ctx, addr, ecp, ecRules, nn[len(repRules):])
return
}

for analysis, look for https://pkg.go.dev/github.com/nspcc-dev/neofs-sdk-go/netmap#NetMap.ContainerNodes calls

Then

explore possible optimizations for rules' processing. For example, handling GET is likely more efficient via REP rules initially

Additional context

#526

Metadata

Metadata

Assignees

No one assigned

    Labels

    I3Minimal impactS3Minimally significantU4Nothing urgentenhancementImproving existing functionalityneofs-storageStorage node application issues

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions