Pass key/value types for validation when opening backends

This commit is contained in:
Tim Wojtulewicz 2024-12-06 14:24:27 -07:00
parent 2ea0f3e70a
commit 69d940533d
10 changed files with 100 additions and 54 deletions

View file

@ -23,12 +23,17 @@ public:
* Opens a new storage backend.
*
* @param type The tag for the type of backend being opened.
* @param options A record val representing the configuration for this
* type of backend.
* @return A pair containing a pointer to a backend and a string for
* returning error messages if needed.
* @param options A record val representing the configuration for this type of
* backend.
* @param key_type The script-side type of the keys stored in the backend. Used for
* validation of types.
* @param val_type The script-side type of the values stored in the backend. Used for
* validation of types and conversion during retrieval.
* @return An optional value potentially containing an error string if needed. Will be
* unset if the operation succeeded.
*/
zeek::expected<BackendPtr, std::string> OpenBackend(const Tag& type, RecordValPtr options);
zeek::expected<BackendPtr, std::string> OpenBackend(const Tag& type, RecordValPtr options, TypePtr key_type,
TypePtr val_type);
/**
* Closes a storage backend.