mirror of
https://github.com/zeek/zeek.git
synced 2025-10-13 20:18:20 +00:00
Pass key/value types for validation when opening backends
This commit is contained in:
parent
2ea0f3e70a
commit
69d940533d
10 changed files with 100 additions and 54 deletions
|
@ -10,7 +10,8 @@ Manager::Manager() : plugin::ComponentManager<storage::Component>("Storage", "Ba
|
|||
|
||||
void Manager::InitPostScript() { detail::backend_opaque = make_intrusive<OpaqueType>("Storage::Backend"); }
|
||||
|
||||
zeek::expected<BackendPtr, std::string> Manager::OpenBackend(const Tag& type, RecordValPtr options) {
|
||||
zeek::expected<BackendPtr, std::string> Manager::OpenBackend(const Tag& type, RecordValPtr options, TypePtr key_type,
|
||||
TypePtr val_type) {
|
||||
Component* c = Lookup(type);
|
||||
if ( ! c ) {
|
||||
return zeek::unexpected<std::string>(
|
||||
|
@ -32,7 +33,7 @@ zeek::expected<BackendPtr, std::string> Manager::OpenBackend(const Tag& type, Re
|
|||
util::fmt("Failed to instantiate backend %s", GetComponentName(type).c_str()));
|
||||
}
|
||||
|
||||
if ( auto res = bp->Open(std::move(options)); res.has_value() ) {
|
||||
if ( auto res = bp->Open(std::move(options), std::move(key_type), std::move(val_type)); res.has_value() ) {
|
||||
return zeek::unexpected<std::string>(
|
||||
util::fmt("Failed to open backend %s: %s", GetComponentName(type).c_str(), res.value().c_str()));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue