Skip to content

proposal: x/exp/mmap: expose a File-like type #39683

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

Closed
sbinet opened this issue Jun 18, 2020 · 5 comments
Closed

proposal: x/exp/mmap: expose a File-like type #39683

sbinet opened this issue Jun 18, 2020 · 5 comments

Comments

@sbinet
Copy link
Member

sbinet commented Jun 18, 2020

right now, with the current mmap.ReaderAt type, one can easily (and from multiple goroutines) access mmap'ed data.

that's great.

but my application A also needs an io.Reader.
I've resorted to forking the x/exp/mmap package under go-mmap/mmap, that exposes a Reader type that implements io.Reader, io.Seeker, io.ReaderAt and io.ByteReader.

now, in yet another application (B), to interface with a FPGA board, I'd also need write access.

it comes to reason to thus expose a File-like type, implementing also io.Writer, io.WriterAt and io.ByteWriter.

@gopherbot gopherbot added this to the Unreleased milestone Jun 18, 2020
@andybons andybons changed the title x/exp/mmap: expose a File-like type proposal: x/exp/mmap: expose a File-like type Jun 18, 2020
@bcmills
Copy link
Contributor

bcmills commented Jun 18, 2020

Is there a reason you can't (or shouldn't) wrap it in an io.SectionReader?

@sbinet
Copy link
Member Author

sbinet commented Jun 18, 2020

no, I just didn't think about io.SectionReader (which is sad b/c I do use it quite extensively in other parts of "application A")

but for "application B", I would need r/w capabilities (to interact with a Cyclone V FPGA board)

@rsc
Copy link
Contributor

rsc commented Nov 18, 2020

You could easily fork SectionReader and create SectionWriter. Writing to a fixed area is not particularly common though, so it might not be worth putting in io itself.

It does seem like the general adapters are better than more functionality in package mmap itself.

@rsc
Copy link
Contributor

rsc commented Dec 2, 2020

Based on the discussion above, this seems like a likely decline.

@rsc
Copy link
Contributor

rsc commented Dec 9, 2020

No change in consensus, so declined.

@rsc rsc closed this as completed Dec 9, 2020
@golang golang locked and limited conversation to collaborators Dec 9, 2021
@rsc rsc moved this to Declined in Proposals Aug 10, 2022
@rsc rsc added this to Proposals Aug 10, 2022
@rsc rsc removed this from Proposals Oct 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants