Add STORAGE_ prefixes for backends and serializers

This commit is contained in:
Tim Wojtulewicz 2025-04-11 13:53:03 -07:00
parent 9593db1974
commit cb1ef47a31
24 changed files with 33 additions and 33 deletions

View file

@ -63,7 +63,7 @@ event zeek_init() {
value[2] = "b";
value[3] = "c";
local open_res = Storage::Sync::open_backend(Storage::SQLITE, opts, Rec, tbl);
local open_res = Storage::Sync::open_backend(Storage::STORAGE_BACKEND_SQLITE, opts, Rec, tbl);
print "open result", open_res;
local b = open_res$value;

View file

@ -17,7 +17,7 @@ event zeek_init()
# Test inserting/retrieving a key/value pair that we know won't be in
# the backend yet.
local open_res = Storage::Sync::open_backend(Storage::SQLITE, opts, string, string);
local open_res = Storage::Sync::open_backend(Storage::STORAGE_BACKEND_SQLITE, opts, string, string);
print "open result", open_res;
local b = open_res$value;

View file

@ -33,7 +33,7 @@ event setup_test()
local opts : Storage::BackendOptions;
opts$sqlite = [$database_path = "storage-test.sqlite", $table_name = "testing"];
local open_res = Storage::Sync::open_backend(Storage::SQLITE, opts, string, string);
local open_res = Storage::Sync::open_backend(Storage::STORAGE_BACKEND_SQLITE, opts, string, string);
print "open result", open_res;
b = open_res$value;

View file

@ -18,7 +18,7 @@ event zeek_init() {
local value = "value7890";
local value2 = "value2345";
local res = Storage::Sync::open_backend(Storage::SQLITE, opts, str, str);
local res = Storage::Sync::open_backend(Storage::STORAGE_BACKEND_SQLITE, opts, str, str);
print "open result", res;
local b = res$value;

View file

@ -22,7 +22,7 @@ event zeek_init()
local key = "key1234";
local value = "value5678";
local open_res = Storage::Sync::open_backend(Storage::REDIS, opts, string, string);
local open_res = Storage::Sync::open_backend(Storage::STORAGE_BACKEND_REDIS, opts, string, string);
print "open result", open_res;
local b = open_res$value;

View file

@ -25,7 +25,7 @@ event zeek_init()
local value = "value5678";
when [opts, key, value] ( local open_res = Storage::Async::open_backend(
Storage::REDIS, opts, string, string) )
Storage::STORAGE_BACKEND_REDIS, opts, string, string) )
{
print "open result", open_res;
local b = open_res$value;

View file

@ -40,7 +40,7 @@ event zeek_init()
opts$redis = [ $server_host="127.0.0.1", $server_port=to_port(getenv(
"REDIS_PORT")), $key_prefix="testing" ];
local open_res = Storage::Sync::open_backend(Storage::REDIS, opts, string, string);
local open_res = Storage::Sync::open_backend(Storage::STORAGE_BACKEND_REDIS, opts, string, string);
backend = open_res$value;
}

View file

@ -26,14 +26,14 @@ event Storage::backend_lost(tag: Storage::Backend, config: any, reason: string)
event zeek_init()
{
local opts: Storage::BackendOptions;
opts$serializer = Storage::JSON;
opts$serializer = Storage::STORAGE_SERIALIZER_JSON;
opts$redis = [ $server_host="127.0.0.1", $server_port=to_port(getenv(
"REDIS_PORT")), $key_prefix="testing" ];
local key = "key1234";
local value = "value1234";
local open_res = Storage::Sync::open_backend(Storage::REDIS, opts, string, string);
local open_res = Storage::Sync::open_backend(Storage::STORAGE_BACKEND_REDIS, opts, string, string);
print "open_result", open_res;
# Kill the redis server so the backend will disconnect and fire the backend_lost event.

View file

@ -21,7 +21,7 @@ event zeek_init()
local key = "key1234";
local value = "value1234";
local open_res = Storage::Sync::open_backend(Storage::REDIS, opts, string, string);
local open_res = Storage::Sync::open_backend(Storage::STORAGE_BACKEND_REDIS, opts, string, string);
print "open_result", open_res;
local b = open_res$value;

View file

@ -40,7 +40,7 @@ event setup_test()
opts$redis = [ $server_host="127.0.0.1", $server_port=to_port(getenv(
"REDIS_PORT")), $key_prefix="testing" ];
local open_res = Storage::Sync::open_backend(Storage::REDIS, opts, string, string);
local open_res = Storage::Sync::open_backend(Storage::STORAGE_BACKEND_REDIS, opts, string, string);
print "open result", open_res;
b = open_res$value;

View file

@ -40,7 +40,7 @@ event setup_test()
opts$redis = [ $server_host="127.0.0.1", $server_port=to_port(getenv(
"REDIS_PORT")), $key_prefix="testing" ];
local open_res = Storage::Sync::open_backend(Storage::REDIS, opts, string, string);
local open_res = Storage::Sync::open_backend(Storage::STORAGE_BACKEND_REDIS, opts, string, string);
print "open result", open_res;
b = open_res$value;

View file

@ -24,7 +24,7 @@ event Storage::backend_lost(tag: Storage::Backend, config: any, reason: string)
event zeek_init()
{
local opts: Storage::BackendOptions;
opts$serializer = Storage::JSON;
opts$serializer = Storage::STORAGE_SERIALIZER_JSON;
opts$redis = [ $server_host="127.0.0.1", $server_port=to_port(getenv(
"REDIS_PORT")), $key_prefix="testing" ];
@ -32,7 +32,7 @@ event zeek_init()
local value = "value1234";
local value2 = "value2345";
local res = Storage::Sync::open_backend(Storage::REDIS, opts, string, string);
local res = Storage::Sync::open_backend(Storage::STORAGE_BACKEND_REDIS, opts, string, string);
print "open_result", res;
local b = res$value;

View file

@ -20,7 +20,7 @@ event zeek_init()
# Test inserting/retrieving a key/value pair that we know won't be in
# the backend yet.
local open_res = Storage::Sync::open_backend(Storage::SQLITE, opts, string, string);
local open_res = Storage::Sync::open_backend(Storage::STORAGE_BACKEND_SQLITE, opts, string, string);
print "open result", open_res;
local b = open_res$value;

View file

@ -24,7 +24,7 @@ event zeek_init()
# Test inserting/retrieving a key/value pair that we know won't be in
# the backend yet.
when [opts, key, value] ( local open_res = Storage::Sync::open_backend(
Storage::SQLITE, opts, string, string) )
Storage::STORAGE_BACKEND_SQLITE, opts, string, string) )
{
print "open result", open_res;
local b = open_res$value;

View file

@ -16,7 +16,7 @@ event zeek_init()
{
# Create a database file in the .tmp directory with a 'testing' table
local opts: Storage::BackendOptions;
opts$serializer = Storage::JSON;
opts$serializer = Storage::STORAGE_SERIALIZER_JSON;
opts$sqlite = [ $database_path="test.sqlite", $table_name="testing" ];
local key = "key1234";
@ -25,7 +25,7 @@ event zeek_init()
# Test inserting/retrieving a key/value pair that we know won't be in
# the backend yet.
when [opts, key, value] ( local open_res = Storage::Async::open_backend(
Storage::SQLITE, opts, string, string) )
Storage::STORAGE_BACKEND_SQLITE, opts, string, string) )
{
print "open result", open_res;
local b = open_res$value;

View file

@ -14,12 +14,12 @@ event zeek_init() {
$table_name = "testing"];
# This should report an error in .stderr and reporter.log
local open_res = Storage::Sync::open_backend(Storage::SQLITE, opts, string, string);
local open_res = Storage::Sync::open_backend(Storage::STORAGE_BACKEND_SQLITE, opts, string, string);
print "Open result", open_res;
# Open a valid database file
opts$sqlite$database_path = "test.sqlite";
open_res = Storage::Sync::open_backend(Storage::SQLITE, opts, string, string);
open_res = Storage::Sync::open_backend(Storage::STORAGE_BACKEND_SQLITE, opts, string, string);
print "Open result 2", open_res;
local b = open_res$value;