Reserve capacity for regular file artifacts

This commit is contained in:
2026-10-09 00:23:27 +00:00
parent 996295d5c1
commit f1e1a45a05
4 changed files with 146 additions and 6 deletions

View File

@@ -116,10 +116,14 @@ and after opening the file. It copies content into an artifact, records
metadata and an opaque content-equality value, and applies a content-type
fallback.
Regular files are read synchronously in bounded chunks. Cancellation is
checked before opening, before and after every read, and before publishing the
artifact, so a canceled read never publishes partial content. The ordinary
reader does not detach file reads into background goroutines.
Regular files are read synchronously in bounded chunks. The opened file's size
is only an initial-capacity hint, capped at 1 MiB; reads continue to EOF, and
the returned body determines artifact size and hash. If an overreported hint
leaves more than twice the actual body length unused, the completed body is
copied to release the excess backing storage. Cancellation is checked before
opening, before and after every read, and before publishing the artifact, so a
canceled read never publishes partial content. The ordinary reader does not
detach file reads into background goroutines.
This ordinary reader does not implement an inbound HTTP security boundary. In
particular, it does not constrain files to an application root or impose an