diff options
author | Vladimír Čunát <vladimir.cunat@nic.cz> | 2024-05-14 11:03:59 +0200 |
---|---|---|
committer | Aleš Mrázek <ales.mrazek@nic.cz> | 2024-07-02 14:07:48 +0200 |
commit | dfa29bfe8b6e11868c3ad5d2a4d9ecaf210f2be7 (patch) | |
tree | d0ea0ba2168c161eb24a8129eb2c8e2eb95b8fdf /lib/rules/api.h | |
parent | doc/dev: architecture update and improvements (diff) | |
download | knot-resolver-dfa29bfe8b6e11868c3ad5d2a4d9ecaf210f2be7.tar.xz knot-resolver-dfa29bfe8b6e11868c3ad5d2a4d9ecaf210f2be7.zip |
lib/rules: tweak how the read-only transactions work
Let's avoid reloading the RO transaction unless necessary.
For example, when normal config reload happens (one kresd at a time),
we most likely do *not* want to reload the rule DB prematurely.
Diffstat (limited to 'lib/rules/api.h')
-rw-r--r-- | lib/rules/api.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/rules/api.h b/lib/rules/api.h index f7f3b466..f1737a19 100644 --- a/lib/rules/api.h +++ b/lib/rules/api.h @@ -38,10 +38,22 @@ void kr_rules_deinit(void); * Normally commit happens only on successfully loading a config file. * However, an advanced user may get in trouble e.g. if calling resolve() from there, * causing even an assertion failure. In that case they might want to commit explicitly. + * + * If only read-only transaction is open, this will NOT reset it to the newest data. */ KR_EXPORT int kr_rules_commit(bool accept); +/** Reset to the latest version of rules committed in the DB. + * + * Note that this is not always a good idea. For example, the `forward` rules + * now use data from both the DB and lua config, so reloading only the DB + * may lead to weird behavior in some cases. + * (Modifications will also do this, as you can only modify the latest DB.) + */ +KR_EXPORT +int kr_rules_reset(void); + /** Try answering the query from local data; WIP: otherwise determine data source overrides. * * \return kr_error() on errors, >0 if answered, 0 otherwise (also when forwarding) |