From 8a277485ba4369ca704cca17ec4a8a7dce3ae96e Mon Sep 17 00:00:00 2001 From: Aaron Fiore Date: Thu, 8 Jan 2026 14:23:53 -0800 Subject: [PATCH] container: root: plugin: common: add PluggableSpace entrypoint --- container/src/root/plugin/common/utility.hh | 72 ++++++++++++--------- 1 file changed, 42 insertions(+), 30 deletions(-) diff --git a/container/src/root/plugin/common/utility.hh b/container/src/root/plugin/common/utility.hh index c75035c..063cf2b 100644 --- a/container/src/root/plugin/common/utility.hh +++ b/container/src/root/plugin/common/utility.hh @@ -1,6 +1,6 @@ // docker-finance | modern accounting for the power-user // -// Copyright (C) 2021-2025 Aaron Fiore (Founder, Evergreen Crypto LLC) +// Copyright (C) 2021-2026 Aaron Fiore (Founder, Evergreen Crypto LLC) // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -75,9 +75,9 @@ class PluginPath final : public ::dfi::common::PluggablePath class PluginSpace final : public ::dfi::common::PluggableSpace { public: - explicit PluginSpace(const std::string& inner) + explicit PluginSpace(const std::string& inner, const std::string& entry) : ::dfi::common::PluggableSpace( - ::dfi::common::type::PluggableSpace({"plugin", inner})) + ::dfi::common::type::PluggableSpace({"plugin", inner, entry})) { } }; @@ -146,8 +146,9 @@ class Plugin final //! and pass `using bar = char; bar b;` to the plugin's loader (plugin-implementation defined). //! //! \warning -//! To utilize plugin auto-loader functionality, the plugin's parent directory *MUST* align with the plugin's namespace;\n -//! e.g., "repo/example/example.cc" requires the plugin's auto-loader to exist in the namespace `dfi::plugin::example`.\n +//! To utilize plugin auto-(un)loader functionality, the plugin's parent directory *MUST* align with the plugin's namespace\n +//! and the plugin's entrypoint class *MUST* align with the plugin's filename; e.g., "repo/example/example.cc" requires that\n +//! the auto-(un)loader exist within the entrypoint class name `example_cc` within the namespace `dfi::plugin::example`.\n\n //! To avoid this requisite, though ill-advised, use a `dfi::common` file loader instead. //! //! \ingroup cpp_plugin @@ -156,7 +157,7 @@ void load(const common::PluginPath& path, const common::PluginArgs& args) { ::dfi::common::type:: Pluggable - type{path, common::PluginSpace{path.parent()}, args}; + type{path, common::PluginSpace{path.parent(), path.child()}, args}; common::Plugin plugin{type}; plugin.load(); @@ -185,8 +186,9 @@ void load(const common::PluginPath& path, const common::PluginArgs& args) //!   `using bar = char; bar b;` for `${DOCKER_FINANCE_CLIENT_PLUGINS}/root/example/example.cc` //! //! \warning -//! To utilize plugin auto-loader functionality, the plugin's parent directory *MUST* align with the plugin's namespace;\n -//! e.g., "repo/example/example.cc" requires the plugin's auto-loader to exist in the namespace `dfi::plugin::example`.\n +//! To utilize plugin auto-(un)loader functionality, the plugin's parent directory *MUST* align with the plugin's namespace\n +//! and the plugin's entrypoint class *MUST* align with the plugin's filename; e.g., "repo/example/example.cc" requires that\n +//! the auto-(un)loader exist within the entrypoint class name `example_cc` within the namespace `dfi::plugin::example`.\n\n //! To avoid this requisite, though ill-advised, use a `dfi::common` file loader instead. //! //! \ingroup cpp_plugin @@ -231,8 +233,9 @@ void load( //! and pass `using bar = char; bar b;` to the plugin's loader (plugin-implementation defined). //! //! \warning -//! To utilize plugin auto-loader functionality, the plugin's parent directory *MUST* align with the plugin's namespace;\n -//! e.g., "repo/example/example.cc" requires the plugin's auto-loader to exist in the namespace `dfi::plugin::example`.\n +//! To utilize plugin auto-(un)loader functionality, the plugin's parent directory *MUST* align with the plugin's namespace\n +//! and the plugin's entrypoint class *MUST* align with the plugin's filename; e.g., "repo/example/example.cc" requires that\n +//! the auto-(un)loader exist within the entrypoint class name `example_cc` within the namespace `dfi::plugin::example`.\n\n //! To avoid this requisite, though ill-advised, use a `dfi::common` file loader instead. //! //! \ingroup cpp_plugin @@ -260,8 +263,9 @@ void load(const std::string& path, const std::string& arg = {}) //!   ${DOCKER_FINANCE_CLIENT_PLUGINS}/root/example/example.cc //! //! \warning -//! To utilize plugin auto-loader functionality, the plugin's parent directory *MUST* align with the plugin's namespace;\n -//! e.g., "repo/example/example.cc" requires the plugin's auto-loader to exist in the namespace `dfi::plugin::example`.\n +//! To utilize plugin auto-(un)loader functionality, the plugin's parent directory *MUST* align with the plugin's namespace\n +//! and the plugin's entrypoint class *MUST* align with the plugin's filename; e.g., "repo/example/example.cc" requires that\n +//! the auto-(un)loader exist within the entrypoint class name `example_cc` within the namespace `dfi::plugin::example`.\n\n //! To avoid this requisite, though ill-advised, use a `dfi::common` file loader instead. //! //! \ingroup cpp_plugin @@ -307,8 +311,9 @@ void load(const std::initializer_list& paths) //! and pass `using bar = char; bar b;` to the plugin's unloader (plugin-implementation defined). //! //! \warning -//! To utilize plugin auto-unloader functionality, the plugin's parent directory *MUST* align with the plugin's namespace;\n -//! e.g., "repo/example/example.cc" requires the plugin's auto-unloader to exist in the namespace `dfi::plugin::example`.\n +//! To utilize plugin auto-(un)loader functionality, the plugin's parent directory *MUST* align with the plugin's namespace\n +//! and the plugin's entrypoint class *MUST* align with the plugin's filename; e.g., "repo/example/example.cc" requires that\n +//! the auto-(un)loader exist within the entrypoint class name `example_cc` within the namespace `dfi::plugin::example`.\n\n //! To avoid this requisite, though ill-advised, use a `dfi::common` file loader instead. //! //! \ingroup cpp_plugin @@ -317,7 +322,7 @@ void unload(const common::PluginPath& path, const common::PluginArgs& args) { ::dfi::common::type:: Pluggable - type{path, common::PluginSpace{path.parent()}, args}; + type{path, common::PluginSpace{path.parent(), path.child()}, args}; common::Plugin plugin{type}; plugin.unload(); @@ -346,8 +351,9 @@ void unload(const common::PluginPath& path, const common::PluginArgs& args) //!   `using bar = char; bar b;` for `${DOCKER_FINANCE_CLIENT_PLUGINS}/root/example/example.cc` //! //! \warning -//! To utilize plugin auto-unloader functionality, the plugin's parent directory *MUST* align with the plugin's namespace;\n -//! e.g., "repo/example/example.cc" requires the plugin's auto-unloader to exist in the namespace `dfi::plugin::example`.\n +//! To utilize plugin auto-(un)loader functionality, the plugin's parent directory *MUST* align with the plugin's namespace\n +//! and the plugin's entrypoint class *MUST* align with the plugin's filename; e.g., "repo/example/example.cc" requires that\n +//! the auto-(un)loader exist within the entrypoint class name `example_cc` within the namespace `dfi::plugin::example`.\n\n //! To avoid this requisite, though ill-advised, use a `dfi::common` file loader instead. //! //! \ingroup cpp_plugin @@ -392,8 +398,9 @@ void unload( //! and pass `using bar = char; bar b;` to the plugin's unloader (plugin-implementation defined). //! //! \warning -//! To utilize plugin auto-unloader functionality, the plugin's parent directory *MUST* align with the plugin's namespace;\n -//! e.g., "repo/example/example.cc" requires the plugin's auto-unloader to exist in the namespace `dfi::plugin::example`.\n +//! To utilize plugin auto-(un)loader functionality, the plugin's parent directory *MUST* align with the plugin's namespace\n +//! and the plugin's entrypoint class *MUST* align with the plugin's filename; e.g., "repo/example/example.cc" requires that\n +//! the auto-(un)loader exist within the entrypoint class name `example_cc` within the namespace `dfi::plugin::example`.\n\n //! To avoid this requisite, though ill-advised, use a `dfi::common` file loader instead. //! //! \ingroup cpp_plugin @@ -421,8 +428,9 @@ void unload(const std::string& path, const std::string& arg = {}) //!   ${DOCKER_FINANCE_CLIENT_PLUGINS}/root/example/example.cc //! //! \warning -//! To utilize plugin auto-unloader functionality, the plugin's parent directory *MUST* align with the plugin's namespace;\n -//! e.g., "repo/example/example.cc" requires the plugin's auto-unloader to exist in the namespace `dfi::plugin::example`.\n +//! To utilize plugin auto-(un)loader functionality, the plugin's parent directory *MUST* align with the plugin's namespace\n +//! and the plugin's entrypoint class *MUST* align with the plugin's filename; e.g., "repo/example/example.cc" requires that\n +//! the auto-(un)loader exist within the entrypoint class name `example_cc` within the namespace `dfi::plugin::example`.\n\n //! To avoid this requisite, though ill-advised, use a `dfi::common` file loader instead. //! //! \ingroup cpp_plugin @@ -458,8 +466,9 @@ void unload(const std::initializer_list& paths) //! and pass `using foo = int; foo f;` to the plugin's loader (plugin-implementation defined) //! //! \warning -//! To utilize plugin auto-(un)loader functionality, the plugin's parent directory *MUST* align with the plugin's namespace;\n -//! e.g., "repo/example/example.cc" requires the plugin's auto-(un)loader to exist in the namespace `dfi::plugin::example`.\n +//! To utilize plugin auto-(un)loader functionality, the plugin's parent directory *MUST* align with the plugin's namespace\n +//! and the plugin's entrypoint class *MUST* align with the plugin's filename; e.g., "repo/example/example.cc" requires that\n +//! the auto-(un)loader exist within the entrypoint class name `example_cc` within the namespace `dfi::plugin::example`.\n\n //! To avoid this requisite, though ill-advised, use a `dfi::common` file loader instead. //! //! \ingroup cpp_plugin @@ -468,7 +477,7 @@ void reload(const common::PluginPath& path, const common::PluginArgs& args) { ::dfi::common::type:: Pluggable - type{path, common::PluginSpace{path.parent()}, args}; + type{path, common::PluginSpace{path.parent(), path.child()}, args}; common::Plugin plugin{type}; plugin.reload(); @@ -496,8 +505,9 @@ void reload(const common::PluginPath& path, const common::PluginArgs& args) //!   `using bar = char; bar b;` for `${DOCKER_FINANCE_CLIENT_PLUGINS}/root/example/example.cc` //! //! \warning -//! To utilize plugin auto-(un)loader functionality, the plugin's parent directory *MUST* align with the plugin's namespace;\n -//! e.g., "repo/example/example.cc" requires the plugin's auto-(un)loader to exist in the namespace `dfi::plugin::example`.\n +//! To utilize plugin auto-(un)loader functionality, the plugin's parent directory *MUST* align with the plugin's namespace\n +//! and the plugin's entrypoint class *MUST* align with the plugin's filename; e.g., "repo/example/example.cc" requires that\n +//! the auto-(un)loader exist within the entrypoint class name `example_cc` within the namespace `dfi::plugin::example`.\n\n //! To avoid this requisite, though ill-advised, use a `dfi::common` file loader instead. //! //! \ingroup cpp_plugin @@ -542,8 +552,9 @@ void reload( //! and pass `using bar = char; bar b;` to the plugin's auto-unloader (plugin-implementation defined). //! //! \warning -//! To utilize plugin auto-(un)loader functionality, the plugin's parent directory *MUST* align with the plugin's namespace;\n -//! e.g., "repo/example/example.cc" requires the plugin's auto-(un)loader to exist in the namespace `dfi::plugin::example`.\n +//! To utilize plugin auto-(un)loader functionality, the plugin's parent directory *MUST* align with the plugin's namespace\n +//! and the plugin's entrypoint class *MUST* align with the plugin's filename; e.g., "repo/example/example.cc" requires that\n +//! the auto-(un)loader exist within the entrypoint class name `example_cc` within the namespace `dfi::plugin::example`.\n\n //! To avoid this requisite, though ill-advised, use a `dfi::common` file loader instead. //! //! \ingroup cpp_plugin @@ -573,8 +584,9 @@ void reload( //!   ${DOCKER_FINANCE_CLIENT_PLUGINS}/root/example/example.cc //! //! \warning -//! To utilize plugin auto-(un)loader functionality, the plugin's parent directory *MUST* align with the plugin's namespace;\n -//! e.g., "repo/example/example.cc" requires the plugin's auto-(un)loader to exist in the namespace `dfi::plugin::example`.\n +//! To utilize plugin auto-(un)loader functionality, the plugin's parent directory *MUST* align with the plugin's namespace\n +//! and the plugin's entrypoint class *MUST* align with the plugin's filename; e.g., "repo/example/example.cc" requires that\n +//! the auto-(un)loader exist within the entrypoint class name `example_cc` within the namespace `dfi::plugin::example`.\n\n //! To avoid this requisite, though ill-advised, use a `dfi::common` file loader instead. //! //! \ingroup cpp_plugin