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

chore: Filter in libwaku #3177

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

chore: Filter in libwaku #3177

wants to merge 6 commits into from

Conversation

Ivansete-status
Copy link
Collaborator

No description provided.

Copy link

github-actions bot commented Nov 19, 2024

You can find the image built from this PR at

quay.io/wakuorg/nwaku-pr:3177

Built from e7fcbdb5404bdb00ffc6c04c177ac2d4d71002f9

Copy link
Contributor

@darshankabariya darshankabariya left a comment

Choose a reason for hiding this comment

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

LGTM !

Copy link
Contributor

@NagyZoltanPeter NagyZoltanPeter left a comment

Choose a reason for hiding this comment

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

I think we miss filter ping from the list of operation to support for the complete functionality. WDYT?

@@ -331,10 +331,10 @@ proc setupProtocols(
except CatchableError:
return err("failed to mount waku lightpush protocol: " & getCurrentExceptionMsg())

mountLightPushClient(node)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is that?
I'm not satisfied with current client side mounting of lightpush and filter but to mount it all the time, maybe un-necessary. WDYT?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

GM @NagyZoltanPeter - by default we need to mount all the clients. We are also following that approach in store-clients.

@@ -352,11 +352,11 @@ proc setupProtocols(
except CatchableError:
return err("failed to mount waku filter protocol: " & getCurrentExceptionMsg())

await node.mountFilterClient()
Copy link
Contributor

Choose a reason for hiding this comment

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

Same with filter.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes indeed, good point!, and I agree that it may sound weird but it is handier from user PoV to always have the "client" components mounted so that is not needed an additional argument such as filter-client = true, or lightpush-client = true, or `store-client

Copy link
Contributor

Choose a reason for hiding this comment

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

Well, imho, something more robust configuration option maybe needed. Like --light-protocols (edge-protocols?)
then install filter/lightpush/store-clients. Also we can leave the option to specify the service node(s) for the client protocols - but non mandatory. I think it can be a good balance between ease of use and control over resources.

I just noticed that with this change REST API will not function as expected. filter and lightpush REST endpoints are initialized upon --filternode and --lightpushnode having value.
Then this needs to be added here to keep consistency.
WDYT @Ivansete-status ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@NagyZoltanPeter - yes it makes 100% sense to me to add that --light-protocols option. That's something we will need shortly. I think we can consider that in a separate PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok fine for me. I will approve this PR now!

int waku_filter_unsubscribe_all(void* ctx,
WakuCallBack callback,
void* userData);

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we need ping as well! Is it left out intentionally?
Without ping the client is forced to use subscribe all the time (in each 1-2 minutes) which is significantly higher load on service node than just check with ping.

Copy link
Collaborator Author

@Ivansete-status Ivansete-status Nov 21, 2024

Choose a reason for hiding this comment

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

Thanks for that and very good point!
IMO, I think it is better to perform the ping internally and avoid the libwaku user handling that. I will submit another commit soon.

EDITED: I think it is better to refactor the current code base and put the filter-ping logic in one place.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you mean, hide ping behind the scene? Let say ping every minute if any subscription is added and between unsubscribe_all?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Do you mean, hide ping behind the scene? Let say ping every minute if any subscription is added and between unsubscribe_all?

Yes exactly, wdyt? Maybe we can suggest that in a separate PR

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree!

Copy link
Contributor

@gabrielmer gabrielmer left a comment

Choose a reason for hiding this comment

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

Looks amazing! Thanks so much! 😍

Copy link
Contributor

@NagyZoltanPeter NagyZoltanPeter left a comment

Choose a reason for hiding this comment

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

LGTM!!! We discussed all the outstanding points!!! Thank you.

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

Successfully merging this pull request may close these issues.

4 participants