-
Notifications
You must be signed in to change notification settings - Fork 249
provider: network operations #1115
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
base: provider-queues
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please simplify code by using package github.com/ipfs/go-test/random
After that, ok to merge
func genRandPeerID(t *testing.T) peer.ID { | ||
_, pub, err := crypto.GenerateKeyPair(crypto.Ed25519, -1) | ||
require.NoError(t, err) | ||
pid, err := peer.IDFromPublicKey(pub) | ||
require.NoError(t, err) | ||
return pid | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be replaced by random.Peers
peers := make([]peer.ID, nPeers) | ||
peersTrie := trie.New[bit256.Key, peer.ID]() | ||
for i := range peers { | ||
peers[i] = genRandPeerID(t) | ||
peersTrie.Add(keyspace.PeerIDToBit256(peers[i]), peers[i]) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
peers := make([]peer.ID, nPeers) | |
peersTrie := trie.New[bit256.Key, peer.ID]() | |
for i := range peers { | |
peers[i] = genRandPeerID(t) | |
peersTrie.Add(keyspace.PeerIDToBit256(peers[i]), peers[i]) | |
} | |
peers := random.Peers(nPeers) | |
peersTrie := trie.New[bit256.Key, peer.ID]() | |
for _, peer := range peers { | |
peersTrie.Add(keyspace.PeerIDToBit256(peer), peer) | |
} |
type SweepingProvider struct { | ||
// TODO: implement me | ||
// TODO: complete me |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe comment out the unused members so that linter does not complain.
Part of #1095
Depends on #1114
Network operations performed by the provider.
provider
after provider: adding provide and reprovide queue #1114 is merged