pub fn unique_db_name(base: impl AsRef<Path>) -> PathBuf {
    let mut base = base.as_ref().to_owned();
    let timestamp = timestamp();

    let mut count = 0;
    loop {
        // Set the extension to be the current time
        base.set_file_name(db_name(&timestamp, count));

        match std::fs::metadata(&base) {
            Ok(_) => count += 1,
            Err(_) => {
                info!("Telemetry DB path {:?}", &base);
                break base;
            }
        }
    }
}
/// Generate a unique db name based of the current time, and if there are colisions a incrementing
/// integer is appended.
Generate a unique db name based of the current time, and if there are colisions a incrementing
integer is appended.
Generate a unique db name based of the current time and if there are colisions a incrementing integer is appended .
pub fn unique_db_name(base: impl AsRef<Path>) -> PathBuf {
    let mut base = base.as_ref().to_owned();
    let timestamp = timestamp();
    let mut count = 0;
    loop {
        // Set the extension to be the current time
        base.set_file_name(db_name(&timestamp, count));
        match std::fs::metadata(&base) {
            Ok(_) => count += 1,
            Err(_) => {
                info!("Telemetry DB path {:?}", &base);
                break base;
            }
        }
    }
}
pub fn unique_db_name ( base : impl AsRef < Path > ) -> PathBuf { let mut base = base . as_ref ( ) . to_owned ( ) ; let timestamp = timestamp ( ) ; let mut count = 0 ; loop { // Set the extension to be the current time base . set_file_name ( db_name ( & timestamp , count ) ) ; match std :: fs :: metadata ( & base ) { Ok ( _ ) => count += 1 , Err ( _ ) => { info ! ( " " base ) ; break base ; } } } }
Generate a unique db name based of the current time, and if there are colisions a incrementing
integer is appended.
Generate a unique db name based of the current time and if there are colisions a incrementing integer is appended .
base
impl AsRef<Path>
base
impl AsRef<Path>