Rebuild: the fragment merger
Files cut by a range's edge are put together once the ranges around them are done (coordinator:run, every minute): a complete file is judged by the rules and written as a release chunk with probe candidates; one still missing parts while both neighbouring ranges are done is dropped and counted (incomplete/edge). A neighbour not planned yet counts as not done, except before the group's oldest article. BatchStore.writeReleases is the shared write path. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2c14315f94
commit
b862201991
7 files changed
+365
-65
No files matched your search
@@ -280,7 +280,7 @@ export class RangeIndexer {
|
||||
}
|
||||
|
||||
/** The release key; a file without a recognisable release becomes a release of its own. */
|
||||
function releaseKeyOf(s: EdgeSegment): string {
|
||||
export function releaseKeyOf(s: EdgeSegment): string {
|
||||
return s.file.release?.key ?? createHash('sha1').update(`file\n${s.fileKey}`).digest('hex')
|
||||
}
|
||||
|
||||
@@ -293,7 +293,7 @@ function postedOf(segments: EdgeSegment[]): number | null {
|
||||
return min
|
||||
}
|
||||
|
||||
function chunkOf(key: string, files: AggregatedFile<EdgeSegment>[]): ReleaseChunk {
|
||||
export function chunkOf(key: string, files: AggregatedFile<EdgeSegment>[]): ReleaseChunk {
|
||||
const first = files[0].segments[0].file
|
||||
const chunkFiles: ChunkFile[] = files.map((f) => {
|
||||
const m = f.segments[0].file
|
||||
@@ -339,7 +339,7 @@ function chunkOf(key: string, files: AggregatedFile<EdgeSegment>[]): ReleaseChun
|
||||
* volume, of its par2 index, of a lone random-named file, and a 7z set's
|
||||
* last volume (its listing is in the tail). At most a few per release.
|
||||
*/
|
||||
function candidatesOf(key: string, files: AggregatedFile<EdgeSegment>[]): ProbeCandidate[] {
|
||||
export function candidatesOf(key: string, files: AggregatedFile<EdgeSegment>[]): ProbeCandidate[] {
|
||||
const out: ProbeCandidate[] = []
|
||||
let tail: { volume: number; file: AggregatedFile<EdgeSegment> } | null = null
|
||||
for (const f of files) {
|
||||
|
||||
Reference in new issue
Block a user