pub(crate) fn db_config(&self, network: Network) -> (PathBuf, rocksdb::Options) {
        let net_dir = match network {
            Network::Mainnet => "mainnet",
            Network::Testnet => "testnet",
        };

        let path = if self.ephemeral {
            gen_temp_path(&format!(
                "zebra-state-v{}-{}",
                crate::constants::DATABASE_FORMAT_VERSION,
                net_dir
            ))
        } else {
            self.cache_dir
                .join("state")
                .join(format!("v{}", crate::constants::DATABASE_FORMAT_VERSION))
                .join(net_dir)
        };

        let mut opts = rocksdb::Options::default();

        opts.create_if_missing(true);
        opts.create_missing_column_families(true);

        let open_file_limit = Config::increase_open_file_limit();
        let db_file_limit = Config::get_db_open_file_limit(open_file_limit);
        // If the current limit is very large, set the DB limit using the ideal limit
        let db_file_limit = db_file_limit.try_into().unwrap_or_else(|_| {
            Config::get_db_open_file_limit(Config::IDEAL_OPEN_FILE_LIMIT)
                .try_into()
                .expect("ideal open file limit fits in a config int")
        });
        opts.set_max_open_files(db_file_limit);

        (path, opts)
    }
/// Returns the path and database options for the finalized state database
Returns the path and database options for the finalized state database
Returns the path and database options for the finalized state database
pub(crate) fn db_config(&self, network: Network) -> (PathBuf, rocksdb::Options) {
        let net_dir = match network {
            Network::Mainnet => "mainnet",
            Network::Testnet => "testnet",
        };
        let path = if self.ephemeral {
            gen_temp_path(&format!(
                "zebra-state-v{}-{}",
                crate::constants::DATABASE_FORMAT_VERSION,
                net_dir
            ))
        } else {
            self.cache_dir
                .join("state")
                .join(format!("v{}", crate::constants::DATABASE_FORMAT_VERSION))
                .join(net_dir)
        };
        let mut opts = rocksdb::Options::default();
        opts.create_if_missing(true);
        opts.create_missing_column_families(true);
        let open_file_limit = Config::increase_open_file_limit();
        let db_file_limit = Config::get_db_open_file_limit(open_file_limit);
        // If the current limit is very large, set the DB limit using the ideal limit
        let db_file_limit = db_file_limit.try_into().unwrap_or_else(|_| {
            Config::get_db_open_file_limit(Config::IDEAL_OPEN_FILE_LIMIT)
                .try_into()
                .expect("ideal open file limit fits in a config int")
        });
        opts.set_max_open_files(db_file_limit);
        (path, opts)
    }
pub ( crate ) fn db_config ( & self , network : Network ) -> ( PathBuf , rocksdb :: Options ) { let net_dir = match network { Network :: Mainnet => " " , Network :: Testnet => " " , } ; let path = if self . ephemeral { gen_temp_path ( & format ! ( " " crate constants DATABASE_FORMAT_VERSION net_dir ) ) } else { self . cache_dir . join ( " " ) . join ( format ! ( " " crate constants DATABASE_FORMAT_VERSION ) ) . join ( net_dir ) } ; let mut opts = rocksdb :: Options :: default ( ) ; opts . create_if_missing ( true ) ; opts . create_missing_column_families ( true ) ; let open_file_limit = Config :: increase_open_file_limit ( ) ; let db_file_limit = Config :: get_db_open_file_limit ( open_file_limit ) ; // If the current limit is very large, set the DB limit using the ideal limit let db_file_limit = db_file_limit . try_into ( ) . unwrap_or_else ( | _ | { Config :: get_db_open_file_limit ( Config :: IDEAL_OPEN_FILE_LIMIT ) . try_into ( ) . expect ( " " ) } ) ; opts . set_max_open_files ( db_file_limit ) ; ( path , opts ) }
Returns the path and database options for the finalized state database
Returns the path and database options for the finalized state database
&self
network
Network