Skip to main content

Module handles

Module handles 

Source
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§

ChargedByteReader
Fixed-size chunk iterator over a file.
ChargedDirIter
Directory walker (flat or recursive).
ChargedFileWriter
Buffered writer to a temp sibling file. Explicit close fsyncs and atomically renames it onto final_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.
ChargedLine
Keeps returned native text charged until the caller finishes marshalling it.
ChargedLineReader
Line iterator over a file. close() and Drop both free the fd and refund bytes.
ContainedWalk
Directory walker (flat or recursive), rooted at a contained handle.
TempFile
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.
WalkEntry
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§

WriteError
Why a write through a ChargedFileWriter failed.

Traits§

Closable
An iterator handle with an idempotent eager close — what the shared for…of close path calls on any of the three reader kinds.

Functions§

kind_of