Move options to redis backend options instead of module-level options

This commit is contained in:
Tim Wojtulewicz 2025-05-06 11:53:35 -07:00
parent 824b91216f
commit fd10dd015f
6 changed files with 24 additions and 18 deletions

View file

@ -10,17 +10,6 @@ export {
type BackendOptions: record {
## The serializer used for converting Zeek data.
serializer: Storage::Serializer &default=Storage::STORAGE_SERIALIZER_JSON;
## Timeout for connection attempts to the backend. Connection attempts
## that exceed this time should return
## :zeek:see:`Storage::CONNECTION_FAILED`. Not all backends will support
## setting timeouts.
connect_timeout: interval &default=5 sec;
## Timeout for operation requests sent to the backend. Operations that
## exceed this time should return :zeek:see:`Storage::TIMEOUT`. Not all
## backends will support setting timeouts.
operation_timeout: interval &default=5 sec;
};
## Record for passing arguments to :zeek:see:`Storage::Async::put` and

View file

@ -5,6 +5,14 @@
module Storage::Backend::Redis;
export {
## Default value for connection attempt timeouts. This can be overridden
## per-connection with the ``connect_timeout`` backend option.
const default_connect_timeout: interval = 5 secs &redef;
## Default value for operation timeouts. This can be overridden per-connection
## with the ``operation_timeout`` backend option.
const default_operation_timeout: interval = 5 secs &redef;
## Options record for the built-in Redis backend.
type Options: record {
# Address or hostname of the server.
@ -22,6 +30,15 @@ export {
# same server. Defaults to an empty string, but preferably should be set
# to a unique value per Redis backend opened.
key_prefix: string &default="";
## Timeout for connection attempts to the backend. Connection attempts
## that exceed this time will return
## :zeek:see:`Storage::CONNECTION_FAILED`.
connect_timeout: interval &default=default_connect_timeout;
## Timeout for operation requests sent to the backend. Operations that
## exceed this time will return :zeek:see:`Storage::TIMEOUT`.
operation_timeout: interval &default=default_operation_timeout;
};
}