milestone 6: dns cache, rate limiting, query logging, disk monitoring and retention

This commit is contained in:
2026-08-01 17:48:12 +02:00
parent 59d94df722
commit 8c50b6617f
13 changed files with 5819 additions and 0 deletions
+22
View File
@@ -195,3 +195,25 @@ verification name is an IP literal (DoT `tls://1.1.1.1:853`) always fails with
as an iPAddress SAN — which is how Cloudflare and Quad9 issue theirs. A DoT
upstream therefore needs a DNS `tls_name` for SNI + verification while dialing
the IP; verifying by bare IP cannot work on stock 0.16.
## Phase 6 verifications (concurrency, disk, files)
- `std.Io.Queue(Elem)` exists (Io.zig:2184): bounded ring buffer over a caller-supplied array.
`put(q, io, elems, min)` with `min = 0` never blocks and returns 0 when full (Io.zig:2218);
`getOne` blocks until an item or `error.Closed` after `close(io)`. Elements are copied as raw
bytes (`@ptrCast`, Io.zig:2189) — an element holding a slice transfers only the pointer, so
queue elements must be self-contained values.
- `std.Io.Condition` has NO `timedWait` (Io.zig:1653 — wait/waitUncancelable/signal/broadcast
only). The timed primitive is `std.Io.Event.waitTimeout` (Io.zig:1827).
- Disk free space: std has NO statvfs/statfs wrapper (no Statfs struct, no `f_bavail` anywhere in
lib/std). Options: `extern fn statvfs` against libc (we always link libc for sqlite) or raw
`std.os.linux.syscall2(.statfs, ...)` with a hand-written struct.
- File append mode does not exist on `Dir.OpenFileOptions`/`CreateFileOptions`. Append pattern:
`openFile(io, path, .{ .mode = .write_only })`, `file.writer(io, &buf)`, then
`w.seekTo(try file.length(io))`; the writer is positional. `File.setLength` truncates;
`Dir.rename` + `Dir.deleteFile` rotate. Positional writes do not serialize — one task owns the
log writer.
- No fixed-capacity hash map in std. Bounded cache shape: fixed slot array plus
`StringHashMapUnmanaged(u32)` from key to slot index (`ensureTotalCapacity` once at init);
a CLOCK hand walks the stable slot array, never the map. Any map modification invalidates
live iterators (hash_map.zig:496).