Expand description
Externref payloads for submilli:fs open resources.
Each payload owns its OS handle plus a clone of TenantLimits.host_attached_bytes
(via [ByteCharge]); it charges the in-process buffer footprint at creation and
refunds it when wasmtime GC reclaims the externref.
Readers close() eagerly: the OS handle is dropped (freeing the fd immediately) and
the bytes refunded; Drop is the safety net for a reader that was never closed.
A ChargedFileWriter’s explicit close() performs the atomic temp→final rename;
its Drop only flushes and removes the temp file, because a GC-timed rename() would
be non-deterministic.
Structs§
- Charged
Byte Reader - Fixed-size chunk iterator over a file.
- Charged
DirIter - Directory walker (flat or recursive).
- Charged
File Writer - Buffered writer to a temp sibling file. Explicit
closefsyncs and atomically renames it ontofinal_path;Drop(the safety net for an un-closed writer) discards the temp file without renaming, removing it only while its name still refers to the writer’s file. - Charged
Line - Keeps returned native text charged until the caller finishes marshalling it.
- Charged
Line Reader - Line iterator over a file.
close()andDropboth free the fd and refund bytes. - Contained
Walk - Directory walker (flat or recursive), rooted at a contained handle.
- Temp
File - The temp file a writer streams into. The program can reach it by name while the writer is open, so before committing or discarding it, the writer checks that the name still refers to the file it created.
- Walk
Entry - One directory entry as the guest sees it. Guest-relative path included, because the walk knows it — deriving it afterwards by stripping a host prefix is what leaked host paths into responses.
Enums§
- Write
Error - Why a write through a
ChargedFileWriterfailed.
Traits§
- Closable
- An iterator handle with an idempotent eager close — what the shared
for…ofclose path calls on any of the three reader kinds.