WIP: [#131] add netmap-aware dialer #196

Closed
olefirenque wants to merge 5 commits from olefirenque/frostfs-sdk-go:173-add_netmap_aware_dialer into master
Collaborator

Refers to #173

Refers to #173
olefirenque added 1 commit 2023-11-30 10:14:05 +00:00
[#131] client: add basic netmap dialer
Some checks failed
Tests and linters / Tests (1.20) (pull_request) Failing after 48s
DCO / DCO (pull_request) Successful in 1m4s
Tests and linters / Tests (1.21) (pull_request) Successful in 1m8s
Tests and linters / Lint (pull_request) Failing after 1m50s
6ace44f6b5
Signed-off-by: olefirenque <egor.olefirenko892@gmail.com>
olefirenque added 1 commit 2023-11-30 10:26:34 +00:00
[#131] client: get rid of slices.Equal
Some checks failed
DCO / DCO (pull_request) Successful in 1m0s
Tests and linters / Tests (1.21) (pull_request) Successful in 1m24s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m30s
Tests and linters / Lint (pull_request) Failing after 1m50s
dd8fb59efe
Signed-off-by: olefirenque <egor.olefirenko892@gmail.com>
fyrchik reviewed 2023-11-30 10:54:59 +00:00
@ -6,2 +6,4 @@
"crypto/tls"
"errors"
"fmt"
netmap "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/netmap/grpc"
Owner

stdlib imports should form a separate group, could you move netmap below?

stdlib imports should form a separate group, could you move `netmap` below?
Owner

stdlib imports should form a separate group, could you move netmap below?

stdlib imports should form a separate group, could you move `netmap` below?
Owner

Also, we have netmap in the SDK (this repo), can we use it instead of the api package?

Also, we have netmap in the SDK (this repo), can we use it instead of the api package?
Author
Collaborator

Yes, I used the grpc domain by mistake.
Fixed.

Yes, I used the grpc domain by mistake. Fixed.
client/client.go Outdated
@ -113,0 +119,4 @@
return err
}
isEqualSlices := func(a, b []byte) bool {
Owner

Use bytes.Equal?

Use `bytes.Equal`?
client/client.go Outdated
@ -113,0 +135,4 @@
nodes := c.prm.NetMap.GetNodes()
for _, node := range nodes {
if isEqualSlices([]byte(u.Host), node.PublicKey) {
return c.Dial(ctx, PrmDial{Endpoint: node.Addresses[0]})
Owner

This is where we can implement any logic we need. I suggest moving this dial in a separate function, we might want:

  1. Choose addresses from ExternalAddresses attribute
  2. Chose random address.
  3. Handle dial errors (if one address is unavailable, try the next one).

It would be easier to do this in a separate function, in this one we have a simple dial.

This is where we can implement any logic we need. I suggest moving this `dial` in a separate function, we might want: 1. Choose addresses from `ExternalAddresses` attribute 2. Chose _random_ address. 3. Handle dial errors (if one address is unavailable, try the next one). It would be easier to do this in a separate function, in this one we have a simple `dial`.
Author
Collaborator

Should each option be explicitly defined by client user?

Should each option be explicitly defined by client user?
Owner

We can discuss. IMO this could be governed with a single parameter, with some reasonable default.

We can discuss. IMO this could be governed with a single parameter, with some reasonable default.
olefirenque added 1 commit 2023-11-30 11:28:53 +00:00
[#131] client: refactor netmap dialer
All checks were successful
DCO / DCO (pull_request) Successful in 1m8s
Tests and linters / Tests (1.21) (pull_request) Successful in 1m21s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m31s
Tests and linters / Lint (pull_request) Successful in 2m51s
cf4677ecb9
Signed-off-by: olefirenque <egor.olefirenko892@gmail.com>
olefirenque force-pushed 173-add_netmap_aware_dialer from 2b9eaeb2a6 to 7b03c3a6a1 2023-12-07 08:54:42 +00:00 Compare
olefirenque added 1 commit 2023-12-07 09:14:23 +00:00
[#131] client: pass PrmDialOptions to dial call
All checks were successful
DCO / DCO (pull_request) Successful in 1m2s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m25s
Tests and linters / Lint (pull_request) Successful in 3m0s
Tests and linters / Tests (1.21) (pull_request) Successful in 1m1s
aa536d4a4d
Signed-off-by: olefirenque <egor.olefirenko892@gmail.com>
Author
Collaborator

Since rpc.Balance is a static function in Client.Dial(...) call, it is hard to reach high coverage of Dial/NetMapDial methods. Would it be suitable to extract rpc call to grpc client for inverting the dependency?

Also I'm concerned about backward compatibility in case of modification prmDial structure (some of field were extracted in the embedding in the last commit). Maybe it would be convenient to have constructors for such types?

Since `rpc.Balance` is a static function in `Client.Dial(...)` call, it is hard to reach high coverage of Dial/NetMapDial methods. Would it be suitable to extract rpc call to grpc client for inverting the dependency? Also I'm concerned about backward compatibility in case of modification prmDial structure (some of field were extracted in the embedding in the last commit). Maybe it would be convenient to have constructors for such types?
fyrchik closed this pull request 2024-08-26 06:33:52 +00:00
All checks were successful
DCO / DCO (pull_request) Successful in 1m2s
Tests and linters / Tests (1.20) (pull_request) Successful in 1m25s
Tests and linters / Lint (pull_request) Successful in 3m0s
Tests and linters / Tests (1.21) (pull_request) Successful in 1m1s

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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: TrueCloudLab/frostfs-sdk-go#196
No description provided.