1 parent
8583a479dd
commit
3851aeb703
42 files changed
+6948
-759
No files matched your search
@@ -87,7 +87,8 @@ namespace Void::Plugin
|
||||
std::function<std::string(std::string_view plugin_name)>
|
||||
config_provider;
|
||||
// Host-specific contract checked after plugin activation and before
|
||||
// publication. A failed validation aborts load/reload transactionally.
|
||||
// publication. A failed validation aborts load/reload
|
||||
// transactionally.
|
||||
std::function<bool(IPlugin&, const PluginInfo&)> instance_validator;
|
||||
};
|
||||
|
||||
@@ -140,6 +141,16 @@ namespace Void::Plugin
|
||||
/// it alive until they drop.
|
||||
std::expected<void, LoadError> reload(std::string_view name);
|
||||
|
||||
/// Replace `name` from an immutable new library path. The candidate
|
||||
/// must report the same plugin name. It is configured, receives the
|
||||
/// old state, activates and passes host validation before one
|
||||
/// atomic publication. On any error the current instance, source
|
||||
/// path and watcher remain unchanged. Pinned old handles remain
|
||||
/// valid.
|
||||
std::expected<void, LoadError>
|
||||
replace(std::string_view name,
|
||||
const std::filesystem::path& newPath);
|
||||
|
||||
/// Begin watching the plugin's file; reload automatically when
|
||||
/// it changes (debounced). Reload failures are logged and the
|
||||
/// old instance is kept.
|
||||
@@ -191,11 +202,13 @@ namespace Void::Plugin
|
||||
struct Entry {
|
||||
std::filesystem::path path;
|
||||
std::atomic<std::shared_ptr<detail::Instance>> current;
|
||||
bool watched{false};
|
||||
};
|
||||
|
||||
Entry* find(std::string_view name) const;
|
||||
std::expected<void, LoadError> reload_locked(Entry& entry,
|
||||
std::string_view name);
|
||||
std::expected<void, LoadError>
|
||||
reload_locked(Entry& entry, std::string_view name,
|
||||
const std::filesystem::path& sourcePath);
|
||||
std::vector<std::function<void(std::string_view)>>
|
||||
reload_callbacks_locked() const;
|
||||
|
||||
|
||||
Reference in new issue
Block a user