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

get_partial / set_partial / size: int or int64 #32

Closed
hannesm opened this issue Sep 23, 2022 · 4 comments · Fixed by ocaml/opam-repository#22648
Closed

get_partial / set_partial / size: int or int64 #32

hannesm opened this issue Sep 23, 2022 · 4 comments · Fixed by ocaml/opam-repository#22648

Comments

@hannesm
Copy link
Member

hannesm commented Sep 23, 2022

While working on implementations, I'm curious whether length and offset in get_partial, offset in set_partial, and the return value of size should better be int64 -- to enable safely reading and writing big data on 32bit systems as well (where int is pretty small).

//cc @palinp any preferences to use int (or was it mainly that you're on 64 bit systems anyways)?

@hannesm
Copy link
Member Author

hannesm commented Sep 23, 2022

maybe worth using https://github.com/mirage/optint/ to avoid boxing? and 63 bit are sufficient...

@reynir
Copy link
Member

reynir commented Sep 27, 2022

I think for offset it makes sense to use int64, but for length I think int is fine since we can't make strings that are longer than what can fit in int.

@reynir
Copy link
Member

reynir commented Sep 27, 2022

And now I wonder what get should do if the content is so large it can't fit in a string..!

@hannesm
Copy link
Member Author

hannesm commented Sep 27, 2022

And now I wonder what get should do if the content is so large it can't fit in a string..!

with get_partial / set_partial we write and read only chunks of the data --> that should be fine ;)

@hannesm hannesm closed this as completed in b1cca6e Dec 3, 2022
hannesm added a commit to hannesm/opam-repository that referenced this issue Dec 12, 2022
CHANGES:

* Use ptime directly for RO.last_modified, instead of the int * int64 pair
  (mirage/mirage-kv#34)
* Add RW.allocate to allocate a key and fill it with zero bytes (mirage/mirage-kv#34)
* RO.list: return Key.t instead of string (mirage/mirage-kv#37, fixes mirage/mirage-kv#33)
* Introduce a custom error for RW.rename with a source which is a prefix of
  destination (mirage/mirage-kv#37, fixes mirage/mirage-kv#31)
* Use Optint.Int63.t for RO.size, RO.get_partial, RO.set_partial (mirage/mirage-kv#37, fixes mirage/mirage-kv#32)
* Remove RW.batch (mirage/mirage-kv#37, fixes mirage/mirage-kv#29 mirage/mirage-kv#36, discussed at the MirageOS meeting in
  November, and on the mirageos-devel mailing list in January 2022)
* Key.pp: escape the entire string, not individual fragments (mirage/mirage-kv#35)
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

Successfully merging a pull request may close this issue.

2 participants