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

Mirage_kv.RO.list does not specify if the returned keys are relative to key or absolute. #38

Closed
reynir opened this issue Dec 15, 2022 · 3 comments

Comments

@reynir
Copy link
Member

reynir commented Dec 15, 2022

I think the way forward is to look at what the implementations do - and if they agree we specify that behavior.

mirage-kv/src/mirage_kv.mli

Lines 148 to 153 in 297015e

val list: t -> key -> ((key * [`Value | `Dictionary]) list, error) result Lwt.t
(** [list t k] is the list of entries and their types in the
dictionary referenced by [k] in [t].
The result is [Error (`Dictionary_expected k)] if [k] refers to a
value in [t]. *)

@hannesm
Copy link
Member

hannesm commented Dec 15, 2022

Ah, so git-kv and mirage-kv-mem provide the absolute key (by using Mirage_kv.Key.add <sub> key).

@reynir
Copy link
Member Author

reynir commented Dec 15, 2022

mirage-kv-mem did not return the absolute key in 3.1.0:

https://github.com/mirage/mirage-kv-mem/blob/v3.1.0/src/mirage_kv_mem.ml#L82-L90

I'm not opposed to returning absolute keys as in many cases it's convenient.

@hannesm
Copy link
Member

hannesm commented Dec 15, 2022

Yes, the behaviour changed in mirage-kv-mem 3.2.0 / 3.2.1 (when mirage-kv 6.0.0 was supported): mirage/mirage-kv-mem@0568c41#diff-95712f84e44230209e7e8e709e156d76ef8783b82d3ba30a2143f07c9f087b3aR86 also in git-kv 0.0.2 robur-coop/git-kv@d27fd75#diff-8eb05ae96d8254f6beb0a2694be54067bce03d90d9c60e4e625c98392e255d4aR415

hannesm added a commit that referenced this issue Dec 15, 2022
hannesm added a commit to hannesm/opam-repository that referenced this issue Dec 15, 2022
CHANGES:

* Specify in RO.list that the returned list consists of keys being absolute, and
  kinds (mirage/mirage-kv#38 mirage/mirage-kv#39 @reynir @hannesm)
* BREAKING: Before 6.0.0, the return type of RO.list consisted of a string and
  kind list, where the string was relative. Now it is absolute.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants