Make storage events take a tag for the backend instead of a string

This commit is contained in:
Tim Wojtulewicz 2025-03-24 16:16:26 -07:00
parent 989e4adf90
commit 32ae8f4eaa
15 changed files with 39 additions and 38 deletions

View file

@ -11,7 +11,7 @@ using namespace zeek::storage;
namespace btest::storage::backend {
BackendPtr StorageDummy::Instantiate(std::string_view tag) { return make_intrusive<StorageDummy>(tag); }
BackendPtr StorageDummy::Instantiate() { return make_intrusive<StorageDummy>(); }
/**
* Called by the manager system to open the backend.

View file

@ -13,10 +13,10 @@ namespace btest::storage::backend {
*/
class StorageDummy : public zeek::storage::Backend {
public:
StorageDummy(std::string_view tag) : Backend(zeek::storage::SupportedModes::SYNC, tag) {}
StorageDummy() : Backend(zeek::storage::SupportedModes::SYNC, "StorageDummy") {}
~StorageDummy() override = default;
static zeek::storage::BackendPtr Instantiate(std::string_view tag);
static zeek::storage::BackendPtr Instantiate();
/**
* Called by the manager system to open the backend.

View file

@ -14,11 +14,11 @@
redef exit_only_after_terminate = T;
event Storage::backend_opened(tag: string, config: any) {
event Storage::backend_opened(tag: Storage::Backend, config: any) {
print "Storage::backend_opened", tag, config;
}
event Storage::backend_lost(tag: string, config: any, reason: string) {
event Storage::backend_lost(tag: Storage::Backend, config: any, reason: string) {
print "Storage::backend_lost", tag, config, reason;
terminate();
}

View file

@ -12,11 +12,11 @@
@load base/frameworks/storage/sync
@load policy/frameworks/storage/backend/redis
event Storage::backend_opened(tag: string, config: any) {
event Storage::backend_opened(tag: Storage::Backend, config: any) {
print "Storage::backend_opened", tag, config;
}
event Storage::backend_lost(tag: string, config: any, reason: string) {
event Storage::backend_lost(tag: Storage::Backend, config: any, reason: string) {
print "Storage::backend_lost", tag, config, reason;
terminate();
}

View file

@ -8,7 +8,7 @@
redef exit_only_after_terminate = T;
event Storage::backend_opened(tag: string, config: any) {
event Storage::backend_opened(tag: Storage::Backend, config: any) {
print "Storage::backend_opened", tag, config;
}

View file

@ -8,7 +8,7 @@
redef exit_only_after_terminate = T;
event Storage::backend_opened(tag: string, config: any) {
event Storage::backend_opened(tag: Storage::Backend, config: any) {
print "Storage::backend_opened", tag, config;
}