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

Re-implement download session to restore bounded memory usage #271

Closed
wants to merge 16 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Jan 24, 2018

Most likely upgrading from haskell compiler 7.10.3 to 8 introduced a change in behavior that broke an optimization that our homegrown zip generation logic relied upon

Use third party libraries to generate zip files in memory for download session, restoring the same or better memory behavior as old version of code. zip-stream appears to be one of the only libraries that offer this functionality. (There is also an in progress implementation of the feature for zip here - mrkkrp/zip#20)

https://github.com/databrary/databrary/pull/269/files

kanishka added 15 commits January 23, 2018 19:51
- zip-stream is core library that implements creating a zip file in memory
- conduit-combinators provides some helper functions to connect zip-stream with our web application
- blaze-builder provides some helper functions for connecting as well
- duplicate, simplify logic from wai-conduit to use responseStream send with conduit source
- create an instance of ResponseData for conduit source
… meta data

- zipResponse2 will now build a flat set of entries (instead of nested) to match
parameter types of zip-stream library
- disable estimating zip size for now
- build a stream and allow wai to serve it
- generate zips with no compression (directory packing only), and allow large files
- accept list of entry/data pairs to properly match zip-stream interface
- as before create a directory entry corresponding to the container (session)
- directory entry currently does not include link comment as before
- contents of zip directory entry is empty, as required by zip format
- introduce utility for creating zipentry
…till work

- volume zip and container zip shared a function, use the newer function only in container zip
- for now, generating assets with a name, size, and content, no comment yet
- note: empty directory with no assets was causing zip failure
- try sending only asset entries, no directory entry
- bad content-length of 0 was causing error
- new library requires full path to generate proper folders in zip
- timestamp uses current time converted to utc
- can't add comments like before because zip-stream doesn't support them
@ghost
Copy link
Author

ghost commented Jan 25, 2018

If regression tests pass, remove dead code and merge.

@ghost ghost closed this Jan 25, 2018
- size computed was probably wrong, regardless only skipping the content-length header works, only works on linux chrome
@ghost
Copy link
Author

ghost commented Jan 25, 2018

Working partially, hit dead-end for now. Switching to alternative library.

@ghost ghost reopened this Jan 25, 2018
@ghost ghost closed this Jan 25, 2018
@ghost ghost deleted the kanishka-dbd659 branch January 25, 2018 22:20
This pull request was closed.
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 this pull request may close these issues.

None yet

0 participants