diskFileSystemProvider.ts ×11

Frontier kind: Joint frontier

unlabeled · c_5d66618410ba

6 tests · 27079 LOC · 101 files · introduces 5 tests · 79 LOC · 3 files

Introduces — evidence that enters the hierarchy at this concept

Code
18 ranges79 lines · 3 files
Tests
5 tests

Contains — complete concept membership

All code (extent)
3111 ranges27079 lines · 101 files · Browse complete extent
All tests (intent)
6 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

5 tests introduced at this concept.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

3 files ranked by introduced lines: 79 introduced LOC across 18 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/files/node/diskFileSystemProvider.ts 43 introduced LOC · 11 ranges

Open complete file

103 return await this.stat(resource);
104 } catch (error) {
105 > return undefined; diskFileSystemProvider.ts
106 > }
107 }
108
119 const result: [string, FileType][] = [];
120 await Promise.all(children.map(async child => {
122 > let type: FileType;
123 > if (child.isSymbolicLink()) {
124 type = (await this.stat(joinPath(resource, child.name))).type; // always resolve target the link points to if any
125 > } else { diskFileSystemProvider.ts
126 > type = this.toType(child);
127 > }
128 >
129 > result.push([child.name, type]);
130 > } catch (error) {
131 this.logService.trace(error); // ignore errors for individual entries that can arise from permission denied
132 }
246 return this.doWriteFileAtomic(resource, joinPath(resourcesDirname(resource), `${resourcesBasename(resource)}${opts.atomic.postfix}`), content, opts);
247 } else {
248 > return this.doWriteFile(resource, content, opts); diskFileSystemProvider.ts
249 > }
250 }
251
357 let lock: IDisposable | undefined = undefined;
358 if (isFileOpenForWriteOptions(opts) && !disableWriteLock) {
359 > lock = await this.createResourceLock(resource); diskFileSystemProvider.ts
360 > }
361
362 let fd: number | undefined = undefined;
451
452 if (lock) {
453 > const previousLock = this.mapHandleToLock.get(fd); diskFileSystemProvider.ts
454 >
455 > // Remember that this handle has an associated lock
456 > this.traceLock(`[Disk FileSystemProvider]: open() - storing lock for handle ${fd} (${filePath})`);
457 > this.mapHandleToLock.set(fd, lock);
458 >
459 > // There is a slight chance that a resource lock for a
460 > // handle was not yet disposed when we acquire a new
461 > // lock, so we must ensure to dispose the previous lock
462 > // before storing a new one for the same handle, other
463 > // wise we end up in a deadlock situation
464 > // https://github.com/microsoft/vscode/issues/142462
465 > if (previousLock) {
466 this.traceLock(`[Disk FileSystemProvider]: open() - disposing a previous lock that was still stored on same handle ${fd} (${filePath})`);
467 previousLock.dispose();
468 }
470
471 return fd;
505 } finally {
506 if (lockForHandle) {
507 > if (this.mapHandleToLock.get(fd) === lockForHandle) { diskFileSystemProvider.ts
508 > this.traceLock(`[Disk FileSystemProvider]: close() - resource lock removed from handle-lock map ${fd}`);
509 > this.mapHandleToLock.delete(fd); // only delete from map if this is still our lock!
510 > }
511 >
512 > this.traceLock(`[Disk FileSystemProvider]: close() - disposing lock for handle ${fd}`);
513 > lockForHandle.dispose();
514 > }
515 }
516 }
635 await Promises.rm(filePath, RimRafMode.MOVE, rmMoveToPath);
636 } else {
638 > await promises.unlink(filePath);
639 > } catch (unlinkError) {
640
641 // `fs.unlink` will throw when used on directories
758 const toStat = await this.statIgnoreError(to);
759 if (!toStat) {
760 > return; // target does not exist so we are good diskFileSystemProvider.ts
761 > }
762
763 if (!overwrite) {
src/vs/platform/agentHost/node/agentSdkDownloader.ts 33 introduced LOC · 5 ranges

Open complete file

426 this._fireProgress(pkg, downloadId, 'progress', receivedBytes, totalBytes);
427 });
428 > await this._extractTarGz(tarballPath, tmpDir); agentSdkDownloader.ts
429 > await this._fileService.del(URI.file(tarballPath));
430 >
431 > // Write the `.complete` sentinel inside the tmp dir BEFORE the
432 > // move so the move atomically publishes a directory that
433 > // already carries its sentinel — a crash between move and
434 > // sentinel-write can't leave a wedged, sentinel-less cacheDir
435 > // behind. Content is intentionally empty: only existence
436 > // matters, and the cache dir path already encodes
437 > // `<pkg>/<version>/<sdkTarget>` for debugging.
438 > await this._fileService.writeFile(
439 > URI.joinPath(tmpDirUri, '.complete'),
440 > VSBuffer.fromString(''),
441 > );
442 >
443 > // Atomic publish of the completed extraction.
444 > try {
445 > await this._fileService.move(tmpDirUri, URI.file(cacheDir));
446 > } catch (err) {
447 if (await this._handleRenameLoser(err, sentinel, tmpDirUri)) {
448 this._logService.info(`[AgentSdkDownloader] ${pkg.id}: lost rename race, using existing cache`);
452 throw err;
453 }
455 > const elapsed = Math.round((Date.now() - start) / 1000);
456 > this._logService.info(`[AgentSdkDownloader] ${pkg.id}: downloaded in ${elapsed}s`);
457 this._fireProgress(pkg, downloadId, 'completed', lastTotal ?? lastReceived, lastTotal);
458 return cacheDir;
569 };
570 const settleResolve = () => {
571 > if (settled) { return; } agentSdkDownloader.ts
572 > settled = true;
573 > cancelSub.dispose();
574 > resolve();
575 > };
576 const settleReject = (err: unknown) => {
577 if (settled) { return; }
599 });
600 context.stream.on('end', () => {
601 > emitBytes(true); agentSdkDownloader.ts
602 > out.end();
603 });
604 context.stream.on('error', settleReject);
607
608 private async _extractTarGz(tarball: string, dest: string): Promise<void> {
609 > // `tar` (node-tar) is pure JS — works on every platform the agent host agentSdkDownloader.ts
610 > // runs on without depending on a system `tar` binary.
611 > await tar.x({ file: tarball, cwd: dest });
612 > }
613
614 private async _delIgnoringMissing(uri: URI): Promise<void> {
src/vs/platform/files/common/fileService.ts 3 introduced LOC · 2 ranges

Open complete file

385 let writeFileOptions = options;
386 if (hasFileAtomicWriteCapability(provider) && !writeFileOptions?.atomic) {
387 > const enforcedAtomicWrite = provider.enforceAtomicWriteFile?.(resource); fileService.ts
388 > if (enforcedAtomicWrite) {
389 writeFileOptions = { ...options, atomic: enforcedAtomicWrite };
390 }
391 > } fileService.ts
392
393 try {