import { Socket } from 'socket.io' ; import { CleanupWorkspaceEvent , EVENT_CLEANUP_WORKSPACE , EVENT_JOBS_AVAILABLE , EVENTS_STOP_JOB , StopJobEvent , } from '../../commons/runners/events' ; export class Runner { constructor ( private readonly socket ) { } cleanupWorkspace ( data ) { this . socket . emit ( EVENT_CLEANUP_WORKSPACE , data ) ; } jobsAvailable ( ) { this . socket . emit ( EVENT_JOBS_AVAILABLE ) ; } stopJob ( jobId ) { this . socket . emit ( EVENTS_STOP_JOB , < StopJobEvent > { jobId } ) ; } } export const runnerRegistry = { } ; export function getRunner ( id ) { return runnerRegistry [ id ] ; }