The goal of this Milestone is to implement sharing of index through Mynij users. A user can decide if he want to enable torrent sharing, when done he will become a seeder. Another user with the index Magnet Uri can download the torrent from the seeder browser directly.
Source code can be found in Nexedi gitlab here: https://lab.nexedi.com/Mynij/erp5/tree/Mynij/bt5/erp5_web_mynij_search.
When an index is built, it can be shared to others Mynij users through a torrent. Seeding an index will create a Blob of full index (which contains a zipped JSON file), this mean export all Flexsearch data, index definition and saved content, then make it available to internet.
Seed of index is enabled by checking Seed as Torrent in the index document source and click on Save. A backgound job extract required data and start to seed it. As long as the browser tab is opened, the seeder is active and available for download.
To stop seeding, user can unckeck Seed as Torrent and save the index again, this will cancel the job for the related index.
Activities page show Torrent seed state, it's possible to see the Torrent size as well as the magnet URL. When a client download the torrent, the progression, the number of peers and the current download speed are updated in live, it help to see which torrent is being transferred.
Importing index from torrent is same as importing from a file with the advantage that it's easy to share index with a simple link.
Opening the link in the browser, automatically start download of index from available peers. This operation is fast than a build (crawl all URLs in the index takes time), index in the torrent is zipped which reduce considerably the size of blob to download.
Index torrent can also be imported by clicking on the menu Import Index Torrent, which opend a form where user can input the Magnet URI and start download.
When downloading the torrent, user can see download progression and file extraction information.
It's possible to seed any index (thus become an index seeder). This is done by navigating to index Sources menu in Mynij app, choose the index to seed then check Seed as Torrent. A RenderJS background job loop every minutes and create a new seed from enabled index data.