]> git.ipfire.org Git - thirdparty/rspamd.git/commit
[Feature] Wire fasttext lang detector through maps infrastructure
authorVsevolod Stakhov <vsevolod@rspamd.com>
Wed, 25 Feb 2026 14:51:07 +0000 (14:51 +0000)
committerVsevolod Stakhov <vsevolod@rspamd.com>
Wed, 25 Feb 2026 14:51:07 +0000 (14:51 +0000)
commitda0b9ca773ee62e0372fd682e7b944ec71cc46c1
tree9683dfcb851f845c83123eafa7d47189480f87fc
parent9f2c6ba4bc2f02a78631702962a0ff383e106baa
[Feature] Wire fasttext lang detector through maps infrastructure

The fasttext language detector now supports HTTP/HTTPS URLs for model
loading via the maps system, enabling automatic download, disk caching,
periodic reload, and cross-worker mmap sharing.

Changes:
- fasttext_model::load() accepts an offset parameter for mmap at a
  non-zero position (used with page-aligned map cache files)
- fasttext_langdet uses rspamd_map_is_map() to detect URLs vs local
  paths; URLs go through rspamd_map_add() with RSPAMD_MAP_FILE_NO_READ
- Map callbacks (read/fin/dtor) handle atomic model swap on reload
- Local file paths continue to work as before with direct loading
src/libmime/lang_detection_fasttext.cxx
src/libserver/fasttext/fasttext_shim.cxx
src/libserver/fasttext/fasttext_shim.h