-
Notifications
You must be signed in to change notification settings - Fork 42
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
Add a plugin mechanism to resource_retriever #103
base: rolling
Are you sure you want to change the base?
Conversation
Signed-off-by: Michael Carroll <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense to me, it's the best way to avoid resource retriever from being dependent on large things like ROS, while also keeping it somewhat easy to integrate into other non-ROS projects for relatively simple things like file:///
and package:///
urls.
resource_retriever/include/resource_retriever/plugins/curl_retriever.hpp
Outdated
Show resolved
Hide resolved
resource_retriever/include/resource_retriever/plugins/curl_retriever.hpp
Outdated
Show resolved
Hide resolved
resource_retriever/include/resource_retriever/plugins/filesystem_retriever.hpp
Outdated
Show resolved
Hide resolved
resource_retriever/include/resource_retriever/plugins/filesystem_retriever.hpp
Outdated
Show resolved
Hide resolved
resource_retriever/include/resource_retriever/plugins/curl_retriever.hpp
Show resolved
Hide resolved
resource_retriever/include/resource_retriever/memory_resource.hpp
Outdated
Show resolved
Hide resolved
Signed-off-by: Michael Carroll <[email protected]>
Signed-off-by: Voldivh <[email protected]>
Signed-off-by: Michael Carroll <[email protected]>
{ | ||
CURLcode ret = curl_global_init(CURL_GLOBAL_ALL); | ||
if (ret != 0) { | ||
std::cerr << "Error initializing libcurl! retcode = " << ret; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we throw an exception here? That way we wouldn't need the initialized_
variable at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the issue is that this is used a static global, so it's not possible to catch the exception.
However, I agree this isn't great.
I considered at least saying it should go through some injectable logging (so we could pipe it to ROS logging for example), but that's hard too since this is a global.
I think maybe it shouldn't print anything and instead it should just set the flag and the first place to try and use it should throw an exception since it's not initialized.
But I'll have to think about it more.
#include <array> | ||
#include <cstring> | ||
#include <iostream> | ||
#include <memory> | ||
#include <string> | ||
#include <utility> | ||
#include <vector> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#include <array> | |
#include <cstring> | |
#include <iostream> | |
#include <memory> | |
#include <string> | |
#include <utility> | |
#include <vector> | |
#include <cstring> | |
#include <iostream> | |
#include <memory> | |
#include <string> | |
#include <utility> | |
#include <vector> |
|
||
bool CurlRetriever::can_handle(const std::string & url) | ||
{ | ||
return url.find("package://") == 0 || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return url.find("package://") == 0 || | |
return url.find("package://") == 0 || |
#include <array> | ||
#include <cstring> | ||
#include <fstream> | ||
#include <memory> | ||
#include <string> | ||
#include <utility> | ||
#include <vector> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#include <array> | |
#include <cstring> | |
#include <fstream> | |
#include <memory> | |
#include <string> | |
#include <utility> | |
#include <vector> | |
#include <fstream> | |
#include <memory> | |
#include <string> | |
#include <vector> |
|
||
#include "resource_retriever/plugins/retriever_plugin.hpp" | ||
|
||
#include <cstring> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#include <cstring> | |
#include <cstring> | |
#include <string> |
#include <cstring> | ||
#include <memory> | ||
#include <string> | ||
#include <utility> | ||
#include <vector> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#include <cstring> | |
#include <memory> | |
#include <string> | |
#include <utility> | |
#include <vector> | |
#include <memory> | |
#include <string> | |
#include <utility> |
@@ -31,16 +31,26 @@ | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#include <memory> | |
#include <vector> |
(and alphabetize it with the above)
The idea behind this is to make
resource_retriever
pluggable. That is that downstream users of the library can choose the mechanisms that they want to back the calls to "get".This will allow for things like retrieving over ROS services or parameters.