code wiki / (root) / nx_pushback_lib.nx

nx_pushback_lib.nx

buildroot/runtime/nx_pushback_lib.nx

19890 B408 linesdepth 8pulls 26 transitivereach 2 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_pushback_lib.nx -- COMMUNITY PUSH-BACK WITH LICENCE, PROVENANCE AND THE REFEREE GRADE ATTACHED (/compare/modding MD23 pushback_publish, 2026-09-06). Our own models go back to the communities as ONE bundle per community target: the sovereign mod manifest (nx_mod_manifest_lib, MD18) copied byte-for-byte, the package archived by the estate's own 7z writer (nx_sevenz_lib sz_write_copy, MD29), the content id, magnet, download url and index row from the ONE transport addresser (nx_dist_publish), and a publish row carrying the licence row, the member count, the manifest and archive digests and the referee grade. Every door this lib composes is fail-closed and it adds no second ruler: the manifest must VERIFY against the files as they are (mm_verify), the package licence is re-read from the ONE rights table (a hand-edited id is refused LICENCE-UNKNOWN), every journaled member is re-asked from the ONE asset journal at publish time (a rip whose licence class is unknown is refused PROVENANCE by name -- the rung's own words), the community's redistribution floor is applied to the package and to every journaled member, and an UNGRADED package never publishes (the operator's law: presence is not completion; a push-back without a referee grade is a poorly-done cut shipped to strangers). The community targets are DATA (knowledge/modding_communities.conf); the same manifest bytes land in every bundle, which is the invariant the gate proves. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 4 imports · 2 importers

nx_syscalls.nx nx_mod_manifest_lib.nx nx_sevenz_lib.nx nx_dist_publish.nx nx_pushback_lib.nx nx_pushback_publish.nx nx_pushback_publish_gate.nx

imports: nx_syscalls.nxnx_mod_manifest_lib.nxnx_sevenz_lib.nxnx_dist_publish.nx

imported by: nx_pushback_publish.nxnx_pushback_publish_gate.nx

structs

none

consts

19const PB_CONF_DEFAULT: *u8 = "knowledge/modding_communities.conf"
20const PB_GRADE_DEFAULT_NAME: *u8 = "referee.grade"
21const PB_OUTDIR_DEFAULT_NAME: *u8 = "pushback"
22const PB_TAG: *u8 = "community"
23const PB_GRADE_TAG: *u8 = "grade"
24const PB_KIND_DIST_S: *u8 = "dist"
25const PB_KIND_APIDESC_S: *u8 = "api-desc"
26const PB_MANIFEST_EXT: *u8 = ".nxmod"
27const PB_ARCHIVE_EXT: *u8 = ".7z"
28const PB_INDEX_FILE: *u8 = "index.row"
29const PB_ROW_FILE: *u8 = "publish.row"
30const PB_TRANSPORT_DIST: *u8 = "dist-index"
31const PB_TRANSPORT_DESC: *u8 = "descriptor-awaiting-keyed-door"
32const PB_DASH_S: *u8 = "-"
33const PB_SEP: i64 = 124
34const PB_NL: i64 = 10
35const PB_HASH: i64 = 35
36const PB_DASH: i64 = 45
37const PB_SLASH: i64 = 47
38const PB_DIR_MODE: i64 = 493
39const PB_FILE_MODE: i64 = 420
40const PB_PATH_CAP: i64 = 1024
41const PB_ROW_CAP: i64 = 8192
42const PB_ARCHIVE_SLACK: i64 = 4096
43const PB_PER_MEMBER_SLACK: i64 = 512
44const PB_PERMIL_MAX: i64 = 1000
45const PB_MAX_COMMUNITIES: i64 = 64
46const PB_MAX_IDS: i64 = 64
48const PB_C_ID: i64 = 0
49const PB_C_KIND: i64 = 1
50const PB_C_ENDPOINT: i64 = 2
51const PB_C_MINREDIST: i64 = 3
52const PB_C_NOTE: i64 = 4
53const PB_C_SLOTS: i64 = 6
54const PB_KIND_UNKNOWN: i64 = 0
55const PB_KIND_DIST: i64 = 1
56const PB_KIND_APIDESC: i64 = 2
58const PB_OK: i64 = 0
59const PB_ERR_CONF_UNREADABLE: i64 = 0 - 1
60const PB_ERR_NO_SUCH_COMMUNITY: i64 = 0 - 2
61const PB_ERR_MANIFEST_UNREADABLE: i64 = 0 - 3
62const PB_ERR_MANIFEST_REFUSED: i64 = 0 - 4
63const PB_ERR_LICENCE_UNKNOWN: i64 = 0 - 5
64const PB_ERR_NON_REDISTRIBUTABLE: i64 = 0 - 6
65const PB_ERR_PROVENANCE: i64 = 0 - 7
66const PB_ERR_UNGRADED: i64 = 0 - 8
67const PB_ERR_OUT_UNWRITABLE: i64 = 0 - 9
68const PB_ERR_ARCHIVE: i64 = 0 - 10
69const PB_ERR_MEMBER_UNREADABLE: i64 = 0 - 11
70const PB_ERR_TABLE_UNREADABLE: i64 = 0 - 12
71const PB_ERR_KIND_UNKNOWN: i64 = 0 - 13
73const PB_R_RC: i64 = 0
74const PB_R_KIND: i64 = 1
75const PB_R_ARCHIVE_BYTES: i64 = 2
76const PB_R_CID: i64 = 3 // *u8 65
77const PB_R_MANIFEST_SHA: i64 = 4 // *u8 65, hashed from the WRITTEN copy
78const PB_R_OUTDIR: i64 = 5 // *u8 the bundle directory
79const PB_R_MEMBER_IDX: i64 = 6 // the member that refused, or -1
80const PB_R_REASON: i64 = 7 // the pv reason, the mm verdict, or the redist level that fell below the floor
81const PB_R_N: i64 = 8
83const PB_G_PERMIL: i64 = 0
84const PB_G_JUDGE: i64 = 1
85const PB_G_DATE: i64 = 2
86const PB_G_N: i64 = 4
88const PB_S_REQUESTED: i64 = 0
89const PB_S_PUBLISHED: i64 = 1
90const PB_S_REFUSED: i64 = 2
91const PB_S_IDENTICAL: i64 = 3
92const PB_S_RC: i64 = 4
93const PB_S_CONF_ROWS: i64 = 5
94const PB_S_MEMBERS: i64 = 6
95const PB_S_PERMIL: i64 = 7
96const PB_S_N: i64 = 8

functions

98func pb_write_file(path: *u8, b: *u8, n: i64) -> i64
106func pb_sep(row: *u8, o: i64) -> i64 { row[o] = PB_SEP as u8; return o + 1 }
called by 1: pb_publish_one
107func pb_kind_code(s: *u8) -> i64
called by 1: pb_publish_one calls 1: mm_streq
112func pb_kind_name(k: i64) -> *u8
called by 1: main
117func pb_transport_name(k: i64) -> *u8
called by 2: pb_publish_onemain
121func pb_err_name(rc: i64) -> *u8
called by 1: main
139func pb_conf_load(path: *u8, tbl: *i64, cap: i64) -> i64
169func pb_find(tbl: *i64, n: i64, id: *u8) -> i64
called by 1: pb_publish calls 1: mm_streq
175func pb_grade_read(path: *u8, g: *i64) -> i64
208func pb_publish_one(root: *u8, mb: *u8, mn: i64, m: *i64, crow: *i64, outdir: *u8, g: *i64, jrnl: *u8, r: *i64) -> i64
350func pb_publish(root: *u8, mpath: *u8, ids_csv: *u8, outdir: *u8, gradepath: *u8, confpath: *u8, jrnl: *u8, sum: *i64, rows: *i64) -> i64
406func pushback_publish(root: *u8, mpath: *u8, ids_csv: *u8, outdir: *u8, gradepath: *u8, confpath: *u8, jrnl: *u8, sum: *i64, rows: *i64) -> i64
called by 1: main calls 1: pb_publish