guardrail-dev / guardrail-dev/guardrail

Switch akka-http to just exposing a stream for file uploads instead of buffering to disk

Open
#1,308 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Scala
Stars
541
Forks
138
PR merge metrics
No merged PRs in 30d

Description

Semantics need to be addressed, but:

- http4s and dropwizard both do streaming file uploads, not disk-backed
- multi-file uploads for a single endpoint are rare use cases, maybe can be supported through special opt-in
- mandated, per-route file handling methods are cumbersome

One issue is that if files are not the final element in the payload, (multipart form-data, for instance), we will run into a situation where we cannot call the application code before the stream has been consumed. Currently this is handled by filesystem-backed buffer, so an attempt to change this without a transition period will cause currently functional requests to start failing. This should be handled delicately, either by an option with a deprecation cycle, at the very least migration notes that go along with the new function signatures.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the current filesystem-backed upload handling and the generated function signatures, then compare the streaming behavior described for http4s and Dropwizard. Done means defining the multipart semantics, deciding how non-final file parts and multi-file endpoints are handled, and documenting a safe option or deprecation and migration path.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.