Files
Library/tests/plugins/Configurable.hpp
T
faumarayandClaude Fable 5 ee4486e1d2 Plugin: discovery, unload, config entry, multi-observer reloads, state API
Host-side additions for applications embedding a plugin system:

- PluginManager::load_directory(dir) loads every shared-library file in
  a directory (filename order) with per-file expected results.
- PluginManager::unload(name) drops the registry entry; the instance
  dies with its last pinned handle (RCU semantics, as on reload).
- Optional C entry void_plugin_configure(inst, config): fed from
  PluginManagerOptions::config_provider after create and after each
  reload swap, before on_load().
- on_reloaded() is now multi-observer: returns a ReloadCallbackId,
  remove_on_reloaded() unregisters. Manual reload() now notifies
  observers too (previously only watched reloads did, contradicting
  the documented contract). PluginServiceBinding deregisters its
  callback on destruction (was a dangling-callback hazard).
- PluginManager::serialize_state/deserialize_state expose the plugin's
  v2 state exports so an embedder can carry plugin state through its
  own hot reload.
- ServiceRegistry::remove<I>() withdraws a provided service (child
  removal re-exposes a parent's entry).
- EventBus::subscribe_scoped<E>() returns a move-only RAII
  Subscription that unsubscribes on destruction.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_018yj92cCihyaYtf4gKCT3nv
2026-07-11 23:39:10 +03:00

26 lines
647 B
C++

#pragma once
#include <Void/Plugin/Plugin.hpp>
#include <string_view>
// Shared interface for the configure-entry-point test plugin. Same
// single-inheritance static_cast recovery pattern as Stateful.hpp.
namespace VoidTest
{
class IConfigurable : public Void::Plugin::IPlugin
{
public:
[[nodiscard]] virtual std::string_view last_config() const = 0;
[[nodiscard]] virtual int configure_calls() const = 0;
[[nodiscard]] virtual bool configured_before_on_load() const = 0;
};
[[nodiscard]] inline IConfigurable*
as_configurable(Void::Plugin::IPlugin* p)
{
return static_cast<IConfigurable*>(p);
}
} // namespace VoidTest