about summary refs log tree commit diff
path: root/kittybox-rs/src/media/storage
Commit message (Collapse)AuthorAgeFilesLines
* tempfile -> tempdir, remove mockitoVika2023-02-271-2/+2
|
* media: get rid of an extraneous Arc over BytesVika2022-11-071-5/+9
| | | | | Bytes buffers are already reference-counted and cheaply clonable; there is no need to wrap them further.
* media: implement file range requests for backendsVika2022-10-142-16/+274
| | | | | | | For now it is not yet exposed on the frontend, but that is merely a matter of time. TODO possibly remove the legacy methods, since they're obsoleted
* media: Use ETag and If-None-MatchVika2022-10-042-2/+9
| | | | | | | | | | | | | | | | | | | | Note: this requires a reindex of the media database. For the default CAS backend, use the following: ```bash for i in */*/*/*/*.json; do etag="$(echo $i | sed -e 's/\///g' -e 's/\.json$//')"; mv "$i" "$i.bak" cat "$i.bak" | jq '. + { "etag": '\""$etag"\"'}' > "$i" rm "$i.bak" done ``` This change is backwards compatible, but caching headers won't be emitted without etags present in the metadata. Actual etags are backend-specific and might differ from backend to backend.
* feat: indieauth supportVika2022-09-191-26/+4
| | | | | | | | | | Working: - Tokens and codes - Authenticating with a password Not working: - Setting the password (need to patch onboarding) - WebAuthn (the JavaScript is too complicated)
* media: improve Metadata typingVika2022-07-212-13/+19
| | | | | | | | | | | | | content_type is now optional; if not specified, it will remain empty. `application/octet-stream` will be put on read in the frontend. Length is now represented as NonZeroUsize - why would you upload a zero-byte file when you can just conjure one from the void whenever you need one? This should save me a little bit of memory. Representing content_type as a typed MIME value would be the next logical step.
* media: fix small files not being saved to disk properlyVika2022-07-191-11/+21
| | | | | It turns out that BufWriter requires calling `flush()` manually and doesn't do it on `drop()`. I forgot about that.
* media: buffer disk I/O and add debug loggingVika2022-07-142-11/+36
| | | | It looks like buffering reads can double my performance. Nice.
* media: fix failing testVika2022-07-101-1/+1
|
* media: media endpoint PoCVika2022-07-102-41/+234
| | | | | | | | | | Supported features: - Streaming upload - Content-addressed storage - Metadata - MIME type (taken from Content-Type) - Length (I could use stat() for this one tho) - filename (for Content-Disposition: attachment, WIP)
* format using rustfmtVika2022-07-072-6/+21
|
* treewide: rewrite using AxumVika2022-07-072-0/+114
Axum has streaming bodies and allows to write simpler code. It also helps enforce stronger types and looks much more neat. This allows me to progress on the media endpoint and add streaming reads and writes to the MediaStore trait. Metrics are temporarily not implemented. Everything else was preserved, and the tests still pass, after adjusting for new calling conventions. TODO: create method routers for protocol endpoints