-
Notifications
You must be signed in to change notification settings - Fork 42
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
feat(store): allow using a specific node #2192
base: master
Are you sure you want to change the base?
Conversation
size-limit report 📦
|
@@ -11,6 +13,7 @@ import { | |||
IPeersByDiscoveryEvents, | |||
IRelay, | |||
KeepAliveOptions, | |||
MultiaddrStr, |
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.
there should be a type for it in multiaddr
package
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.
@danisharora099, were you able to find a type in the lib or we need to intro a new one?
@@ -28,6 +28,10 @@ export type IBaseProtocolSDK = { | |||
readonly numPeersToUse: number; | |||
}; | |||
|
|||
type StoreProtocolOptions = { | |||
peer: string; |
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.
Let's make it peers
in the following PR
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.
We only use one peer for Store, unlike LightPush and Filter. When use getPeers()
within Store, we still only use the 0th index from the array of peers returned.
peers: string[]
would be applicable to LightPush and Filter
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.
@danisharora099 , let's make it a follow up feature to not overcomplicate this PR.
packages/sdk/src/waku/waku.ts
Outdated
}); | ||
} | ||
|
||
const store = wakuStore(this.connectionManager, peerIdStr); |
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 is wrong, peerIdStr
does nothing here
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.
It is used to initialise Store with the protocol to use since we need to get the peer when we send a store request. Changed the peerIdStrToUse
to options: Partial<StoreProtocolOptions>
let peerIdStr: PeerIdStr | undefined; | ||
if (options.store?.peer) { | ||
this.connectionManager | ||
.dialPeer(options.store.peer, [StoreCodec]) |
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.
let's not introduce this function and use
js-waku/packages/sdk/src/waku/waku.ts
Line 143 in 88e33a9
public async dial( |
which does the same as I see
Problem
Users need the ability to specify the peers used for their apps, for different protocols. Specifically for Store: https://discord.com/channels/1110799176264056863/1290694275683582085/1291644836742565929
Solution
Provides the ability to pass a specific node multiaddr while node creation to be used for Store. Falls back to random nodes if not passed.
Notes
Contribution checklist:
!
in title if breaks public API;