zenoh icon indicating copy to clipboard operation
zenoh copied to clipboard

storage-manager: `get` returns an error on a missing key, return `None` instead?

Open J-Loudet opened this issue 1 year ago • 0 comments

Describe the feature

The method get: https://github.com/eclipse-zenoh/zenoh/blob/ddcc8f1d8c114ca256df3939c303bcbdc1f80197/plugins/zenoh-backend-traits/src/lib.rs#L247-L251

returns, at least in some implementation, an error when the requested key is missing.

I believe it should return a ZResult<Option<Vec<StoredData>>> where the None indicates that there is no entry for that key expression. This would allow differentiating an actual error of the underlying Storage from a missing key.

Right now, for instance, the Memory backend returns an error: https://github.com/eclipse-zenoh/zenoh/blob/main/plugins/zenoh-plugin-storage-manager/src/memory_backend/mod.rs#L131

J-Loudet avatar Sep 20 '24 10:09 J-Loudet