code wiki / (root) / nx_framed_append.nx

nx_framed_append.nx

buildroot/runtime/nx_framed_append.nx

6614 B131 linesdepth 2pulls 2 transitivereach 232 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_framed_append.nx -- WMS-R0: the ATOMIC FRAMED-APPEND collision floor. module: nishi-core.storage.framed_append capability: CORE_COMPUTE (a reusable durability primitive) ROOT CAUSE this closes: status channels (e.g. nx_conductor_notes.nx) emit ONE log record as a SEQUENCE of separate sys_write() calls ("NOTES epoch=" then the number then " weakest_arc=" ...). O_APPEND only makes a SINGLE write() atomic, NOT a sequence -- so two concurrent appenders interleave between those writes and the file gets a TORN line ("NOTES epoch=NOTES epoch=..."). There was no framing primitive anywhere in the substrate. THE FIX (one capability): build the WHOLE record into ONE buffer, terminate it with a single '\n', and emit EXACTLY ONE sys_write() to an O_APPEND fd. Under O_APPEND that single write is atomic by the kernel's guarantee -> concurrent appenders can never interleave -> ZERO torn lines. Length is BOUNDED (cap): an oversized record is REJECTED (-2), never silently truncated or torn. REUSE / lineage: the "one buffer -> one write" discipline + decimal/string buffer assembly are lifted directly from nx_seg_store.nx (ss_writefile single write loop; ss_cat / ss_catn buffer builders). Sovereign: only nx_syscalls. Other organs CALL fa_append/fa_appendz -- a follow-up rung rewrites nx_conductor_notes's multi-write block to a single fa_appendz call. license_tier: ORIGINAL

dependencies 1 imports · 71 importers

nx_syscalls.nx nx_framed_append.nx nx_build_registry_lib.nx nx_cmos_gate.nx nx_cmos_signed_gate.nx nx_collision_watchdog.nx nx_conductor_live.nx nx_conductor_live_wms_gate.nx nx_conductor_notes.nx nx_conductor_notes_migration_gate. nx_discover_loop.nx nx_dispatch_lease.nx

diagram shows first 10 each side; +0 more imports, +61 more importers in the complete lists below.

imports: nx_syscalls.nx

imported by: nx_build_registry_lib.nxnx_cmos_gate.nxnx_cmos_signed_gate.nxnx_collision_watchdog.nxnx_conductor_live.nxnx_conductor_live_wms_gate.nxnx_conductor_notes.nxnx_conductor_notes_migration_gate.nxnx_discover_loop.nxnx_dispatch_lease.nxnx_dispatch_lease_gate.nxnx_emu_testbed_gate.nxnx_evolution_ladder_gate.nxnx_f32_hw_matmul_gate.nxnx_f32_matmul_gate.nxnx_figure_gate.nxnx_framed_append_gate.nxnx_fw_boot_proof_gate.nxnx_fw_capstone_gate.nxnx_fw_capsule_gate.nxnx_fw_real_flash_gate.nxnx_fw_robust_gate.nxnx_fw_safeflash_gate.nxnx_fw_signed_robust_gate.nxnx_fw_uefi_capsule_gate.nxnx_genesis_live_gate.nxnx_genesis_trace_gate.nxnx_heartbeat_monitor.nxnx_heartbeat_registry_gate.nxnx_heartbeat_str.nxnx_maturity_registry.nxnx_node_beacon.nxnx_opaque_login_daemon.nxnx_pipeline_census.nxnx_pipeline_gate.nxnx_pipeline_run.nxnx_pipeline_spine.nxnx_pub_recover.nxnx_pub_ship.nxnx_publisher.nxnx_receipt.nxnx_research_journal.nxnx_research_journal_gate.nxnx_role_scorecard.nxnx_seat_drive.nxnx_supervised_dispatch.nxnx_supervised_dispatch_gate.nxnx_supervised_dispatch_tamper.nxnx_supervised_dispatch_tamper_gate.nxnx_swarm_beat.nxnx_swarm_gpu.nxnx_swarm_lib.nxnx_swarm_place.nxnx_system_triage.nxnx_tex_gate.nxnx_wiki_exceed_gate.nxnx_wiki_walk_gate.nxnx_worklog_lib.nxnx_workstream_popqueue.nxnx_ws_board.nxnx_ws_board_gate.nxnx_ws_board_html.nxnx_ws_board_html_gate.nxnx_ws_board_live_gate.nxnx_ws_cas_gate.nxnx_ws_crash_gate.nxnx_ws_discover_gate.nxnx_ws_exceed_gate.nxnx_ws_ingest.nxnx_ws_ledger.nxnx_ws_repair_gate.nx

structs

none

consts

none

functions

28func fa_len(s: *u8) -> i64
36func fa_cat(dst: *u8, off: i64, s: *u8) -> i64
43func fa_catn(dst: *u8, off: i64, v: i64) -> i64
66func fa_write_all(fd: i64, buf: *u8, total: i64) -> i64
99func fa_append(path: *u8, rec: *u8, rec_len: i64, cap: i64) -> i64
129func fa_appendz(path: *u8, rec: *u8, cap: i64) -> i64