DataONEorg / hashstore

HashStore, a hash-based object store for DataONE data packages
Apache License 2.0
1 stars 1 forks source link

Refactor 'verify_object' to also delete the object in question when an exception is thrown #76

Closed doulikecookiedough closed 6 months ago

doulikecookiedough commented 7 months ago

Currently, verify_object has been implemented without a return value and solely throws an exception if the checked values don't match what's found in the the object metadata. Given its expected use to be only after storing an object with just a stream, it seems intuitive to also delete the object when a mismatch occurs.

This simplifies the clean-up process for the calling client, since the only files that need to be removed at this point is the object itself (tag_object is not called since exceptions are thrown, so the reference files do not exist).

Alternatively, verify_object could also return a boolean, allowing the client to decide whether to delete the object or not. However, this means that delete_object needs to be refactored to handle this scenario.

doulikecookiedough commented 6 months ago

This has been completed via Feature-76: Verify Object Refactor. For the time being, we are following the existing HashStore-java process.