Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
J-Loudet opened this issue Sep 20, 2024 · 0 comments
Labels
api fix Correct API breaking-change Indicates that the issue implies a breaking change (be it at compile time or at runtime) enhancement Existing things could work better

Comments

@J-Loudet
Copy link
Contributor

Describe the feature

The method get:

async fn get(
&mut self,
key: Option<OwnedKeyExpr>,
parameters: &str,
) -> ZResult<Vec<StoredData>>;

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 J-Loudet added enhancement Existing things could work better breaking-change Indicates that the issue implies a breaking change (be it at compile time or at runtime) api fix Correct API labels Sep 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api fix Correct API breaking-change Indicates that the issue implies a breaking change (be it at compile time or at runtime) enhancement Existing things could work better
Projects
None yet
Development

No branches or pull requests

1 participant