valkey-io / valkeymodule-rs

Rust valkey SDK for modules
BSD 3-Clause "New" or "Revised" License
32 stars 10 forks source link

Provide Modules with the ability to reject CONFIG SETs on module configurations #123

Open KarthikSubbarao opened 3 weeks ago

KarthikSubbarao commented 3 weeks ago

Today, Modules using valkeymodule-rs can create configs using the valkeymodule macro.

Modules can provide a callback that gets triggered on configuration change (after CONFIG SET).

But we do not have a way for Modules to reject CONFIG SET operations on Module configurations.

In Core valkey, we can do this by having the SDK accept a config_set callback, just like we allow modules to provide a on_configuration_change call back. If the Module returns an Error, the config set operation should be rejected. Else, it can be applied.

Current Usage:

    configurations: [
.....
        string: [
            ["string", &*CONFIGURATION_STRING, "default", ConfigurationFlags::DEFAULT, Some(Box::new(on_configuration_changed::<String, _>))],
        ],
......