Skip to main content

Module task_media

Module task_media 

Source
Expand description

The files a Kanban task carries, on disk (docs/specs/SPEC_KANBAN_TASK_MEDIA_2026_10_25.md §3.2, §3.3).

<shared>/task-media/ab/<sha256>.<ext>        the file, named by its content
<shared>/task-media/ab/<sha256>.thumb.png    a 256 px thumbnail of an image
<shared>/task-media/incoming/<uuid>.part     an upload in flight

It is in the shared home, not a channel’s data dir, because the tasks are shared by every channel. It is not the attachments store: that store sweeps files by last use, and a picture the operator has not looked at yet must stay. What a task carries is in storage/work_media.rs.

Structs§

Sniff
What a file is, by its content.

Constants§

MAX_FILES_PER_CALL
The most files in one call.
MAX_IMAGE_BYTES
The largest image and recording.
MAX_RECORDING_BYTES

Functions§

blob_path
Where the file with this content is (or would be). None for a hash that isn’t one: it can never carry a separator into a path.
commit
Move an upload to the place its content names, unless the same content is already there. An image also gets its thumbnail (a failure to make one is not the upload’s: the card falls back to the file).
default_root
The folder this srv uses, in step with its work store (see root_beside).
ext_of_mime
The extension a stored file of this MIME type has.
max_bytes
The largest a file of this kind can be.
new_incoming_path
A new path for an upload in flight.
read_head
Read the first bytes of a file, enough to sniff it.
remove_content
Remove the file with this content and its thumbnail. Returns whether a file went.
root_beside
Where the folder is, given where the work store is: beside a work store this channel has to itself (a task dev build’s), else in the shared home with the store every channel shares. The sweep deletes what its own store does not name, so two stores must never share one folder.
sniff
What the first bytes of a file say it is, if it is one the Kanban accepts: PNG, JPEG, GIF, WebP, SVG, MP4, MOV, WebM. Never by the name.
sweep
Clear what is left behind: uploads that never finished, and stored files no task names (named says whether one does) once they are an hour old, so an upload waiting to be attached is not lost. Returns how many files went.
thumb_path
Where an image’s thumbnail is (or would be).