code wiki / _hdl_build / nx_inventory.nx
nx_inventory.nx
buildroot/runtime/_hdl_build/nx_inventory.nx
about
nx_inventory.nx -- LIB: the UNIVERSAL inventory / supply-chain substrate (operator: "the inventory and other
systems hardware-rung-up to manage any and all supply chains -- cataloging for a will all the things a person
owns, what's in the pantry and when it's expiring, what can I make, meal planning"). ONE domain-agnostic item
store; the pantry, an estate/will asset catalog, and any other supply chain are just different `domain`s over
the same engine (the inventory analogue of the universal builder). Sovereign (seg-store, NO TSV), INTEGER
only (quantities are counts; money is CENTS -- no float), additive (history kept; consume = a new version).
Schema (prefix passed in, e.g. knowledge/store/inv-):
inv:<domain>:ids -> TAB list of item ids in the domain
inv:<domain>:item:<id> -> name <t> category <t> qty <t> unit <t> location <t> value_cents <t> expiry_day <t> owner
(expiry_day = integer day number; 0 = non-perishable. owner = beneficiary for a will, or "" for a pantry.)
license_tier: ORIGINAL
dependencies 3 imports · 9 importers
imports: nx_seg_store.nxnx_ad_serve.nxnx_syscalls.nx
imported by: nx_estate.nxnx_estate_gate.nxnx_household.nxnx_household_gate.nxnx_inventory_gate.nxnx_pantry.nxnx_pantry_meal_gate.nxnx_reorder_gate.nxnx_shopping.nx
structs
| none |
consts
| 16 | const IV_TAB: i64 = 9 |
functions
| 19 | func iv_field(rec: *u8, rlen: i64, f: i64, out: *u8) -> i64 |
| 37 | func iv_atoi(s: *u8, slen: i64) -> i64 |
| 46 | func iv_num(dst: *u8, off: i64, v: i64) -> i64 |
| 58 | func iv_money(dst: *u8, off: i64, cents: i64) -> i64 |
| 69 | func iv_item_key(domain: *u8, id: *u8, out: *u8) -> i64 |
| 78 | func iv_ids_key(domain: *u8, out: *u8) -> i64 |
| 86 | func iv_seg_next(prefix: *u8) -> i64 |
| 92 | func iv_streq_store(prefix: *u8, key: *u8, val: *u8, vlen: i64) -> i64 |
| 104 | func iv_id_in_list(buf: *u8, len: i64, id: *u8) -> i64 |
| 127 | func iv_get(prefix: *u8, domain: *u8, id: *u8, ptrout: *i64, lenout: *i64) -> i64 |
| 133 | func iv_field_of(prefix: *u8, domain: *u8, id: *u8, f: i64, out: *u8) -> i64 |
| 140 | func iv_int_field(prefix: *u8, domain: *u8, id: *u8, f: i64) -> i64 |
| 145 | func iv_qty(prefix: *u8, domain: *u8, id: *u8) -> i64 { return iv_int_field(prefix, domain, id, 2) } |
| 146 | func iv_value(prefix: *u8, domain: *u8, id: *u8) -> i64 { return iv_int_field(prefix, domain, id, 5) } |
| 147 | func iv_expiry(prefix: *u8, domain: *u8, id: *u8) -> i64 { return iv_int_field(prefix, domain, id, 6) } |
| 150 | func iv_add(prefix: *u8, domain: *u8, id: *u8, name: *u8, cat: *u8, qty: i64, unit: *u8, loc: *u8, value: i64, expiry: i64, owner: *u8) -> i64 called by 8: mainhg_stockmainiv_consumemainmain+2 calls 12: sys_mmapas_appendiv_numiv_item_keyiv_streq_storeiv_ids_key+6 |
| 192 | func iv_list(prefix: *u8, domain: *u8, outids: *i64) -> i64 |
| 224 | func iv_value_total(prefix: *u8, domain: *u8) -> i64 |
| 234 | func iv_expiring(prefix: *u8, domain: *u8, as_of: i64, within: i64, outids: *i64) -> i64 |
| 248 | func iv_consume(prefix: *u8, domain: *u8, id: *u8, nconsume: i64) -> i64 |
| 272 | func iv_par_key(domain: *u8, id: *u8, out: *u8) -> i64 |
| 281 | func iv_set_par(prefix: *u8, domain: *u8, id: *u8, par: i64) -> i64 |
| 294 | func iv_get_par(prefix: *u8, domain: *u8, id: *u8) -> i64 |
| 303 | func iv_low_stock(prefix: *u8, domain: *u8, out_ids: *i64, out_need: *i64) -> i64 |