After the discussions we had on Monday, I dealt a little more with the usage of the discover method and I realized that we are actually in quite a good shape there already if we simply keep the method generic and let the underlying implementation handle the details of how the discovery is supposed to be performed.
However, in order to make it a bit clearer, how the discover method relates to the concepts of introduction and exploration from the discovery specification, this PR adds an explanatory paragraph after the main discover algorithm. With that in place, we could simply let implementors add ways to configure their respective platform (e.g., the Servient class in the case of node-wot) to use the right mechanism for the job.
Besides that, this PR also makes some minor changes to the ThingDiscoveryProcess interface, as it is supposed to have a url field which is, however, only used by the exploreDirectory method. Maybe we could consider defining more specialized interfaces for the two methods at some point.
Lastly, this PR also made me wonder whether we should use a TD instead of a URL as the parameter type of the exploreDirectory method, as otherwise it slightly more difficult to pipe in the (filtered) results from the discover method if a user should want to do that. We could of course also consider that the discover method handles directory exploration, but that might give away too much control from the user. The approach that gives the most amount of control would probably be letting the discover method return URLs, but especially in the context of the discussion we had in #535, this might not be desirable here.
Looking forward to your thoughts and the review of this PR :)
After the discussions we had on Monday, I dealt a little more with the usage of the
discover
method and I realized that we are actually in quite a good shape there already if we simply keep the method generic and let the underlying implementation handle the details of how the discovery is supposed to be performed.However, in order to make it a bit clearer, how the
discover
method relates to the concepts of introduction and exploration from the discovery specification, this PR adds an explanatory paragraph after the main discover algorithm. With that in place, we could simply let implementors add ways to configure their respective platform (e.g., theServient
class in the case ofnode-wot
) to use the right mechanism for the job.Besides that, this PR also makes some minor changes to the
ThingDiscoveryProcess
interface, as it is supposed to have aurl
field which is, however, only used by theexploreDirectory
method. Maybe we could consider defining more specialized interfaces for the two methods at some point.Lastly, this PR also made me wonder whether we should use a TD instead of a URL as the parameter type of the
exploreDirectory
method, as otherwise it slightly more difficult to pipe in the (filtered) results from thediscover
method if a user should want to do that. We could of course also consider that thediscover
method handles directory exploration, but that might give away too much control from the user. The approach that gives the most amount of control would probably be letting thediscover
method return URLs, but especially in the context of the discussion we had in #535, this might not be desirable here.Looking forward to your thoughts and the review of this PR :)
Preview | Diff