netmap: Provide placement methods returning indices instead of copied node descriptors #213

Open
opened 2025-12-28 18:07:27 +00:00 by sami · 1 comment
Owner

Originally created by @cthulhu-rider on GitHub (Dec 20, 2023).

network map is an array of storage nodes' descriptors of type https://pkg.go.dev/github.com/nspcc-dev/neofs-sdk-go@v1.0.0-rc.11/netmap#NodeInfo, and

return [][]NodeInfo. This is pretty big overhead since all resulting 2d array's items are copied elements from the input array. Moreover, the elements may repeat (afaik)

Describe the solution you'd like

provide methods returning [][]int - indices from the inital array

Describe alternatives you've considered

provide iterators, but it's better to start with indices cuz they are simpler imo

Additional context

Originally created by @cthulhu-rider on GitHub (Dec 20, 2023). ## Is your feature request related to a problem? Please describe. network map is an array of storage nodes' descriptors of type https://pkg.go.dev/github.com/nspcc-dev/neofs-sdk-go@v1.0.0-rc.11/netmap#NodeInfo, and * https://pkg.go.dev/github.com/nspcc-dev/neofs-sdk-go@v1.0.0-rc.11/netmap#NetMap.ContainerNodes * https://pkg.go.dev/github.com/nspcc-dev/neofs-sdk-go@v1.0.0-rc.11/netmap#NetMap.PlacementVectors return `[][]NodeInfo`. This is pretty big overhead since all resulting 2d array's items are copied elements from the input array. Moreover, the elements may repeat (afaik) ## Describe the solution you'd like provide methods returning `[][]int` - indices from the inital array ## Describe alternatives you've considered provide iterators, but it's better to start with indices cuz they are simpler imo ## Additional context * https://github.com/nspcc-dev/neofs-node/issues/2692
Author
Owner

@roman-khimov commented on GitHub (Dec 20, 2023):

[][]*NodeInfo is an option too, [][]int won't be a pleasure to use.

@roman-khimov commented on GitHub (Dec 20, 2023): `[][]*NodeInfo` is an option too, `[][]int` won't be a pleasure to use.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
nspcc-dev/neofs-sdk-go#213
No description provided.