nx_torrent_reseed.nx
buildroot/runtime/nx_torrent_reseed.nx
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
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
structs
| none |
consts
| 11 | const K_MAGIC_1024: i64 = 1024 |
| 12 | const K_MAGIC_65536: i64 = 65536 |
| 13 | const K_MAGIC_65535: i64 = 65535 |
| 14 | const K_MAGIC_1048576: i64 = 1048576 |
| 15 | const K_MAGIC_1048575: i64 = 1048575 |
| 16 | const K_MAGIC_1200: i64 = 1200 |
| 17 | const K_MAGIC_262144: i64 = 262144 |
| 18 | const K_MAGIC_2048: i64 = 2048 |
functions
| 20 | func 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 } |
| 21 | func 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 } |
| 22 | func 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 |
| 23 | func 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 } |
| 24 | func rs_read(path: *u8, buf: *u8, cap: i64) -> i64 |
| 30 | func rs_has(hay: *u8, hlen: i64, ndl: *u8, nlen: i64) -> i64 called by 1: main |
| 35 | func main(argc: i64, argv: *i64) -> i64 |