voyager 3: the batch store writes releases once, by id references and bytea keys
Each release chunk is a release inserted once: release_key the SHA-1 of the identity, the owner group and the first article (deterministic; no numbering under a group lock), identity_key the identity's SHA-1 bytes, poster_id and group_set_id through catalog_refs (cached per process), source as a code (weak-stem added), the name into release_texts. A finished release's candidates are claimable at once; a provisional tail release is finished by a later chunk of its key, a finished one sent again is left alone. Gone: joins into earlier releases and across groups, key numbering, the group lock, the fragment merger. Interim: chunks, counts and samples keyed by ranges.block_id, a range without a block gets one. Readers follow: search (posters and group_sets joined, words through release_texts, posters by id, source by code), the par2 merger, the sidecar folder, the judge's scraped rule, the spot inspector, the spotter, the NZB service, releases:regroup, edge:bench. Tests insert fixtures through tests/functional/helpers/releases.ts; the suites pass again. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
bc4e17e86f
commit
2580f20a43
32 files changed
+962
-497
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import { test } from '@japa/runner'
|
||||
import db from '@adonisjs/lucid/services/db'
|
||||
import testUtils from '@adonisjs/core/services/test_utils'
|
||||
import { insertReleases } from '#tests/functional/helpers/releases'
|
||||
|
||||
const categoryOf = async (name: string) => Number((await db.rawQuery(`SELECT release_category(?) AS c`, [name])).rows[0].c)
|
||||
|
||||
@@ -37,20 +38,21 @@ test.group('Release categories', (group) => {
|
||||
})
|
||||
|
||||
test("the name's, else the inner name's, else a given one (a spot's), else the groups'", async ({ assert }) => {
|
||||
const row = (key: string, extra: Record<string, unknown>) => ({ release_key: key.padEnd(40, '0'), identity_key: key.padEnd(40, '0'), source: 'stem', files: 1, groups: '["alt.binaries.misc"]', ...extra })
|
||||
await db.table('releases').multiInsert([
|
||||
const row = (key: string, extra: { name: string } & Record<string, unknown>) => ({ release_key: key.padEnd(40, '0'), identity_key: key.padEnd(40, '0'), source: 'stem', files: 1, groups: '["alt.binaries.misc"]', ...extra })
|
||||
const [a, b, c, d] = await insertReleases([
|
||||
row('a', { name: 'Show.S01E02.1080p.WEB' }),
|
||||
row('b', { name: 'TsIgNBewuFbuwWy' }),
|
||||
row('c', { name: 'TsIgNBewuFbuwWy', groups: '["alt.binaries.pictures.erotica.puffies"]' }),
|
||||
// A spot's release of its own, inserted with the spot's category.
|
||||
row('d', { name: 'Some spot title', category: 2040 }),
|
||||
])
|
||||
const byName = async () => Object.fromEntries((await db.from('releases').select('release_key', 'category')).map((r) => [r.release_key[0], r.category]))
|
||||
const letters = new Map([[a, 'a'], [b, 'b'], [c, 'c'], [d, 'd']])
|
||||
const byName = async () => Object.fromEntries((await db.from('releases').select('id', 'category')).map((r) => [letters.get(Number(r.id)), r.category]))
|
||||
assert.deepEqual(await byName(), { a: 5040, b: 8010, c: 6060, d: 2040 })
|
||||
// The prober finds an inner name; a spot links a release (the spot inspector sets a Misc one's category).
|
||||
await db.from('releases').where('release_key', 'b'.padEnd(40, '0')).update({ inner_name: 'Some.Movie.2020.1080p.BluRay.x264-GRP.mkv' })
|
||||
await db.from('releases').where('release_key', 'c'.padEnd(40, '0')).update({ category: 5030 })
|
||||
await db.from('releases').where('release_key', 'c'.padEnd(40, '0')).update({ inner_name: 'nothing.bin' })
|
||||
await db.from('releases').where('id', b).update({ inner_name: 'Some.Movie.2020.1080p.BluRay.x264-GRP.mkv' })
|
||||
await db.from('releases').where('id', c).update({ category: 5030 })
|
||||
await db.from('releases').where('id', c).update({ inner_name: 'nothing.bin' })
|
||||
assert.deepEqual(await byName(), { a: 5040, b: 2040, c: 5030, d: 2040 })
|
||||
})
|
||||
|
||||
|
||||
Reference in new issue
Block a user