Feature #3005
closed
Add callback for successful prefix registration
Added by Andrew Brown over 9 years ago.
Updated about 9 years ago.
Description
If my application registers a prefix on face A and immediately sends an interest to it on face B, the interest will fail because NFD is still processing the registration request. I currently have to wait some amount of time (at most the interest lifetime) before I am confident that the NFD has processed the request. If we add a callback such as in ndn-cxx (https://github.com/named-data/ndn-cxx/blob/master/src/face.hpp#L397), I will know immediately when I can send the interest.
The plan is to add an optional onRegisterSuccess callback after the required onRegisterFailed callback. onRegisterSuccess is optional for backward compatibility, and it is after onRegisterFailed for consistency across the common client libraries. (For example, in Python an optional parameters must come after required parameters.)
registerPrefix(prefix, onInterest, onRegisterFailed [, onRegisterSuccess] [, flags])
The register success callback in ndn-cxx just passes the prefix name. But there is also the registeredPrefixId. Is there utility (in the slightly more complicated code) to also pass the registeredPrefixId in the register success callback?
- Status changed from New to In Progress
- Assignee set to Anonymous
I think having the IDs would be useful for me, at least. For example, to clean up my registered prefixes I store the registered prefix IDs in a list; currently I take the output of registerPrefix()
, i.e. the ID, and add it to the list, but I would prefer to only add it to the list once the registration succeeds. If I don't have access to it in OnRegisterSuccess, it is hard (maybe impossible?) to populate the list from there (e.g. the output of registerPrefix()
can't be a part of OnRegisterSuccess closure). If it was available in the OnRegisterSuccess method then I would have no problems.
Tested it out and it works great. I wrote an integration test; would you like to add it?
Yes, an integration test sounds good.
- Status changed from In Progress to Closed
The changes are merged into branch issue/2565-async-IO. I needed to merged because we will make further changes to Node.java, etc. If you have an integration test for OnRegisterSuccess, you can add it to branch issue/2565-async-IO.
- Project changed from jndn to NDN-CCL
- Status changed from Closed to In Progress
- % Done changed from 0 to 30
The OnRegisterSuccess callback applies to all libraries, so I moved this to NDN-CCL. This is implemented in jNDN. Need to implement in NDN-CPP, PyNDN and NDN-JS.
- Has duplicate Bug #3130: RegisterPrefix doesn't provide a callback added
- Description updated (diff)
I updated the description to say that the optional onRegisterSuccess parameter comes after the required onRegisterFailed parameter.
- % Done changed from 30 to 50
- Status changed from In Progress to Closed
In NDN-CPP and NDN-JS, implemented the optional onRegisterSuccess callback in registerPrefix.
Updated the CCL API docs for onRegisterSuccess.
Also available in: Atom
PDF