macro_rules! valkey_module {
(
name: $module_name:expr,
version: $module_version:expr,
/// Global allocator for the valkey module defined.
/// In most of the cases, the Valkey allocator ([crate::alloc::ValkeyAlloc])
/// should be used.
allocator: ($allocator_type:ty, $allocator_init:expr),
data_types: [
$($data_type:ident),* $(,)*
],
$(preload: $preload_func:ident,)* $(,)*
$(init: $init_func:ident,)* $(,)*
$(deinit: $deinit_func:ident,)* $(,)*
$(info: $info_func:ident,)?
$(auth: [
$($auth_callback:expr),* $(,)*
],)?
$(acl_categories: [
$($acl_category:expr),* $(,)*
])?
commands: [
$([
$name:expr,
$command:expr,
$flags:expr,
$firstkey:expr,
$lastkey:expr,
$keystep:expr
$(,
$command_acl_categories:expr
)?
]),* $(,)?
] $(,)*
$(
filters: [
$([
$filter_func:ident,
$filter_flags:expr
]),* $(,)?
] $(,)*
)?
$(event_handlers: [
$([
$(@$event_type:ident) +:
$event_handler:expr
]),* $(,)*
] $(,)* )?
$(configurations: [
$(i64:[$([
$i64_configuration_name:expr,
$i64_configuration_val:expr,
$i64_default:expr,
$i64_min:expr,
$i64_max:expr,
$i64_flags_options:expr,
$i64_on_changed:expr $(, $i64_on_set:expr)?
]),* $(,)*],)?
$(string:[$([
$string_configuration_name:expr,
$string_configuration_val:expr,
$string_default:expr,
$string_flags_options:expr,
$string_on_changed:expr $(, $string_on_set:expr)?
]),* $(,)*],)?
$(bool:[$([
$bool_configuration_name:expr,
$bool_configuration_val:expr,
$bool_default:expr,
$bool_flags_options:expr,
$bool_on_changed:expr $(, $bool_on_set:expr)?
]),* $(,)*],)?
$(enum:[$([
$enum_configuration_name:expr,
$enum_configuration_val:expr,
$enum_default:expr,
$enum_flags_options:expr,
$enum_on_changed:expr $(, $enum_on_set:expr)?
]),* $(,)*],)?
$(module_args_as_configuration:$use_module_args:expr,)?
$(module_config_get:$module_config_get_command:expr,)?
$(module_config_set:$module_config_set_command:expr,)?
])?
) => { ... };
}
Expand description
Defines a Valkey module.
It registers the defined module, sets it up and initialises properly, registers all the commands and types.