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

Local Discovery Support with MDNS #53

Merged
merged 2 commits into from
Nov 9, 2023
Merged

Conversation

amydevs
Copy link
Member

@amydevs amydevs commented Nov 6, 2023

Description

As of polykey 1.2.1-alpha.20, js-mdns has been integrated for the sake of local discovery. Changes to nodes/CommandFind and related tests will need to be changed in order to support the scopes property on NodeAddress, and that some RPCCalls now return Array<NodeAddress> rather than NodeAddress.

Issues Fixed

None

Tasks

  • 1. Change nodes/CommandFind to output multiple addresses
  • 2. Amend related tests

Final checklist

  • Domain specific tests
  • Full tests
  • Updated inline-comment documentation
  • Lint fixed
  • Squash and rebased
  • Sanity check the final build

@amydevs amydevs changed the title Local Discovery Local Discovery Support with MDNS Nov 6, 2023
@ghost
Copy link

ghost commented Nov 6, 2023

👇 Click on the image for a new way to code review

Review these changes using an interactive CodeSee Map

Legend

CodeSee Map legend

@CMCDragonkai
Copy link
Member

Is this in relation to CI failure?

@CMCDragonkai
Copy link
Member

Does this need to be merged BEFORE or AFTER #50?

@amydevs amydevs force-pushed the feature-local-discovery branch 3 times, most recently from a03bf3b to 82c9b83 Compare November 8, 2023 14:32
@CMCDragonkai
Copy link
Member

@amydevs what's the status of this now that #50 was merged?

@CMCDragonkai CMCDragonkai mentioned this pull request Nov 8, 2023
@amydevs
Copy link
Member Author

amydevs commented Nov 8, 2023

Am in the process of completing this.

I had the impression that the original findNode function used the ctx to determine how long getClosestNodes would be executed for. I had implemented findNodeLocal this way assuming this was the case. But now the command for nodes find fails on rpc timeout instead of ErrorCommandFindNodeNotFound or something similar. So i have to shorten the time out for the findNodeLocal function, so that it's shorter than ctx. But im not sure what to set it to.

@CMCDragonkai
Copy link
Member

Regarding scopes, please read what I wrote here: MatrixAI/Polykey#537 (comment)

@CMCDragonkai
Copy link
Member

I'm not really sure findNode is properly implemented in consideration of all the changes and features we have. I'm going over the entire nodes domain over in MatrixAI/Polykey#618 - probably major changes coming into there to the nodes domain @tegefaulkes

@amydevs amydevs force-pushed the feature-local-discovery branch 2 times, most recently from 036a91d to 7ab28ed Compare November 9, 2023 02:29
@amydevs amydevs force-pushed the feature-local-discovery branch 2 times, most recently from d5723d4 to 2fbe04d Compare November 9, 2023 05:01
@amydevs
Copy link
Member Author

amydevs commented Nov 9, 2023

I'm not really sure findNode is properly implemented in consideration of all the changes and features we have. I'm going over the entire nodes domain over in MatrixAI/Polykey#618 - probably major changes coming into there to the nodes domain @tegefaulkes

i've went over how my findNodeLocal works and created a config option for specifically the timeout of finding a local node. This was done, as there is a similar config option for finding nodes via kademlllia based on the no. of hops. I cannot use the ctx of the handler, as that is the ctx of the RPC call. Tthe RPC call will timeout before my MDNS resolves the known addresses if I use that as my ctx.

MatrixAI/Polykey#537 (comment)

…des find`

fix: tests regarding new `js-mdns` integration

fix: removed unneccessary config option in `ping.test.ts`

[ci-skip]
@amydevs
Copy link
Member Author

amydevs commented Nov 9, 2023

all tests are passing on CI, everything seems to work as intended. Merge is on the way.

@amydevs amydevs merged commit ec3732f into staging Nov 9, 2023
@CMCDragonkai
Copy link
Member

You forgot to do the final checklist.

@CMCDragonkai
Copy link
Member

i've went over how my findNodeLocal works and created a config option for specifically the timeout of finding a local node. This was done, as there is a similar config option for finding nodes via kademlllia based on the no. of hops. I cannot use the ctx of the handler, as that is the ctx of the RPC call. Tthe RPC call will timeout before my MDNS resolves the known addresses if I use that as my ctx.

RPC call timeouts are relevant to the client. If the client times out before your MDNS finds the addresses, then either the client cares about the result, maybe you need to find it faster, or extend the timeout.

Or you should consider it a long-running call, where one get get results as a list over a long time, rather than a unary call. I would imagine it it's more of a server streaming call rather than a unary call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants