void rspamd_symcache_inc_frequency (struct rspamd_symcache *cache,
struct rspamd_symcache_item *item);
-/**
- * Add dependency relation between two symbols identified by id (source) and
- * a symbolic name (destination). Destination could be virtual or real symbol.
- * Callback destinations are not yet supported.
- * @param id_from source symbol
- * @param to destination name
- */
-void rspamd_symcache_add_dependency (struct rspamd_symcache *cache,
- gint id_from, const gchar *to,
- gint virtual_id_from);
-
/**
* Add delayed dependency that is resolved on cache post-load routine
* @param cache
{
auto *real_item = C_API_SYMCACHE_ITEM(item);
real_item->inc_frequency();
+}
+
+void
+rspamd_symcache_add_delayed_dependency (struct rspamd_symcache *cache,
+ const gchar *from, const gchar *to)
+{
+ auto *real_cache = C_API_SYMCACHE(cache);
+ real_cache->add_delayed_dependency(from, to);
}
\ No newline at end of file
struct delayed_cache_dependency {
std::string from;
std::string to;
+
+ delayed_cache_dependency(std::string_view _from, std::string_view _to) : from(_from), to(_to) {}
};
struct delayed_cache_condition {
*/
auto add_dependency(int id_from, std::string_view to, int virtual_id_from) -> void;
+ /**
+ * Add a delayed dependency between symbols that will be resolved on the init stage
+ * @param from
+ * @param to
+ */
+ auto add_delayed_dependency(std::string_view from, std::string_view to) -> void {
+ if (!delayed_deps) {
+ delayed_deps = std::make_unique<std::vector<delayed_cache_dependency>>();
+ }
+
+ delayed_deps->emplace_back(from, to);
+ }
+
/**
* Initialises the symbols cache, must be called after all symbols are added
* and the config file is loaded
child_id = luaL_checknumber (L, 2);
parent = luaL_checkstring (L, 3);
- msg_warn_config ("calling for obsolete method to register deps for symbol %d->%s",
+ return luaL_error(L,"calling for obsolete method to register deps for symbol %d->%s",
child_id, parent);
-
- if (child_id > 0 && parent != NULL) {
-
- rspamd_symcache_add_dependency (cfg->cache, child_id, parent,
- -1);
- }
}
else {
child = luaL_checkstring (L,2);