- groups:add / ranges:plan / nodes:create / coordinator:run commands - the node API: lease, the range's chunks as one framed stream from the spool, batches, heartbeat, finish, release (node guard, token per node) - edge:node: needs COORDINATOR_URL and NODE_TOKEN only (placeholders for the rest), posts a batch every 10 chunks, gives its range back on SIGTERM - releases are gathered per batch: 1.04 chunk rows per release at 10 chunks per batch (1.35 when built per XOVER chunk) - partitions are checked per batch instead of remembered Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 lines
1.1 KiB
TypeScript
31 lines
1.1 KiB
TypeScript
import { BaseCommand, args, flags } from '@adonisjs/core/ace'
|
|
import type { CommandOptions } from '@adonisjs/core/types/ace'
|
|
import Planner from '#services/planner'
|
|
import NntpPool from '#services/nntp_pool'
|
|
|
|
/** Adds groups to index, after the existing ones in priority (owner rule). */
|
|
export default class GroupsAdd extends BaseCommand {
|
|
static commandName = 'groups:add'
|
|
static description = 'Adds groups to index (by name, or the largest by LIST ACTIVE)'
|
|
static options: CommandOptions = { startApp: true }
|
|
|
|
@args.spread({ description: 'Group names', required: false })
|
|
declare names?: string[]
|
|
|
|
@flags.number({ description: 'The largest N groups matching --pattern' })
|
|
declare top?: number
|
|
|
|
@flags.string({ description: 'LIST ACTIVE pattern for --top', default: 'alt.binaries.*' })
|
|
declare pattern: string
|
|
|
|
async run() {
|
|
try {
|
|
const names = this.top ? await Planner.largestGroups(this.pattern, this.top) : (this.names ?? [])
|
|
const added = await Planner.addGroups(names)
|
|
this.logger.info(`${added} of ${names.length} groups added.`)
|
|
} finally {
|
|
await NntpPool.close()
|
|
}
|
|
}
|
|
}
|