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

FilePosition restricts random access to 2GB #37

Open
grmble opened this issue Jan 14, 2018 · 5 comments
Open

FilePosition restricts random access to 2GB #37

grmble opened this issue Jan 14, 2018 · 5 comments
Labels
type: breaking change A change that requires a major version bump.

Comments

@grmble
Copy link

grmble commented Jan 14, 2018

FilePosition is a newtyped Int, so there is no random access > 2G with the purscript API.

Node.js can do this just fine - node.js numbers are safe to use as integers up to 53 bits.

Making FilePosition a Number would work but I don't like seeing offsets with a decimal point. I used Data.Int53 in my workaround module.

It could be argued that buffer lengths, offsets and bytecounts should be Int53s too. But these are all breaking changes and I can live with doing IO in chunks < 2GB.

grmble pushed a commit to grmble/purescript-node-fs that referenced this issue Jan 15, 2018
grmble pushed a commit to grmble/purescript-node-fs that referenced this issue Jan 16, 2018
grmble pushed a commit to grmble/purescript-node-fs that referenced this issue Jan 16, 2018
grmble pushed a commit to grmble/purescript-node-fs that referenced this issue Jan 17, 2018
grmble pushed a commit to grmble/purescript-node-fs that referenced this issue Jan 17, 2018
@grmble
Copy link
Author

grmble commented Jan 23, 2018

Pull request #38 feels like a clutch.

What I really want is

  • Node.Buffer.Large where all offsets and lengths are Numbers - for mmap
  • Node.Fs.Large where all offsets and lenghts are Numbers and the buffers are large
  • Node.Fs.Large.Aff where all offsets and lengths are Numbers and the bffers are large

All of that either in the existing modules or in new ones.

@hdgarrood
Copy link
Member

Sounds good, but what does 'the buffers are large' mean?

@grmble
Copy link
Author

grmble commented Jan 29, 2018

"buffers are large" = a Buffer from Node.Buffer.Large - i.e. all offsets, lengths and so on are numbers.

The mixed API just makes you convert hither and from all the time, not my idea of fun.

@hdgarrood
Copy link
Member

Ah of course, yes.

@grmble
Copy link
Author

grmble commented Feb 1, 2018

My immediate need for this is gone, but medium term I plan to fork those 3 projects and publish "-large" variants. If somebody else beats me to it, that would be even better; and I'll be happy to hand over the projects to purescript-node or whatever. But I don't think I'll try to land 3 large patches in 3 different projects 😱

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: breaking change A change that requires a major version bump.
Projects
None yet
Development

No branches or pull requests

3 participants