1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

add support for plugin sub-registries

This commit is contained in:
Steffen Vogel 2022-02-25 09:55:43 -05:00
parent b2e433625e
commit b402048082
11 changed files with 20 additions and 20 deletions

2
common

@ -1 +1 @@
Subproject commit 444d48d5bd1e3c45c521a80e377b68c4b7614b42
Subproject commit fc69b4c4e8377e36ae536d6697276a1a2b528a4e

2
fpga

@ -1 +1 @@
Subproject commit 47a7c0f30ffb6e21422e3a45fd81d86a33716e9f
Subproject commit 1202b4edb1d47c77d06488ffd741e88dac4fab1f

View file

@ -44,7 +44,7 @@ Request * RequestFactory::create(Session *s, const std::string &uri, Session::Me
{
s->logger->info("Lookup request handler for: uri={}", uri);
for (auto *rf : plugin::Registry::lookup<RequestFactory>()) {
for (auto *rf : plugin::registry->lookup<RequestFactory>()) {
std::smatch mr;
if (not rf->match(uri, mr))
continue;

View file

@ -46,7 +46,7 @@ public:
if (body != nullptr)
throw BadRequest("File endpoint does not accept any body data");
NodeFactory *nf = plugin::Registry::lookup<NodeFactory>("file");
NodeFactory *nf = plugin::registry->lookup<NodeFactory>("file");
if (node->getFactory() != nf)
throw BadRequest("This node is not a file node", "{ s: s }",

View file

@ -38,25 +38,25 @@ json_t * villas::node::getCapabilities()
json_t *json_formats = json_array();
json_t *json_name;
for (auto p : plugin::Registry::lookup<api::RequestFactory>()) {
for (auto p : plugin::registry->lookup<api::RequestFactory>()) {
json_name = json_string(p->getName().c_str());
json_array_append_new(json_apis, json_name);
}
for (auto p : plugin::Registry::lookup<HookFactory>()) {
for (auto p : plugin::registry->lookup<HookFactory>()) {
json_name = json_string(p->getName().c_str());
json_array_append_new(json_hooks, json_name);
}
for (auto p : plugin::Registry::lookup<FormatFactory>()) {
for (auto p : plugin::registry->lookup<FormatFactory>()) {
json_name = json_string(p->getName().c_str());
json_array_append_new(json_formats, json_name);
}
for (auto f : plugin::Registry::lookup<NodeFactory>()) {
for (auto f : plugin::registry->lookup<NodeFactory>()) {
if (f->isInternal())
continue;

View file

@ -64,7 +64,7 @@ Format * FormatFactory::make(json_t *json)
Format * FormatFactory::make(const std::string &format)
{
FormatFactory *ff = plugin::Registry::lookup<FormatFactory>(format);
FormatFactory *ff = plugin::registry->lookup<FormatFactory>(format);
if (!ff)
throw RuntimeError("Unknown format: {}", format);

View file

@ -61,7 +61,7 @@ void HookList::parse(json_t *json, int mask, Path *o, Node *n)
throw ConfigError(json_hook, "node-config-hook", "Hook must be configured by simple string or object");
}
auto hf = plugin::Registry::lookup<HookFactory>(type);
auto hf = plugin::registry->lookup<HookFactory>(type);
if (!hf)
throw ConfigError(json_hook, "node-config-hook", "Unknown hook type '{}'", type);
@ -87,7 +87,7 @@ void HookList::prepare(SignalList::Ptr signals, int m, Path *p, Node *n)
goto skip_add;
/* Add internal hooks if they are not already in the list */
for (auto f : plugin::Registry::lookup<HookFactory>()) {
for (auto f : plugin::registry->lookup<HookFactory>()) {
if ((f->getFlags() & m) == m) {
auto h = f->make(p, n);
push_back(h);

View file

@ -542,7 +542,7 @@ Node * NodeFactory::make(json_t *json, uuid_t uuid)
Node * NodeFactory::make(const std::string &type)
{
NodeFactory *nf = plugin::Registry::lookup<NodeFactory>(type);
NodeFactory *nf = plugin::registry->lookup<NodeFactory>(type);
if (!nf)
throw RuntimeError("Unknown node-type: {}", type);

View file

@ -62,7 +62,7 @@ int villas::node::fpga_type_start(SuperNode *sn)
pciDevices = std::make_shared<kernel::pci::DeviceList>();
// get the FPGA card plugin
auto pcieCardPlugin = plugin::Registry::lookup<fpga::PCIeCardFactory>("pcie");
auto pcieCardPlugin = plugin::registry->lookup<fpga::PCIeCardFactory>("pcie");
if (!pcieCardPlugin)
throw RuntimeError("No FPGA PCIe plugin found");

View file

@ -116,12 +116,12 @@ protected:
<< " -V show the version of the tool" << std::endl << std::endl;
std::cout << "Supported hooks:" << std::endl;
for (Plugin *p : Registry::lookup<HookFactory>())
for (Plugin *p : registry->lookup<HookFactory>())
std::cout << " - " << *p << ": " << p->getDescription() << std::endl;
std::cout << std::endl;
std::cout << "Supported IO formats:" << std::endl;
for (Plugin *p : Registry::lookup<FormatFactory>())
for (Plugin *p : registry->lookup<FormatFactory>())
std::cout << " - " << *p << ": " << p->getDescription() << std::endl;
std::cout << std::endl;
@ -248,7 +248,7 @@ check: if (optarg == endptr)
}
/* Initialize hook */
auto hf = plugin::Registry::lookup<HookFactory>(hook);
auto hf = plugin::registry->lookup<HookFactory>(hook);
if (!hf)
throw RuntimeError("Unknown hook function '{}'", hook);

View file

@ -106,27 +106,27 @@ protected:
#endif /* WITH_NODE_OPAL */
<< "Supported node-types:" << std::endl;
for (auto p : Registry::lookup<NodeFactory>()) {
for (auto p : registry->lookup<NodeFactory>()) {
if (!p->isInternal())
std::cout << " - " << std::left << std::setw(18) << p->getName() << p->getDescription() << std::endl;
}
std::cout << std::endl;
std::cout << "Supported IO formats:" << std::endl;
for (auto p : Registry::lookup<FormatFactory>())
for (auto p : registry->lookup<FormatFactory>())
std::cout << " - " << std::left << std::setw(18) << p->getName() << p->getDescription() << std::endl;
std::cout << std::endl;
#ifdef WITH_HOOKS
std::cout << "Supported hooks:" << std::endl;
for (auto p : Registry::lookup<HookFactory>())
for (auto p : registry->lookup<HookFactory>())
std::cout << " - " << std::left << std::setw(18) << p->getName() << p->getDescription() << std::endl;
std::cout << std::endl;
#endif /* WITH_HOOKS */
#ifdef WITH_API
std::cout << "Supported API commands:" << std::endl;
for (auto p : Registry::lookup<api::RequestFactory>())
for (auto p : registry->lookup<api::RequestFactory>())
std::cout << " - " << std::left << std::setw(18) << p->getName() << p->getDescription() << std::endl;
std::cout << std::endl;
#endif /* WITH_API */