* Creates a snapshot. * @param {number | null | undefined} startTime when processing the files has started * @param {Iterable<string> | null | undefined} files all files * @param {Iterable<string> | null | undefined} directories all directories * @param {Iterable<string> | null | undefined}
(startTime, files, directories, missing, options, callback)
| 2460 | * @returns {void} |
| 2461 | */ |
| 2462 | createSnapshot(startTime, files, directories, missing, options, callback) { |
| 2463 | /** @type {FileTimestamps} */ |
| 2464 | const fileTimestamps = new Map(); |
| 2465 | /** @type {FileHashes} */ |
| 2466 | const fileHashes = new Map(); |
| 2467 | /** @type {FileTshs} */ |
| 2468 | const fileTshs = new Map(); |
| 2469 | /** @type {ContextTimestamps} */ |
| 2470 | const contextTimestamps = new Map(); |
| 2471 | /** @type {ContextHashes} */ |
| 2472 | const contextHashes = new Map(); |
| 2473 | /** @type {ContextTshs} */ |
| 2474 | const contextTshs = new Map(); |
| 2475 | /** @type {MissingExistence} */ |
| 2476 | const missingExistence = new Map(); |
| 2477 | /** @type {ManagedItemInfo} */ |
| 2478 | const managedItemInfo = new Map(); |
| 2479 | /** @type {ManagedFiles} */ |
| 2480 | const managedFiles = new Set(); |
| 2481 | /** @type {ManagedContexts} */ |
| 2482 | const managedContexts = new Set(); |
| 2483 | /** @type {ManagedMissing} */ |
| 2484 | const managedMissing = new Set(); |
| 2485 | /** @type {Children} */ |
| 2486 | const children = new Set(); |
| 2487 | |
| 2488 | const snapshot = new Snapshot(); |
| 2489 | if (startTime) snapshot.setStartTime(startTime); |
| 2490 | |
| 2491 | /** @type {Set<string>} */ |
| 2492 | const managedItems = new Set(); |
| 2493 | |
| 2494 | /** 1 = timestamp, 2 = hash, 3 = timestamp + hash */ |
| 2495 | const mode = options && options.hash ? (options.timestamp ? 3 : 2) : 1; |
| 2496 | |
| 2497 | let jobs = 1; |
| 2498 | const jobDone = () => { |
| 2499 | if (--jobs === 0) { |
| 2500 | if (fileTimestamps.size !== 0) { |
| 2501 | snapshot.setFileTimestamps(fileTimestamps); |
| 2502 | } |
| 2503 | if (fileHashes.size !== 0) { |
| 2504 | snapshot.setFileHashes(fileHashes); |
| 2505 | } |
| 2506 | if (fileTshs.size !== 0) { |
| 2507 | snapshot.setFileTshs(fileTshs); |
| 2508 | } |
| 2509 | if (contextTimestamps.size !== 0) { |
| 2510 | snapshot.setContextTimestamps(contextTimestamps); |
| 2511 | } |
| 2512 | if (contextHashes.size !== 0) { |
| 2513 | snapshot.setContextHashes(contextHashes); |
| 2514 | } |
| 2515 | if (contextTshs.size !== 0) { |
| 2516 | snapshot.setContextTshs(contextTshs); |
| 2517 | } |
| 2518 | if (missingExistence.size !== 0) { |
| 2519 | snapshot.setMissingExistence(missingExistence); |
no test coverage detected