Project

General

Profile

Actions

Feature #3005

closed

Add callback for successful prefix registration

Added by Andrew Brown almost 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Start date:
07/02/2015
Due date:
% Done:

50%

Estimated time:

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])


Related issues 1 (0 open1 closed)

Has duplicate NDN-CCL - Bug #3130: RegisterPrefix doesn't provide a callbackClosed08/24/2015

Actions
Actions #1

Updated by Anonymous almost 9 years ago

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?

Actions #2

Updated by Anonymous almost 9 years ago

  • Status changed from New to In Progress
  • Assignee set to Anonymous

Hi Andrew. Please try branch issue/3005-OnRegisterSuccess (which is branched from issue/2565-async-IO).
https://github.com/named-data/jndn/blob/issue/3005-OnRegisterSuccess/src/net/named_data/jndn/Face.java#L520

Right now OnRegisterSuccess doesn't pass the registeredPrefixId, but I can easily add it before merging if we decide to.

Actions #3

Updated by Andrew Brown almost 9 years ago

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.

Actions #4

Updated by Anonymous almost 9 years ago

Actions #5

Updated by Andrew Brown almost 9 years ago

Tested it out and it works great. I wrote an integration test; would you like to add it?

Actions #6

Updated by Anonymous almost 9 years ago

Yes, an integration test sounds good.

Actions #7

Updated by Anonymous almost 9 years ago

  • 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.

Actions #8

Updated by Anonymous over 8 years ago

  • 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.

Actions #9

Updated by Anonymous over 8 years ago

  • Has duplicate Bug #3130: RegisterPrefix doesn't provide a callback added
Actions #10

Updated by Anonymous over 8 years ago

  • Description updated (diff)
Actions #11

Updated by Anonymous over 8 years ago

I updated the description to say that the optional onRegisterSuccess parameter comes after the required onRegisterFailed parameter.

Actions #12

Updated by Anonymous over 8 years ago

  • % Done changed from 30 to 50

In PyNDN, implemented the optional onRegisterSuccess callback in registerPrefix.
https://github.com/named-data/PyNDN2/blob/874fbfd29358f497b9e7d00b25417af11d62d8ba/python/pyndn/face.py#L256

Actions #13

Updated by Anonymous over 8 years ago

  • 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.

Actions

Also available in: Atom PDF