mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Make backend options a record, move actual options to be sub-records
This commit is contained in:
parent
64f3969434
commit
a485b1d237
23 changed files with 71 additions and 73 deletions
|
@ -24,7 +24,7 @@ export {
|
|||
##
|
||||
## Returns: A handle to the new backend connection, or ``F`` if the connection
|
||||
## failed.
|
||||
global open_backend: function(btype: Storage::Backend, options: any, key_type: any,
|
||||
global open_backend: function(btype: Storage::Backend, options: Storage::BackendOptions, key_type: any,
|
||||
val_type: any): opaque of Storage::BackendHandle;
|
||||
|
||||
## Closes an existing backend connection asynchronously.
|
||||
|
@ -74,7 +74,8 @@ export {
|
|||
global erase: function(backend: opaque of Storage::BackendHandle, key: any): bool;
|
||||
}
|
||||
|
||||
function open_backend(btype: Storage::Backend, options: any, key_type: any, val_type: any): opaque of Storage::BackendHandle
|
||||
function open_backend(btype: Storage::Backend, options: Storage::BackendOptions, key_type: any,
|
||||
val_type: any): opaque of Storage::BackendHandle
|
||||
{
|
||||
return Storage::Async::__open_backend(btype, options, key_type, val_type);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,12 @@
|
|||
module Storage;
|
||||
|
||||
export {
|
||||
## Record for passing arguments to :zeek:see:`Storage::put`.
|
||||
## Base record for backend options. Backend plugins can redef this record to add
|
||||
## relevant fields to it.
|
||||
type BackendOptions: record {};
|
||||
|
||||
## Record for passing arguments to :zeek:see:`Storage::Async::put` and
|
||||
## :zeek:see:`Storage::Sync::put`.
|
||||
type PutArgs: record {
|
||||
# The key to store the value under.
|
||||
key: any;
|
||||
|
|
|
@ -22,7 +22,7 @@ export {
|
|||
##
|
||||
## Returns: A handle to the new backend connection, or ``F`` if the connection
|
||||
## failed.
|
||||
global open_backend: function(btype: Storage::Backend, options: any, key_type: any,
|
||||
global open_backend: function(btype: Storage::Backend, options: Storage::BackendOptions, key_type: any,
|
||||
val_type: any): opaque of Storage::BackendHandle;
|
||||
|
||||
## Closes an existing backend connection.
|
||||
|
@ -72,7 +72,8 @@ export {
|
|||
global erase: function(backend: opaque of Storage::BackendHandle, key: any): bool;
|
||||
}
|
||||
|
||||
function open_backend(btype: Storage::Backend, options: any, key_type: any, val_type: any): opaque of Storage::BackendHandle
|
||||
function open_backend(btype: Storage::Backend, options: Storage::BackendOptions, key_type: any,
|
||||
val_type: any): opaque of Storage::BackendHandle
|
||||
{
|
||||
return Storage::Sync::__open_backend(btype, options, key_type, val_type);
|
||||
}
|
||||
|
|
|
@ -34,4 +34,8 @@ export {
|
|||
# traffic.
|
||||
async_mode: bool &default=T;
|
||||
};
|
||||
|
||||
redef record Storage::BackendOptions += {
|
||||
redis: Options &optional;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -28,4 +28,8 @@ export {
|
|||
["temp_store"] = "memory"
|
||||
);
|
||||
};
|
||||
|
||||
redef record Storage::BackendOptions += {
|
||||
sqlite: Options &optional;
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue