code wiki / (root) / nx_torrent_reseed.nx

nx_torrent_reseed.nx

buildroot/runtime/nx_torrent_reseed.nx

7946 B102 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tooltopic torrent
docsdependenciesstructsconstsfunctions

about

nx_torrent_reseed.nx -- register EVERY completed download in an area into the seeder registry so we SHARE our whole library back (not just torrents that complete while a worker happens to be running). For each dir in <area>/torrents.idx: if done>=npc (complete), info_hash = SHA1(download.meta) [the cached info-dict, so its SHA1 IS the info_hash], plen from download.npc, total = download.part FILE SIZE, name = the dir name -> idempotent append to the registry. Read-only except the append. Complements the worker's in-session tg_autoseed (which only fires on live completion; autoresume skips already-complete downloads). argv[1] = area outdir (e.g. /volume1/ai/torrent/media), argv[2] = seed registry path. license_tier: ORIGINAL module: nishi-core.torrent.reseed depends: syscalls, sha1

dependencies 2 imports · 0 importers

nx_syscalls.nx nx_sha1.nx nx_torrent_reseed.nx

imports: nx_syscalls.nxnx_sha1.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main rs_puts sys_write sys_exit sys_mmap rs_cat rs_read sys_openat_rd sys_read sys_close sha1 sys_mmap ↻ sha1_process_block if_ge sys_openat_rd ↻ sys_lseek sys_close ↻ rs_has rs_itoa sys_mmap ↻ sys_write ↻ rs_putn sys_mmap ↻ sys_write ↻

structs

none

consts

11const K_MAGIC_1024: i64 = 1024
12const K_MAGIC_65536: i64 = 65536
13const K_MAGIC_65535: i64 = 65535
14const K_MAGIC_1048576: i64 = 1048576
15const K_MAGIC_1048575: i64 = 1048575
16const K_MAGIC_1200: i64 = 1200
17const K_MAGIC_262144: i64 = 262144
18const K_MAGIC_2048: i64 = 2048

functions

20func rs_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main calls 1: sys_write
21func rs_putn(v: i64) -> i64 { let t: *u8=sys_mmap(28); var m: i64=v; var k: i64=0; if m==0 {t[0]=48 as u8;k=1} while m>0 {t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} let o: *u8=sys_mmap(28); var i: i64=0; while i<k {o[i]=t[k-1-i];i=i+1} sys_write(1,o,k); return 0 }
called by 1: main calls 2: sys_mmapsys_write
22func rs_cat(dst: *u8, o: i64, s: *u8) -> i64 { var i: i64=0; while s[i]!=(0 as u8){dst[o]=s[i];o=o+1;i=i+1} return o }
called by 1: main
23func rs_itoa(v: i64, out: *u8) -> i64 { let t: *u8=sys_mmap(28); var m: i64=v; var k: i64=0; if m==0 {t[0]=48 as u8;k=1} while m>0 {t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i: i64=0; while i<k {out[i]=t[k-1-i];i=i+1} return k }
called by 1: main calls 1: sys_mmap
24func rs_read(path: *u8, buf: *u8, cap: i64) -> i64
called by 1: main calls 3: sys_openat_rdsys_readsys_close
30func rs_has(hay: *u8, hlen: i64, ndl: *u8, nlen: i64) -> i64
called by 1: main
35func main(argc: i64, argv: *i64) -> i64