diff --git a/Cargo.lock b/Cargo.lock index 9c45cfc7c8..853a3f9ebb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1629,7 +1629,7 @@ checksum = "9f1341053f34bb13b5e9590afb7d94b48b48d4b87467ec28e3c238693bb553de" [[package]] name = "sourmash" -version = "0.17.2" +version = "0.18.0" dependencies = [ "az", "byteorder", diff --git a/doc/support.md b/doc/support.md index f4ee4f492d..84ea413802 100644 --- a/doc/support.md +++ b/doc/support.md @@ -81,6 +81,13 @@ you upgrade within a major sourmash release (barring bug fixes!). Moreover, if you rely on a feature introduced in v3.3.0, that feature will not break in v3.4.0, but will also not be backported to version 3.2.0. +### Output file formats + +In particular, the CSV output file formats are guaranteed to be stable +within major versions, with one caveat: we may add or rearrange +columns between releases. You should use column headers/column names +to parse CSV files, and not depend on column order. + ### Python API We intend to guarantee the Python API at the top level, i.e. diff --git a/include/sourmash.h b/include/sourmash.h index beb64ea455..f650035dec 100644 --- a/include/sourmash.h +++ b/include/sourmash.h @@ -49,6 +49,7 @@ enum SourmashErrorCode { SOURMASH_ERROR_CODE_NIFFLER_ERROR = 100005, SOURMASH_ERROR_CODE_CSV_ERROR = 100006, SOURMASH_ERROR_CODE_ROCKS_DB_ERROR = 100007, + SOURMASH_ERROR_CODE_ZIP_ERROR = 100008, }; typedef uint32_t SourmashErrorCode; diff --git a/src/core/Cargo.toml b/src/core/Cargo.toml index 41cf944fac..a45d034810 100644 --- a/src/core/Cargo.toml +++ b/src/core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "sourmash" -version = "0.17.2" +version = "0.18.0" authors = ["Luiz Irber ", "N. Tessa Pierce-Ward ", "C. Titus Brown "] description = "tools for comparing biological sequences with k-mer sketches" repository = "https://github.com/sourmash-bio/sourmash" diff --git a/src/core/src/errors.rs b/src/core/src/errors.rs index 30d269a135..e8ce3e68aa 100644 --- a/src/core/src/errors.rs +++ b/src/core/src/errors.rs @@ -90,6 +90,9 @@ pub enum SourmashError { #[cfg(feature = "branchwater")] #[error(transparent)] RocksDBError(#[from] rocksdb::Error), + + #[error(transparent)] + ZipError(#[from] piz::result::ZipError), } #[derive(Debug, Error)] @@ -140,6 +143,7 @@ pub enum SourmashErrorCode { NifflerError = 100_005, CsvError = 100_006, RocksDBError = 100_007, + ZipError = 100_008, } #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))] @@ -179,6 +183,8 @@ impl SourmashErrorCode { #[cfg(not(target_arch = "wasm32"))] #[cfg(feature = "branchwater")] SourmashError::RocksDBError { .. } => SourmashErrorCode::RocksDBError, + + SourmashError::ZipError { .. } => SourmashErrorCode::ZipError, } } } diff --git a/src/core/src/storage/mod.rs b/src/core/src/storage/mod.rs index e098f58eba..b026b80d47 100644 --- a/src/core/src/storage/mod.rs +++ b/src/core/src/storage/mod.rs @@ -403,22 +403,22 @@ impl ZipStorage { let zip_file = File::open(location.as_ref())?; let mapping = unsafe { memmap2::Mmap::map(&zip_file)? }; - let mut storage = ZipStorageBuilder { + let mut storage = ZipStorageTryBuilder { mapping: Some(mapping), archive_builder: |mapping: &Option| { - piz::ZipArchive::new(mapping.as_ref().unwrap()).unwrap() + piz::ZipArchive::new(mapping.as_ref().unwrap()) }, metadata_builder: |archive: &piz::ZipArchive| { - archive + Ok(archive .entries() .iter() .map(|entry| (entry.path.as_os_str(), entry)) - .collect() + .collect()) }, subdir: None, path: Some(location.as_ref().into()), } - .build(); + .try_build()?; let subdir = find_subdirs(storage.borrow_archive())?; storage.with_mut(|fields| *fields.subdir = subdir);