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

Semantics of seek #57618

Open
jakobnissen opened this issue Mar 3, 2025 · 0 comments
Open

Semantics of seek #57618

jakobnissen opened this issue Mar 3, 2025 · 0 comments
Labels
io Involving the I/O subsystem: libuv, read, write, etc. needs decision A decision on this change is needed

Comments

@jakobnissen
Copy link
Member

jakobnissen commented Mar 3, 2025

I'm not sure what the precise semantics of seek should be. Currently, it's underdefined, and I think we should exploit that the current lack of documentation (and inconsistent behaviour) gives us freedom to define seek as we want (rather than just documenting how it actually behaves currently).

  • Is the position always an integer, or can an IO define a custom indexing type e.g. to carry state?
  • Should it be documented that the position must be zero-indexed?
  • What should the behaviour be when seeking to a negative offset? This errors for IOStream, but not for IOBuffer
  • What should the behaviour be when seeking to something larger than the filesize? Currently, it seeks to the end, but @vtjnash in Refactor IOBuffer code #57570 suggested it should instead behave like lseek.
  • What should happen when calling seek on an unseekable IO? Should it be a noop or throw an error? Which error?
@jakobnissen jakobnissen added the io Involving the I/O subsystem: libuv, read, write, etc. label Mar 3, 2025
@oscardssmith oscardssmith added the needs decision A decision on this change is needed label Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
io Involving the I/O subsystem: libuv, read, write, etc. needs decision A decision on this change is needed
Projects
None yet
Development

No branches or pull requests

2 participants