Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
smartgoo committed Nov 10, 2024
1 parent 875ff60 commit 78fed0b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
4 changes: 0 additions & 4 deletions database/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ impl DB {
pub fn new(inner: DBWithThreadMode<MultiThreaded>, fd_guard: FDGuard) -> Self {
Self { inner, _fd_guard: fd_guard }
}

pub fn try_catchup_with_primary(&self) -> Result<(), Error> {
Ok(self.inner.try_catch_up_with_primary()?)
}
}

impl DerefMut for DB {
Expand Down
14 changes: 8 additions & 6 deletions database/src/db/conn_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,16 @@ impl ConnBuilder<PathBuf, false, Unspecified, i32> {
Ok(db)
}

pub fn build_secondary_read_only(self, secondary_parth: PathBuf) -> Result<Arc<DB>, kaspa_utils::fd_budget::Error> {
let mut opts = rocksdb::Options::default();
pub fn build_secondary(self, secondary_path: PathBuf) -> Result<Arc<DB>, kaspa_utils::fd_budget::Error> {
let (mut opts, guard) = default_opts!(self)?;
opts.set_max_open_files(-1);
opts.create_if_missing(false);
let guard = kaspa_utils::fd_budget::acquire_guard(self.files_limit)?;

let db = Arc::new(DB::new(
<DBWithThreadMode<MultiThreaded>>::open_as_secondary(&opts, self.db_path.to_str().unwrap(), secondary_parth.to_str().unwrap()).unwrap(),
<DBWithThreadMode<MultiThreaded>>::open_as_secondary(
&opts,
self.db_path.to_str().unwrap(),
secondary_path.to_str().unwrap(),
)
.unwrap(),
guard,
));
Ok(db)
Expand Down

0 comments on commit 78fed0b

Please sign in to comment.