Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MRG: panic when
FSStorage::load_sig
encounters more than one `Signa…
…ture` in a JSON record (#3333) This PR was originally about debugging sourmash-bio/sourmash_plugin_branchwater#445, but that's going to require more work to fix properly. For now, I would like to nominate it for merge because sourmash fails silently in this situation, and that's Bad. In brief, the main thing this PR does is panic with an `unimplemented!` when `FSStorage::load_sig` encounters more than one `Signature` in a JSON record. This PR also adds a bit of documentation to `InnerStorage`, per the bottom of [this comment](sourmash-bio/sourmash_plugin_branchwater#445 (comment)). --- The problem at hand: when loading a `SigStore`/`Signature` from a `Storage`, sourmash only loads the first one and ignores any others. https://github.com/sourmash-bio/sourmash/blob/26b50f3e3566006fd6356a4f8b4d47c5e381aeec/src/core/src/storage/mod.rs#L34-L38 This results from the concept of a `Signature` as containing one or more sketches; the history of this is described [here](#616 (comment)), and it leads to some interesting silliness [in the Python layer](https://github.com/sourmash-bio/sourmash/blob/d63c464e825529fa54bb7e8b81faa53b858b09de/src/sourmash/save_load.py#L297). The contrapositive is that, in Rust, a single `Signature` can include multiple sketches, e.g. with different ksizes. So this works fine for the wort case where we have a single `.sig` file with k=21, k=31, k51. Note that the Python layer (and hence the entire sourmash CLI) fully supports multiple `Signature`s in JSON: this is well tested and well covered behavior. The branchwater plugin runs into it because it is using the Rust layer and the API is not fully fleshed out there. ---
- Loading branch information