File tree Expand file tree Collapse file tree 4 files changed +10
-7
lines changed Expand file tree Collapse file tree 4 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -271,7 +271,9 @@ impl Context{
271271 }
272272
273273 pub fn open_primary_store_conn ( & self ) -> Result < TapeStore > {
274- Ok ( tape_network:: store:: primary ( ) ?)
274+ let rocksdb_config = self . config . storage . rocksdb . as_ref ( )
275+ . ok_or_else ( || anyhow:: anyhow!( "RocksDB config not found" ) ) ?;
276+ Ok ( tape_network:: store:: primary ( & rocksdb_config. primary_path ) ?)
275277 }
276278
277279 pub fn open_secondary_store_conn_mine ( & self ) -> Result < TapeStore > {
Original file line number Diff line number Diff line change @@ -87,7 +87,9 @@ async fn run_tape_cli() -> Result<()> {
8787 Commands :: Web { .. } |
8888 Commands :: Archive { .. } |
8989 Commands :: Mine { .. } => {
90- TapeStore :: try_init_store ( ) ?;
90+ let rocksdb_config = context. config . storage . rocksdb . as_ref ( )
91+ . ok_or_else ( || anyhow:: anyhow!( "RocksDB config not found" ) ) ?;
92+ TapeStore :: try_init_store ( & rocksdb_config. primary_path ) ?;
9193 network:: handle_network_commands ( cli, context) . await ?;
9294 }
9395
Original file line number Diff line number Diff line change 11use super :: { TapeStore , StoreError , consts:: * } ;
22use std:: { env, sync:: Arc } ;
33
4- pub fn primary ( ) -> Result < TapeStore , StoreError > {
4+ pub fn primary ( tape_store_primary_db : & str ) -> Result < TapeStore , StoreError > {
55 let current_dir = env:: current_dir ( ) . map_err ( StoreError :: IoError ) ?;
6- let db_primary = current_dir. join ( TAPE_STORE_PRIMARY_DB ) ;
6+ let db_primary = current_dir. join ( tape_store_primary_db ) ;
77 std:: fs:: create_dir_all ( & db_primary) . map_err ( StoreError :: IoError ) ?;
88 TapeStore :: new ( & db_primary)
99}
Original file line number Diff line number Diff line change @@ -25,8 +25,8 @@ impl TapeStore {
2525 Ok ( Self { db } )
2626 }
2727
28- pub fn try_init_store ( ) -> Result < ( ) , StoreError > {
29- if let Ok ( _store) = super :: helpers:: primary ( ) {
28+ pub fn try_init_store ( tape_store_primary_db : & str ) -> Result < ( ) , StoreError > {
29+ if let Ok ( _store) = super :: helpers:: primary ( tape_store_primary_db ) {
3030 log:: debug!( "Primary store initialized successfully" ) ;
3131 }
3232 Ok ( ( ) )
@@ -74,4 +74,3 @@ impl Drop for TapeStore {
7474 // RocksDB handles cleanup automatically
7575 }
7676}
77-
You can’t perform that action at this time.
0 commit comments