code wiki / _hdl_build / nx_capreg_librarian.nx

nx_capreg_librarian.nx

buildroot/runtime/_hdl_build/nx_capreg_librarian.nx

13009 B284 linesdepth 3pulls 3 transitivereach 124 importersview sourcekind librarytopic capreg
docsdependenciesstructsconstsfunctions

about

nx_capreg_librarian.nx -- the LIBRARIAN's registry survival + collision repair (operator-flagged debt: "CAPREG index collision needs the Librarian dedup / atomic allocation fix" -- and the command-prompt crash that wiped /tmp PROVED the durability gap: the live registry died, only the NTFS journal at knowledge/status/cap_registry_durable.log survived). Three capabilities, one module: 1. REGEN -- cl_regen(journal, live): rebuild the clean live registry FROM the append-only journal. Byte-identical re-snapshot copies dedup away; TRUE collisions (same idx, different capability -- the two-parallel-sessions bug at idx 212-227) are RENUMBERED past the global max with an explicit `remapped_from=` marker (additive: history preserved, nothing deleted, the journal untouched). 2. ALLOC -- cl_next_idx(live, journal): max idx across BOTH files + 1. Register modules call this instead of hardcoding an index = the atomic-allocation fix (collisions can't recur in one lane; cross-lane races are repaired by the next regen, which is the backstop by construction). 3. DUAL-WRITE -- cl_register_dual(...): every registration appends to the live registry AND the NTFS journal in one call. A /tmp wipe now loses NOTHING (regen restores live from journal). RACI: the LIBRARIAN owns this (GATHER/REGISTER verb -- the registry is the gathered source the self-model regenerates from). LAWS: struct-free, integer-only, flat ifs. license_tier: ORIGINAL

dependencies 2 imports · 122 importers

nx_syscalls.nx nx_itoa_lib.nx nx_capreg_librarian.nx _cl_probe.nx _cl_probe2.nx _race5_register.nx _race6_register.nx nx_abmk_register.nx nx_analyst_growth_register.nx nx_analyst_register.nx nx_ark_register.nx nx_atan_register.nx nx_attempt_loop_register.nx

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

imports: nx_syscalls.nxnx_itoa_lib.nx

imported by: _cl_probe.nx_cl_probe2.nx_race5_register.nx_race6_register.nxnx_abmk_register.nxnx_analyst_growth_register.nxnx_analyst_register.nxnx_ark_register.nxnx_atan_register.nxnx_attempt_loop_register.nxnx_audit_heal_register.nxnx_autmeter_register.nxnx_auto_builder_register.nxnx_autonomy_expand.nxnx_autonomy_grow.nxnx_autonomy_grow_loop.nxnx_autonomy_selfgrow.nxnx_beat_wiring_register.nxnx_bigfloat_register.nxnx_bip39_register.nxnx_bpe_vocab_register.nxnx_capreg_health.nxnx_capreg_health_register.nxnx_capreg_librarian_test.nxnx_capreg_restore.nxnx_census_register.nxnx_classifier_sync_register.nxnx_cms_rungs_register.nxnx_cms_team_register.nxnx_cms_w2345_register.nxnx_cms_wp_register.nxnx_cohesion_register.nxnx_content_measure_register.nxnx_cr5_register.nxnx_diff_cmp_register.nxnx_diff_gen_register.nxnx_discovery_register.nxnx_dispatch_register.nxnx_erf_register.nxnx_evo_synth_register.nxnx_f64_exp_register.nxnx_f64_register.nxnx_gamma_oracle_register.nxnx_gamma_register.nxnx_gateemit_register.nxnx_hash_opt_register.nxnx_heartbeat_register.nxnx_infomgmt_im2c_register.nxnx_infomgmt_im6c_register.nxnx_infomgmt_im7_race_register.nxnx_infomgmt_imar_register.nxnx_intent_register.nxnx_lane_register.nxnx_lane_rename_register.nxnx_ledger_data_register.nxnx_magicnum_detector_register.nxnx_markmig_register.nxnx_math_arc_register.nxnx_ncf_scaffold_register.nxnx_neutrality_register.nxnx_nollm_synth_register.nxnx_nv1_lpc_register.nxnx_nv1d_register.nxnx_opaque_kat_register.nxnx_pattern_classify_register.nxnx_pattern_emit10_register.nxnx_pattern_emit11_register.nxnx_pattern_emit13_register.nxnx_pattern_emit4_register.nxnx_pattern_emit5_register.nxnx_pattern_emit7_register.nxnx_pattern_emit89_register.nxnx_pow_register.nxnx_procgen_p23_register.nxnx_procgen_p4_register.nxnx_procgen_struct_register.nxnx_queue_store_register.nxnx_race_harness_register.nxnx_reconcile_register.nxnx_revive_register.nxnx_room_perf_register.nxnx_rungrade_register.nxnx_rungrun_register.nxnx_secret_rotation_register.nxnx_secret_selfmanage_register.nxnx_selfloop_register.nxnx_session_0611b_register.nxnx_session_0612_register.nxnx_sincos_register.nxnx_sinhcosh_register.nxnx_source_grade_register.nxnx_spec_route_register.nxnx_sponsor_loop_register.nxnx_sreach_r2_register.nxnx_sreach_scorecard_register.nxnx_t2lm_register.nxnx_t4_model_register.nxnx_t4b_ce_register.nxnx_tan_register.nxnx_team_chain_register.nx +22 more (shown cap 100 declared)

structs

none

consts

18const K_MAGIC_1000000007: i64 = 1000000007
19const K_MAGIC_32768: i64 = 32768

functions

24func cl_rename(oldpath: *u8, newpath: *u8) -> i64
28func cl_w(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 }
33func cl_wn(fd: i64, v: i64) -> i64 { nxi_fd(fd, v); return 0 }
35func cl_cats(dst: *u8, j: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){ dst[j+n]=s[n]; n=n+1 } dst[j+n]=0 as u8; return j+n }
38func cl_is_entry(b: *u8, i: i64, n: i64) -> i64
49func cl_line_end(b: *u8, i: i64, n: i64) -> i64
55func cl_parse_int(b: *u8, i: i64, n: i64) -> i64
69func cl_digits_end(b: *u8, i: i64, n: i64) -> i64
81func cl_hash_range(b: *u8, j: i64, e: i64) -> i64
89func cl_max_idx(path: *u8) -> i64
108func cl_next_idx(livepath: *u8, journalpath: *u8) -> i64
called by 118: mainmainmainmainmainmain+112 calls 1: cl_max_idx
117func cl_register_dual(livepath: *u8, journalpath: *u8, idx: i64, layer: i64, status: i64, name: *u8) -> i64
143func cl_emit_entry(out: i64, b: *u8, i: i64, e: i64, n: i64, st: *i64) -> i64
171func cl_regen(journalpath: *u8, livepath: *u8) -> i64
214func cl_ingest_live(livepath: *u8, journalpath: *u8) -> i64
261func cl_canonicalize(journalpath: *u8, livepath: *u8) -> i64