Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature/add-netmapCandidates-netmap-method #647

Merged
merged 3 commits into from
Jun 29, 2021
Merged

feature/add-netmapCandidates-netmap-method #647

merged 3 commits into from
Jun 29, 2021

Conversation

carpawell
Copy link
Member

@carpawell carpawell commented Jun 25, 2021

@carpawell carpawell self-assigned this Jun 25, 2021
@carpawell carpawell added the enhancement Improving existing functionality label Jun 25, 2021
@codecov
Copy link

codecov bot commented Jun 25, 2021

Codecov Report

Merging #647 (700e5e1) into master (1f461ba) will decrease coverage by 0.18%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #647      +/-   ##
==========================================
- Coverage   43.23%   43.05%   -0.19%     
==========================================
  Files         203      204       +1     
  Lines        8012     8072      +60     
==========================================
+ Hits         3464     3475      +11     
- Misses       4211     4256      +45     
- Partials      337      341       +4     
Impacted Files Coverage Δ
cmd/neofs-node/config/grpc/config.go 77.77% <0.00%> (-22.23%) ⬇️
pkg/services/object/search/remote.go 36.36% <0.00%> (-5.31%) ⬇️
pkg/network/tls.go 71.42% <0.00%> (-5.05%) ⬇️
cmd/neofs-node/config/node/config.go 75.00% <0.00%> (-5.00%) ⬇️
pkg/services/object/search/exec.go 54.09% <0.00%> (-0.75%) ⬇️
pkg/services/object/get/remote.go 92.30% <0.00%> (-0.29%) ⬇️
pkg/services/object/get/exec.go 71.79% <0.00%> (-0.18%) ⬇️
pkg/services/object/get/prm.go 63.63% <0.00%> (ø)
pkg/services/object/get/util.go 17.39% <0.00%> (ø)
pkg/services/object/search/prm.go 66.66% <0.00%> (ø)
... and 6 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1f461ba...700e5e1. Read the comment docs.

Use defined constant variable instead of
hardcoded number in error message.

Signed-off-by: Pavel Karpy <[email protected]>
@carpawell carpawell marked this pull request as ready for review June 28, 2021 17:15
// GetNetMapCandidatesValues groups the stack parameters
// returned by get network map candidates test invoke.
type GetNetMapCandidatesValues struct {
NetmapNodes []*PeerWithState
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls make it unexported, or it will be hard to keep code and logic compatibility.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

made unexported and add getter to it

pkg/morph/client/netmap/netmap.go Show resolved Hide resolved
}

func peerWithStateFromStackItem(prm stackitem.Item) (*PeerWithState, error) {
if prm.Type() != stackitem.StructT {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need explicit stackitem.StructT which is supported by client.ArrayFromStackItem?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

an additional layer of checks since there are too deep nesting of structures(there was no nested structs parsing before that PR)

var res PeerWithState

// peer
if prms[0].Type() != stackitem.StructT {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as for stackitem.StructT and below


func peersWithStateFromStackItems(stack []stackitem.Item, method string) (*GetNetMapCandidatesValues, error) {
if ln := len(stack); ln != 1 {
return nil, fmt.Errorf("unexpected stack intem count (%s): %d", method, ln)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return nil, fmt.Errorf("unexpected stack intem count (%s): %d", method, ln)
return nil, fmt.Errorf("unexpected stack item count (%s): %d", method, ln)

and re-check if it caused by copy-paste.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed and checked

pkg/morph/client/netmap/netmap.go Outdated Show resolved Hide resolved
Add `netmapCandidates` method to `netmap` client
wrapper. Method parses node storages candidates
for the next epoch.

Signed-off-by: Pavel Karpy <[email protected]>
@carpawell carpawell requested a review from alexvanin June 29, 2021 18:53
@alexvanin alexvanin merged commit a2b622d into nspcc-dev:master Jun 29, 2021
@carpawell carpawell deleted the feature/add-`netmapCandidates`-netmap-method branch June 29, 2021 19:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improving existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants