import { ITelemetryLogger } from "@fluidframework/common-definitions" ; import { IGCResult } from "./interfaces" ; param referenceGraph param rootIds param logger returns export function runGarbageCollection ( referenceGraph , rootIds , logger ) { const visited = new Set ( ) ; const referencedIds = [ ... rootIds ] ; for ( const id of referencedIds ) { if ( visited . has ( id ) ) { continue ; } visited . add ( id ) ; const routes = referenceGraph [ id ] ; if ( routes !== undefined ) { referencedIds . push ( ... routes ) ; } else { } } const referencedNodeIds = [ ] ; const deletedNodeIds = [ ] ; for ( const id of Object . keys ( referenceGraph ) ) { if ( visited . has ( id ) ) { referencedNodeIds . push ( id ) ; } else { deletedNodeIds . push ( id ) ; } } return { referencedNodeIds , deletedNodeIds } ; }