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

How to understand RPCProtocol.__getattr__ #11

Closed
jMyles opened this issue Aug 31, 2017 · 1 comment
Closed

How to understand RPCProtocol.__getattr__ #11

jMyles opened this issue Aug 31, 2017 · 1 comment

Comments

@jMyles
Copy link

jMyles commented Aug 31, 2017

Hey @bmuller. As you can probably already tell, I've been reading a fair bit of your work in the past few days. :-)

Right now I'm trying to understand (and maybe help you to write a docstring for) RPCProtocol.getattr.

If I understand correctly, it behaves normally for attrs which begin with "_" or "rpc_".

For others, it behaves normally if they exist but otherwise, instead of raising AttributeError, it returns a closure that will attempt to call the function on a remote node?

@bmuller
Copy link
Owner

bmuller commented Aug 31, 2017

If I understand correctly, it behaves normally for attrs which begin with "" or "rpc".

Exactly

For others, it behaves normally if they exist but otherwise, instead of raising AttributeError, it returns a closure that will attempt to call the function on a remote node?

Yep. The idea is you call protocol.doSomething(args) which then sends a message to a remote node, and on the remote node the method other_protocol.rpc_doSomething(args) is then called and the result is sent back (see here for where rpc_doSomething is looked up).

A PR for a docstring on getattr would be quickly accepted :)

And btw - for general questions like this - please feel free to email me directly at the addy on my github profile.

@bmuller bmuller closed this as completed Aug 31, 2017
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

No branches or pull requests

2 participants