base/frameworks/storage/sync.zeek

Storage::Sync

Synchronous operation methods for the storage framework.

Namespace:

Storage::Sync

Imports:

base/frameworks/storage/main.zeek

Summary

Functions

Storage::Sync::close_backend: function

Closes an existing backend connection.

Storage::Sync::erase: function

Erases an entry from the backend.

Storage::Sync::get: function

Gets an entry from the backend.

Storage::Sync::open_backend: function

Opens a new backend connection based on a configuration object.

Storage::Sync::put: function

Inserts a new entry into a backend.

Detailed Interface

Functions

Storage::Sync::close_backend
Type:

function (backend: opaque of Storage::BackendHandle) : Storage::OperationResult

Closes an existing backend connection.

Parameters:

backend – A handle to a backend connection.

Returns:

A record containing the status of the operation and an optional error string for failures.

Storage::Sync::erase
Type:

function (backend: opaque of Storage::BackendHandle, key: any) : Storage::OperationResult

Erases an entry from the backend.

Parameters:
  • backend – A handle to a backend connection.

  • key – The key to erase.

Returns:

A record containing the status of the operation and an optional error string for failures.

Storage::Sync::get
Type:

function (backend: opaque of Storage::BackendHandle, key: any) : Storage::OperationResult

Gets an entry from the backend.

Parameters:
  • backend – A handle to a backend connection.

  • key – The key to look up.

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 Storage::Sync::open_backend.

Storage::Sync::open_backend
Type:

function (btype: Storage::Backend, options: Storage::BackendOptions, key_type: any, val_type: any) : Storage::OperationResult

Opens a new backend connection based on a configuration object.

Parameters:
  • btype – A tag indicating what type of backend should be opened. These are defined by the backend plugins loaded.

  • options – A record containing the configuration for the connection.

  • key_type – The script-level type of keys stored in the backend. Used for validation of keys passed to other framework methods.

  • val_type – The script-level type of keys stored in the backend. Used for validation of values passed to Storage::Sync::put as well as for type conversions for return values from Storage::Sync::get.

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.

Storage::Sync::put
Type:

function (backend: opaque of Storage::BackendHandle, args: Storage::PutArgs) : Storage::OperationResult

Inserts a new entry into a backend.

Parameters:
  • backend – A handle to a backend connection.

  • args – A Storage::PutArgs record containing the arguments for the operation.

Returns:

A record containing the status of the operation and an optional error string for failures.