Skip to main content

Crate valkey_module_macros

Crate valkey_module_macros 

Source

Attribute Macros§

client_changed_event_handler
Proc macro which is set on a function that need to be called whenever a client connects or disconnects on the server. The function must accept a [Context] and [ClientChangeSubEvent].
command
This proc macro allow to specify that the follow function is a Valkey command. The macro accept the following arguments that discribe the command properties:
config_changed_event_handler
Proc macro which is set on a function that need to be called whenever a configuration change event is happening. The function must accept a [Context] and [&&str] that contains the names of the configiration values that was changed.
cron_event_handler
Proc macro which is set on a function that need to be called on Valkey cron. The function must accept a [Context] and u64 that represent the cron hz.
event_loop_event_handler
Proc macro which is set on a function that need to be called for every event loop iteration before the server sleeps or after it wakes up. The function must accept a [Context] and [EventLoopSubevent].
flush_event_handler
Proc macro which is set on a function that need to be called whenever a flush event happened. The function must accept a [Context] and [FlushSubevent].
fork_child_event_handler
Proc macro which is set on a function that need to be called whenever a fork child event happened. The function must accept a [Context] and [ForkChildSubevent]. Example:
info_command_handler
A procedural macro which registers this function as the custom INFO command handler. There might be more than one handler, each adding new information to the context.
key_event_handler
Proc macro which is set on a function that need to be called whenever a key event happened. The function must accept a [Context] and [KeyEventSubevent]. Example:
loading_event_handler
Proc macro which is set on a function that need to be called whenever a loading event happened. The function must accept a [Context] and [LoadingSubevent].
loading_progress_event_handler
Proc macro which is set on a function that need to be called repeatedly while an RDB or AOF file is being loaded. The function must accept a [Context], [LoadingProgressSubevent], hz: i32 and progress: i32.
master_link_change_event_handler
Proc macro which is set on a function that need to be called whenever a master link change event happened. The function must accept a [Context] and [MasterLinkChangeSubevent]. Example:
module_changed_event_handler
Proc macro which is set on a function that need to be called whenever a module is loaded or unloaded on the server. The function must accept a [Context] and [ModuleChangeSubevent].
persistence_event_handler
Proc macro which is set on a function that need to be called whenever a persistence event happened. The function must accept a [Context] and [PersistenceSubevent]. Example:
repl_async_load_event_handler
Proc macro which is set on a function that need to be called whenever a repl-diskless-load config is set to swapdb and a replication with a primary of same data set history occurs. The function must accept a [Context] and [ReplAsyncLoadSubevent]. Example:
replica_change_event_handler
Proc macro which is set on a function that need to be called whenever a replica change event happened. The function must accept a [Context] and [ReplicaChangeSubevent]. Example:
role_changed_event_handler
Proc macro which is set on a function that need to be called whenever the server role changes. The function must accept a [Context] and [ServerRole].
shutdown_event_handler
Proc macro which is set on a function that need to be called whenever a shutdown event happens. The function must accept a [Context] and u64.
swapdb_event_handler
Proc macro which is set on a function that need to be called whenever a swapdb event happens. The function must accept a [Context] and u64.

Derive Macros§

InfoSection
Implements a corresponding From for this struct, to convert objects of this struct to an information object to be sent to the [valkey_module::InfoContext] as a reply.
ValkeyValue
The macro auto generate a From implementation that can convert the struct into ValkeyValue.