Skip to content

Rust conversion - #10

Merged
Eraxty merged 4 commits into
Eraxty:Rustfrom
Appz4Fun:rust
Oct 6, 2026
Merged

Eraxty merged 4 commits into
Eraxty:Rustfrom
Appz4Fun:rust

Conversation

@xbmc4lyfe

Copy link
Copy Markdown

Check here for optimization: Appz4Fun#1

This is a lot faster.

xbmc4lyfe and others added 4 commits October 3, 2026 18:07
Replace the Python app (main.py, bg_indexer.py, src/*.py) with a single
Rust binary. Same features and data formats: an existing atlas.db and
config.json keep working.

- NNTP client on tokio + rustls with per-server connection pools,
  XFEATURE COMPRESS GZIP, and failover across servers
- usenet_servers in config.json: every server indexes at once (groups
  spread by connections, cursors kept per server), with `index: false`
  for article-only/block accounts; fill servers that reject GROUP are
  detected automatically and connection limits adapt to what the
  provider allows
- background indexer as an async scheduler: many groups in parallel,
  XOVER slices streamed and saved as they arrive, live config reload
- Newznab API answers search/tvsearch/movie/music/book plus caps/get,
  listens on api_host; release names (incl. par2/nfo names) are in the
  FTS index so searches stay fast on large databases
- subject parser kept identical to the Python one (parity test)
- Docker files under docker/ (PUID/PGID aware entrypoint), CI for
  Linux/macOS/Windows, justfile, Rust 1.99 toolchain
- tests: unit, python parser parity, mock NNTP end to end (failover,
  parallel groups, compression, provider quirks)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- rewrite around the Rust version: install with rustup/just, binaries
  from tagged releases, data compatible with the Python version
- full config.json reference: usenet_servers (host, login, port, ssl,
  connections, priority, index, compress), indexing settings
  (batch_size, request_size, parallel_groups), api_host/api_port/api_key,
  live reload, provider quirks, measuring connection limits
- Newznab API: tvsearch/movie/music/book, id-only searches, errors,
  Prowlarr / NZBHydra2 setup
- Docker files under docker/, PUID/PGID, env vars, SABnzbd now optional
- development: just recipes, CI, source layout
- add .env.example (loaded by the justfile); selftest help mentions
  every server

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Storage
- Releases and articles move out of atlas.db into 8 shard files
  (atlas.s0.db .. atlas.s7.db) split by group, each with its own writer
  thread. atlas.db keeps the group cursors and the release id counter.
  Release ids are seq * 8 + shard: still newest first across shards, and
  an id says which shard holds it.
- Compact article layout: one files row per file (the subject the NZB
  uses plus the part bitmap), one segments row per article keyed
  (file, message-id) in a WITHOUT ROWID table. About a quarter of the
  space; NZBs come out byte for byte the same.
- Message-id domains shared by 3+ articles go in a dictionary, made up
  per-article domains are stored whole. Saving checks both forms so an
  article is never stored twice.
- Searches run across all shards in one query (or the group's shard).
- One time conversion of an existing database when the indexer starts
  (or atlas --convert): parallel readers, staging table sorted into
  place, an NZB/stats check against the old database before the swap,
  resumable at the check, old file kept as atlas.old.db.
- atlas --compact rewrites the shards smaller (drops single use domains
  and free space), checking each copy before it replaces the original.
- Bundled SQLite built without its process wide memory and page cache
  locks (LIBSQLITE3_FLAGS), which serialized the writer threads.
- WAL handled by the writers between transactions instead of blocking
  truncate checkpoints that stalled writing for ~20s at a time.

Measured on a 512GB database: 138.5GB after conversion and compaction,
indexing at ~111k headers/s vs ~41k before.

Stats dashboard (menu 8)
- Overview, Backfill, Content, Servers and Bottleneck pages: CPU, RAM,
  headers/s graph, backfill progress and ETA, posting rates and history,
  file type and NZB counts, per server traffic, and what limits indexing
  right now (writers, connections, CPU) from always on load counters.
- Live dashboard graphs headers/s from 10s rate bins.

Indexer
- Stopping drops requests still in flight (their connections are
  discarded, cursors dont move) instead of waiting for a stuck reply.
- Per group article ranges and dated ends recorded for the dashboard.

Also: proof of concept benchmarks (poc_sqlite_1, poc_sqlite_2,
examples/bench_writes.rs), tests for conversion, compaction, shards and
stopping, README updates with TUI screenshots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ds, sealed blobs, auto compact (#1)

Squash of PR #1. Reviewed over 28 Codex rounds plus a final local Codex CLI review (gpt-6-luna, high effort) with no findings; CI green on macOS, Ubuntu and Windows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Eraxty
Eraxty merged commit 1dd8527 into Eraxty:Rust Oct 6, 2026
@Eraxty

Eraxty commented Oct 6, 2026

Copy link
Copy Markdown
Owner

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants