nx_seed_bank.nx
buildroot/runtime/nx_seed_bank.nx
about
nx_seed_bank.nx -- multi-genotype cold-storage backup substrate.
Biology: a seed bank (Svalbard Global Seed Vault, Millennium Seed Bank,
indigenous community seed banks) preserves GENETIC DIVERSITY in dormant
form across decades-to-centuries. Each accession is content-addressed,
labeled with provenance, and can be retrieved + germinated when needed
to restore a lost cultivar / population. Diversity is the load-bearing
property: a monoculture seed bank is a single point of failure.
In Nishi: persistent cold storage of substrate genotype snapshots
(config + schema + seed primitives) so a damaged installation can be
restored to known-green from a chosen accession. Composes with
[[nx_seed]] (the seed primitive is what gets stored), [[nx_prune]] +
[[nx_regenerate]] (prune-rebuild reads from seed bank), [[feedback-
thymus-sovereignty-audit-soma-germline]] (only germline accessions
preserved; soma is regenerable from germline), [[feedback-end-to-end-
bit-traceability-architecture]] (every accession is content-addressed +
provenance-stamped).
V1 ships sealed accession-kind enum + provenance-stamped record +
retrieval + diversity audit (HHI-style monoculture detector).
dependencies 2 imports · 1 importers
imports: nx_syscalls.nxnx_tier.nx
imported by: nx_seed_bank_test.nx
structs
| 58 | struct NxAccession |
| 71 | struct NxSeedBank |
consts
| 25 | const NX_MAGIC_1024: i64 = 1024 |
| 29 | const NX_SB_KIND_FULL_GENOTYPE: nx_int = 0 // complete germline snapshot |
| 30 | const NX_SB_KIND_CONFIG_ONLY: nx_int = 1 // operator preferences |
| 31 | const NX_SB_KIND_SCHEMA_ONLY: nx_int = 2 // data layout |
| 32 | const NX_SB_KIND_KEY_MATERIAL: nx_int = 3 // sovereign keys (encrypted) |
| 33 | const NX_SB_KIND_FAMILY_CORPUS: nx_int = 4 // family-generated content |
| 34 | const NX_SB_KIND_TEK_ARCHIVE: nx_int = 5 // traditional knowledge |
| 35 | const NX_SB_KIND_HEIRLOOM_CULTIVAR: nx_int = 6 // cultural/family heritage data |
| 36 | const NX_SB_KIND_N: nx_int = 7 |
| 40 | const NX_SB_STATUS_DORMANT: nx_int = 0 |
| 41 | const NX_SB_STATUS_VERIFIED: nx_int = 1 // hash + signature checked |
| 42 | const NX_SB_STATUS_RETRIEVED: nx_int = 2 |
| 43 | const NX_SB_STATUS_CORRUPTED: nx_int = 3 // hash mismatch on verify |
| 44 | const NX_SB_STATUS_N: nx_int = 4 |
| 48 | const NX_SB_V_OK: nx_int = 0 |
| 49 | const NX_SB_V_OK_HEALTHY_DIVERSITY: nx_int = 1 |
| 50 | const NX_SB_V_MONOCULTURE_WARNING: nx_int = 2 // HHI too concentrated |
| 51 | const NX_SB_V_CORRUPTION_DETECTED: nx_int = 3 |
| 52 | const NX_SB_V_INVALID: nx_int = 4 |
| 53 | const NX_SB_V_NULL: nx_int = 5 |
| 54 | const NX_SB_V_N: nx_int = 6 |
| 69 | const NX_SB_A_BYTES: nx_int = 64 |
| 80 | const NX_SB_BYTES: nx_int = 48 |
functions
| 84 | func nx_sb_kind_is_valid(k: nx_int) -> nx_int |
| 90 | func nx_sb_status_is_valid(s: nx_int) -> nx_int called by 1: main |
| 96 | func nx_sb_v_is_valid(v: nx_int) -> nx_int called by 1: main |
| 104 | func nx_sb_new(capacity: nx_int, |
| 121 | func _sb_acc_at(b: *NxSeedBank, idx: nx_int) -> *NxAccession |
| 130 | func nx_sb_store(b: *NxSeedBank, |
| 155 | func nx_sb_find(b: *NxSeedBank, accession_id: nx_int) -> *NxAccession |
| 168 | func nx_sb_verify(b: *NxSeedBank, |
| 186 | func nx_sb_retrieve(b: *NxSeedBank, |
| 199 | func nx_sb_count_by_kind(b: *NxSeedBank, kind: nx_int) -> nx_int |
| 211 | func nx_sb_count_by_status(b: *NxSeedBank, status: nx_int) -> nx_int |
| 227 | func nx_sb_audit_diversity(b: *NxSeedBank) -> nx_int |
| 246 | func nx_sb_total_bytes(b: *NxSeedBank) -> nx_size |