mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 06:38:20 +00:00
Update comments in script files, run zeek-format on all of them
This commit is contained in:
parent
d0741c8001
commit
f40947f6ac
5 changed files with 104 additions and 77 deletions
|
@ -1,6 +1,4 @@
|
|||
##! Asynchronous operation methods for the storage framework. These methods must
|
||||
##! be called as part of a :zeek:see:`when` statement. An error will be returned
|
||||
##! otherwise.
|
||||
##! Asynchronous operation methods for the storage framework.
|
||||
|
||||
@load ./main
|
||||
|
||||
|
@ -8,6 +6,8 @@ module Storage::Async;
|
|||
|
||||
export {
|
||||
## Opens a new backend connection based on a configuration object asynchronously.
|
||||
## This method must be called via a :zeek:see:`when` condition or an error will
|
||||
## be returned.
|
||||
##
|
||||
## btype: A tag indicating what type of backend should be opened. These are
|
||||
## defined by the backend plugins loaded.
|
||||
|
@ -25,18 +25,22 @@ export {
|
|||
## Returns: A record containing the status of the operation, and either an error
|
||||
## string on failure or a value on success. The value returned here will
|
||||
## be an ``opaque of BackendHandle``.
|
||||
global open_backend: function(btype: Storage::Backend, options: Storage::BackendOptions, key_type: any,
|
||||
val_type: any): Storage::OperationResult;
|
||||
global open_backend: function(btype: Storage::Backend,
|
||||
options: Storage::BackendOptions, key_type: any, val_type: any)
|
||||
: Storage::OperationResult;
|
||||
|
||||
## Closes an existing backend connection asynchronously.
|
||||
## Closes an existing backend connection asynchronously. This method must be
|
||||
## called via a :zeek:see:`when` condition or an error will be returned.
|
||||
##
|
||||
## backend: A handle to a backend connection.
|
||||
##
|
||||
## Returns: A record containing the status of the operation and an optional error
|
||||
## string for failures.
|
||||
global close_backend: function(backend: opaque of Storage::BackendHandle): Storage::OperationResult;
|
||||
global close_backend: function(backend: opaque of Storage::BackendHandle)
|
||||
: Storage::OperationResult;
|
||||
|
||||
## Inserts a new entry into a backend asynchronously.
|
||||
## Inserts a new entry into a backend asynchronously. This method must be called
|
||||
## via a :zeek:see:`when` condition or an error will be returned.
|
||||
##
|
||||
## backend: A handle to a backend connection.
|
||||
##
|
||||
|
@ -45,9 +49,11 @@ export {
|
|||
##
|
||||
## Returns: A record containing the status of the operation and an optional error
|
||||
## string for failures.
|
||||
global put: function(backend: opaque of Storage::BackendHandle, args: Storage::PutArgs): Storage::OperationResult;
|
||||
global put: function(backend: opaque of Storage::BackendHandle,
|
||||
args: Storage::PutArgs): Storage::OperationResult;
|
||||
|
||||
## Gets an entry from the backend asynchronously.
|
||||
## Gets an entry from the backend asynchronously. This method must be called via a
|
||||
## :zeek:see:`when` condition or an error will be returned.
|
||||
##
|
||||
## backend: A handle to a backend connection.
|
||||
##
|
||||
|
@ -56,10 +62,12 @@ export {
|
|||
## Returns: A record containing the status of the operation, an optional error
|
||||
## string for failures, and an optional value for success. The value
|
||||
## returned here will be of the type passed into
|
||||
## :zeek:see:`Storage::open_backend`.
|
||||
global get: function(backend: opaque of Storage::BackendHandle, key: any): Storage::OperationResult;
|
||||
## :zeek:see:`Storage::Async::open_backend`.
|
||||
global get: function(backend: opaque of Storage::BackendHandle, key: any)
|
||||
: Storage::OperationResult;
|
||||
|
||||
## Erases an entry from the backend asynchronously.
|
||||
## Erases an entry from the backend asynchronously. This method must be called via
|
||||
## a :zeek:see:`when` condition or an error will be returned.
|
||||
##
|
||||
## backend: A handle to a backend connection.
|
||||
##
|
||||
|
@ -67,31 +75,37 @@ export {
|
|||
##
|
||||
## Returns: A record containing the status of the operation and an optional error
|
||||
## string for failures.
|
||||
global erase: function(backend: opaque of Storage::BackendHandle, key: any): Storage::OperationResult;
|
||||
global erase: function(backend: opaque of Storage::BackendHandle, key: any)
|
||||
: Storage::OperationResult;
|
||||
}
|
||||
|
||||
function open_backend(btype: Storage::Backend, options: Storage::BackendOptions, key_type: any,
|
||||
val_type: any): Storage::OperationResult
|
||||
function open_backend(btype: Storage::Backend, options: Storage::BackendOptions,
|
||||
key_type: any, val_type: any): Storage::OperationResult
|
||||
{
|
||||
return Storage::Async::__open_backend(btype, options, key_type, val_type);
|
||||
}
|
||||
|
||||
function close_backend(backend: opaque of Storage::BackendHandle): Storage::OperationResult
|
||||
function close_backend(backend: opaque of Storage::BackendHandle)
|
||||
: Storage::OperationResult
|
||||
{
|
||||
return Storage::Async::__close_backend(backend);
|
||||
}
|
||||
|
||||
function put(backend: opaque of Storage::BackendHandle, args: Storage::PutArgs): Storage::OperationResult
|
||||
function put(backend: opaque of Storage::BackendHandle, args: Storage::PutArgs)
|
||||
: Storage::OperationResult
|
||||
{
|
||||
return Storage::Async::__put(backend, args$key, args$value, args$overwrite, args$expire_time);
|
||||
return Storage::Async::__put(backend, args$key, args$value, args$overwrite,
|
||||
args$expire_time);
|
||||
}
|
||||
|
||||
function get(backend: opaque of Storage::BackendHandle, key: any): Storage::OperationResult
|
||||
function get(backend: opaque of Storage::BackendHandle, key: any)
|
||||
: Storage::OperationResult
|
||||
{
|
||||
return Storage::Async::__get(backend, key);
|
||||
}
|
||||
|
||||
function erase(backend: opaque of Storage::BackendHandle, key: any): Storage::OperationResult
|
||||
function erase(backend: opaque of Storage::BackendHandle, key: any)
|
||||
: Storage::OperationResult
|
||||
{
|
||||
return Storage::Async::__erase(backend, key);
|
||||
}
|
||||
|
|
|
@ -5,8 +5,10 @@
|
|||
module Storage;
|
||||
|
||||
export {
|
||||
## Base record for backend options. Backend plugins can redef this record to add
|
||||
## relevant fields to it.
|
||||
## Base record for backend options that can be passed to
|
||||
## :zeek:see:`Storage::Async::open_backend` and
|
||||
## :zeek:see:`Storage::Sync::open_backend`. 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
|
||||
|
|
|
@ -23,8 +23,9 @@ export {
|
|||
## Returns: A record containing the status of the operation, and either an error
|
||||
## string on failure or a value on success. The value returned here will
|
||||
## be an ``opaque of BackendHandle``.
|
||||
global open_backend: function(btype: Storage::Backend, options: Storage::BackendOptions, key_type: any,
|
||||
val_type: any): Storage::OperationResult;
|
||||
global open_backend: function(btype: Storage::Backend,
|
||||
options: Storage::BackendOptions, key_type: any, val_type: any)
|
||||
: Storage::OperationResult;
|
||||
|
||||
## Closes an existing backend connection.
|
||||
##
|
||||
|
@ -32,7 +33,8 @@ export {
|
|||
##
|
||||
## Returns: A record containing the status of the operation and an optional error
|
||||
## string for failures.
|
||||
global close_backend: function(backend: opaque of Storage::BackendHandle): Storage::OperationResult;
|
||||
global close_backend: function(backend: opaque of Storage::BackendHandle)
|
||||
: Storage::OperationResult;
|
||||
|
||||
## Inserts a new entry into a backend.
|
||||
##
|
||||
|
@ -43,7 +45,8 @@ export {
|
|||
##
|
||||
## Returns: A record containing the status of the operation and an optional error
|
||||
## string for failures.
|
||||
global put: function(backend: opaque of Storage::BackendHandle, args: Storage::PutArgs): Storage::OperationResult;
|
||||
global put: function(backend: opaque of Storage::BackendHandle,
|
||||
args: Storage::PutArgs): Storage::OperationResult;
|
||||
|
||||
## Gets an entry from the backend.
|
||||
##
|
||||
|
@ -54,8 +57,9 @@ export {
|
|||
## Returns: A record containing the status of the operation, an optional error
|
||||
## string for failures, and an optional value for success. The value
|
||||
## returned here will be of the type passed into
|
||||
## :zeek:see:`Storage::open_backend`.
|
||||
global get: function(backend: opaque of Storage::BackendHandle, key: any): Storage::OperationResult;
|
||||
## :zeek:see:`Storage::Sync::open_backend`.
|
||||
global get: function(backend: opaque of Storage::BackendHandle, key: any)
|
||||
: Storage::OperationResult;
|
||||
|
||||
## Erases an entry from the backend.
|
||||
##
|
||||
|
@ -65,31 +69,37 @@ export {
|
|||
##
|
||||
## Returns: A record containing the status of the operation and an optional error
|
||||
## string for failures.
|
||||
global erase: function(backend: opaque of Storage::BackendHandle, key: any): Storage::OperationResult;
|
||||
global erase: function(backend: opaque of Storage::BackendHandle, key: any)
|
||||
: Storage::OperationResult;
|
||||
}
|
||||
|
||||
function open_backend(btype: Storage::Backend, options: Storage::BackendOptions, key_type: any,
|
||||
val_type: any): Storage::OperationResult
|
||||
function open_backend(btype: Storage::Backend, options: Storage::BackendOptions,
|
||||
key_type: any, val_type: any): Storage::OperationResult
|
||||
{
|
||||
return Storage::Sync::__open_backend(btype, options, key_type, val_type);
|
||||
}
|
||||
|
||||
function close_backend(backend: opaque of Storage::BackendHandle): Storage::OperationResult
|
||||
function close_backend(backend: opaque of Storage::BackendHandle)
|
||||
: Storage::OperationResult
|
||||
{
|
||||
return Storage::Sync::__close_backend(backend);
|
||||
}
|
||||
|
||||
function put(backend: opaque of Storage::BackendHandle, args: Storage::PutArgs): Storage::OperationResult
|
||||
function put(backend: opaque of Storage::BackendHandle, args: Storage::PutArgs)
|
||||
: Storage::OperationResult
|
||||
{
|
||||
return Storage::Sync::__put(backend, args$key, args$value, args$overwrite, args$expire_time);
|
||||
return Storage::Sync::__put(backend, args$key, args$value, args$overwrite,
|
||||
args$expire_time);
|
||||
}
|
||||
|
||||
function get(backend: opaque of Storage::BackendHandle, key: any): Storage::OperationResult
|
||||
function get(backend: opaque of Storage::BackendHandle, key: any)
|
||||
: Storage::OperationResult
|
||||
{
|
||||
return Storage::Sync::__get(backend, key);
|
||||
}
|
||||
|
||||
function erase(backend: opaque of Storage::BackendHandle, key: any): Storage::OperationResult
|
||||
function erase(backend: opaque of Storage::BackendHandle, key: any)
|
||||
: Storage::OperationResult
|
||||
{
|
||||
return Storage::Sync::__erase(backend, key);
|
||||
}
|
||||
|
|
|
@ -7,20 +7,20 @@ module Storage::Backend::Redis;
|
|||
export {
|
||||
## Options record for the built-in Redis backend.
|
||||
type Options: record {
|
||||
# Address or hostname of the server
|
||||
# Address or hostname of the server.
|
||||
server_host: string &optional;
|
||||
|
||||
# Port for the server
|
||||
# Port for the server.
|
||||
server_port: port &default=6379/tcp;
|
||||
|
||||
# Server unix socket file. This can be used instead of the
|
||||
# address and port above to connect to a local server.
|
||||
# Server unix socket file. This can be used instead of the address and
|
||||
# port above to connect to a local server. In order to use this, the
|
||||
# ``server_host`` field must be unset.
|
||||
server_unix_socket: string &optional;
|
||||
|
||||
# Prefix used in key values stored to differentiate varying
|
||||
# types of data on the same server. Defaults to an empty string,
|
||||
# but preferably should be set to a unique value per Redis
|
||||
# backend opened.
|
||||
# Prefix used in key values stored to differentiate varying types of data
|
||||
# on the same server. Defaults to an empty string, but preferably should
|
||||
# be set to a unique value per Redis backend opened.
|
||||
key_prefix: string &default="";
|
||||
};
|
||||
}
|
||||
|
|
|
@ -7,21 +7,22 @@ module Storage::Backend::SQLite;
|
|||
export {
|
||||
## Options record for the built-in SQLite backend.
|
||||
type Options: record {
|
||||
## Path to the database file on disk. Setting this to ":memory:"
|
||||
## will tell SQLite to use an in-memory database. Relative paths
|
||||
## will be opened relative to the directory where Zeek was
|
||||
## started from. Zeek will not create intermediate directories
|
||||
## if they do not already exist. See
|
||||
## https://www.sqlite.org/c3ref/open.html for more rules on
|
||||
## paths that can be passed here.
|
||||
## Path to the database file on disk. Setting this to ":memory:" will tell
|
||||
## SQLite to use an in-memory database. Relative paths will be opened
|
||||
## relative to the directory where Zeek was started from. Zeek will not
|
||||
## create intermediate directories if they do not already exist. See
|
||||
## https://www.sqlite.org/c3ref/open.html for more rules on paths that can
|
||||
## be passed here.
|
||||
database_path: string;
|
||||
|
||||
## Name of the table used for storing data.
|
||||
## Name of the table used for storing data. It is possible to use the same
|
||||
## database file for two separate tables, as long as the this value is
|
||||
## different between the two.
|
||||
table_name: string;
|
||||
|
||||
## Key/value table for passing tuning parameters when opening
|
||||
## the database. These must be pairs that can be passed to the
|
||||
## ``pragma`` command in sqlite.
|
||||
## Key/value table for passing tuning parameters when opening the
|
||||
## database. These must be pairs that can be passed to the ``pragma``
|
||||
## command in sqlite.
|
||||
tuning_params: table[string] of string &default=table(
|
||||
["journal_mode"] = "WAL",
|
||||
["synchronous"] = "normal",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue