abstractSynchronizer.ts ×7

Frontier kind: Code frontier

unlabeled · c_44d3ff29246d

233 tests · 24527 LOC · 133 files · introduces 0 tests · 42 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
9 ranges42 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
3802 ranges24527 lines · 133 files · Browse complete extent
All tests (intent)
233 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.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

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

2 files ranked by introduced lines: 42 introduced LOC across 9 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/userDataSync/common/abstractSynchronizer.ts 38 introduced LOC · 7 ranges

Open complete file

68
69 export function getSyncResourceLogLabel(syncResource: SyncResource, profile: IUserDataProfile): string {
70 > return `${uppercaseFirstLetter(syncResource)}${profile.isDefault ? '' : ` (${profile.name})`}`; abstractSynchronizer.ts
71 > }
72
73 export interface IResourcePreview {
156
157 constructor(
158 > readonly syncResource: IUserDataSyncResource, abstractSynchronizer.ts
159 > readonly collection: string | undefined,
160 > @IFileService protected readonly fileService: IFileService,
161 > @IEnvironmentService protected readonly environmentService: IEnvironmentService,
162 > @IStorageService protected readonly storageService: IStorageService,
163 > @IUserDataSyncStoreService protected readonly userDataSyncStoreService: IUserDataSyncStoreService,
164 > @IUserDataSyncLocalStoreService protected readonly userDataSyncLocalStoreService: IUserDataSyncLocalStoreService,
165 > @IUserDataSyncEnablementService protected readonly userDataSyncEnablementService: IUserDataSyncEnablementService,
166 > @ITelemetryService protected readonly telemetryService: ITelemetryService,
167 > @IUserDataSyncLogService protected readonly logService: IUserDataSyncLogService,
168 > @IConfigurationService protected readonly configurationService: IConfigurationService,
169 > @IUriIdentityService uriIdentityService: IUriIdentityService,
170 > ) {
171 > super();
172 > this.lastSyncUserDataStateKey = `${collection ? `${collection}.` : ''}${syncResource.syncResource}.lastSyncUserData`;
173 > this.resource = syncResource.syncResource;
174 > this.syncResourceLogLabel = getSyncResourceLogLabel(syncResource.syncResource, syncResource.profile);
175 > this.extUri = uriIdentityService.extUri;
176 > this.syncFolder = this.extUri.joinPath(environmentService.userDataSyncHome, ...getPathSegments(syncResource.profile.isDefault ? undefined : syncResource.profile.id, syncResource.syncResource));
177 > this.syncPreviewFolder = this.extUri.joinPath(this.syncFolder, PREVIEW_DIR_NAME);
178 > this.lastSyncResource = getLastSyncResourceUri(syncResource.profile.isDefault ? undefined : syncResource.profile.id, syncResource.syncResource, environmentService, this.extUri);
179 > this.currentMachineIdPromise = getServiceMachineId(environmentService, fileService, storageService);
180 > }
181
182 protected triggerLocalChange(): void {
591
592 async getLastSyncUserData(): Promise<IRemoteUserData | null> {
593 > const storedLastSyncUserDataStateContent = this.getStoredLastSyncUserDataStateContent(); abstractSynchronizer.ts
594 >
595 > // Last Sync Data state does not exist
596 > if (!storedLastSyncUserDataStateContent) {
597 > this.logService.info(`${this.syncResourceLogLabel}: Last sync data state does not exist.`);
598 > return null;
599 > }
600
601 const lastSyncUserDataState: ILastSyncUserDataState = JSON.parse(storedLastSyncUserDataStateContent);
602 const resourceSyncStateVersion = this.userDataSyncEnablementService.getResourceSyncStateVersion(this.resource);
603 > this.hasSyncResourceStateVersionChanged = !!lastSyncUserDataState.version && !!resourceSyncStateVersion && lastSyncUserDataState.version !== resourceSyncStateVersion; abstractSynchronizer.ts
604 > if (this.hasSyncResourceStateVersionChanged) {
605 this.logService.info(`${this.syncResourceLogLabel}: Reset last sync state because last sync state version ${lastSyncUserDataState.version} is not compatible with current sync state version ${resourceSyncStateVersion}.`);
606 await this.resetLocal();
612 // Get Last Sync Data from Local
613 let retrial = 1;
614 > while (syncData === undefined && retrial++ < 6 /* Retry 5 times */) { abstractSynchronizer.ts
615 try {
616 const lastSyncStoredRemoteUserData = await this.readLastSyncStoredRemoteUserData();
660 syncData,
661 };
663
664 protected async updateLastSyncUserData(lastSyncRemoteUserData: IRemoteUserData, additionalProps: IStringDictionary<any> = {}): Promise<void> {
679
680 private getStoredLastSyncUserDataStateContent(): string | undefined {
681 > return this.storageService.get(this.lastSyncUserDataStateKey, StorageScope.APPLICATION); abstractSynchronizer.ts
682 > }
683
684 private async readLastSyncStoredRemoteUserData(): Promise<IRemoteUserData | undefined> {
src/vs/platform/userDataSync/common/userDataSync.ts 4 introduced LOC · 2 ranges

Open complete file

182
183 export function getPathSegments(collection: string | undefined, ...paths: string[]): string[] {
184 > return collection ? [collection, ...paths] : paths; userDataSync.ts
185 > }
186
187 export function getLastSyncResourceUri(collection: string | undefined, syncResource: SyncResource, environmentService: IEnvironmentService, extUri: IExtUri): URI {
188 > return extUri.joinPath(environmentService.userDataSyncHome, ...getPathSegments(collection, syncResource, `lastSync${syncResource}.json`)); userDataSync.ts
189 > }
190
191 export type IUserDataResourceManifest = Record<ServerResource, string>;