From 48a00969e5e95edbad583ba4c5e434091d9485b5 Mon Sep 17 00:00:00 2001 From: Oleg Date: Wed, 11 Dec 2024 09:26:39 +0100 Subject: [PATCH] feat(hb_store): switch local_store to hb_store_rocksdb --- src/ar_bundles.erl | 16 +++++++++++++++- src/hb_opts.erl | 2 +- src/hb_store_rocksdb.erl | 3 +-- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/src/ar_bundles.erl b/src/ar_bundles.erl index 0767d7a2..b4456789 100644 --- a/src/ar_bundles.erl +++ b/src/ar_bundles.erl @@ -944,10 +944,24 @@ ar_bundles_test_() -> {timeout, 30, fun test_bundle_map/0}, {timeout, 30, fun test_basic_member_id/0}, {timeout, 30, fun test_deep_member/0}, - {timeout, 30, fun test_serialize_deserialize_deep_signed_bundle/0}, {timeout, 30, fun test_extremely_large_bundle/0} ]. +ar_bundles_with_hb_store_test_() -> + {foreach, + fun() -> + Opts = hb_opts:get(local_store), + hb_store:start(Opts) + end, + fun(_) -> + Opts = hb_opts:get(local_store), + hb_store:stop(Opts) + end, + [ + {timeout, 30, fun test_serialize_deserialize_deep_signed_bundle/0} + ] + }. + test_no_tags() -> {Priv, Pub} = ar_wallet:new(), {KeyType, Owner} = Pub, diff --git a/src/hb_opts.erl b/src/hb_opts.erl index a81494b8..a1a17dcf 100644 --- a/src/hb_opts.erl +++ b/src/hb_opts.erl @@ -100,7 +100,7 @@ config() -> client_error_strategy => throw, % Dev options local_store => - [{hb_store_fs, #{ prefix => "TEST-data" }}], + [{hb_store_rocksdb, #{ prefix => "TEST-data" }}], mode => debug, debug_stack_depth => 40, debug_print_map_line_threshold => 30, diff --git a/src/hb_store_rocksdb.erl b/src/hb_store_rocksdb.erl index 62d8f1fb..548b693c 100644 --- a/src/hb_store_rocksdb.erl +++ b/src/hb_store_rocksdb.erl @@ -53,7 +53,7 @@ start_link(Opts) -> % -spec start(#{dir := term()}) -> ignore | {ok, pid()}. start(Opts) -> - start_link(Opts). + start_link([{hb_store_rocksdb, Opts}]). -spec stop(any()) -> ok. stop(_Opts) -> @@ -211,7 +211,6 @@ add_path(_Opts, Path1, Path2) -> %%% Gen server callbacks %%%============================================================================= init(Dir) -> - logger:error("Starting the process"), {ok, DBHandle, [DefaultH, MetaH]} = open_rockdb(Dir), State = #{ db_handle => DBHandle,