mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 03:29:00 +01:00
@@ -1,37 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IResourceRefHandle, IUserDataSyncBackupStoreService, SyncResource } from 'vs/platform/userDataSync/common/userDataSync';
|
||||
import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService';
|
||||
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
|
||||
export class UserDataSyncBackupStoreService implements IUserDataSyncBackupStoreService {
|
||||
|
||||
_serviceBrand: undefined;
|
||||
private readonly channel: IChannel;
|
||||
|
||||
constructor(
|
||||
@ISharedProcessService sharedProcessService: ISharedProcessService,
|
||||
) {
|
||||
this.channel = sharedProcessService.getChannel('userDataSyncBackupStoreService');
|
||||
}
|
||||
|
||||
backup(key: SyncResource, content: string): Promise<void> {
|
||||
return this.channel.call('backup', [key, content]);
|
||||
}
|
||||
|
||||
|
||||
getAllRefs(key: SyncResource): Promise<IResourceRefHandle[]> {
|
||||
return this.channel.call('getAllRefs', [key]);
|
||||
}
|
||||
|
||||
resolveContent(key: SyncResource, ref: string): Promise<string | null> {
|
||||
return this.channel.call('resolveContent', [key, ref]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
registerSingleton(IUserDataSyncBackupStoreService, UserDataSyncBackupStoreService);
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { SyncStatus, SyncResource, IUserDataSyncService, UserDataSyncError, SyncResourceConflicts } from 'vs/platform/userDataSync/common/userDataSync';
|
||||
import { SyncStatus, SyncResource, IUserDataSyncService, UserDataSyncError, SyncResourceConflicts, ISyncResourceHandle } from 'vs/platform/userDataSync/common/userDataSync';
|
||||
import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
@@ -73,8 +73,8 @@ export class UserDataSyncService extends Disposable implements IUserDataSyncServ
|
||||
return this.channel.call('sync');
|
||||
}
|
||||
|
||||
acceptConflict(conflict: URI, content: string): Promise<void> {
|
||||
return this.channel.call('acceptConflict', [conflict, content]);
|
||||
stop(): Promise<void> {
|
||||
return this.channel.call('stop');
|
||||
}
|
||||
|
||||
reset(): Promise<void> {
|
||||
@@ -85,16 +85,31 @@ export class UserDataSyncService extends Disposable implements IUserDataSyncServ
|
||||
return this.channel.call('resetLocal');
|
||||
}
|
||||
|
||||
stop(): Promise<void> {
|
||||
return this.channel.call('stop');
|
||||
isFirstTimeSyncWithMerge(): Promise<boolean> {
|
||||
return this.channel.call('isFirstTimeSyncWithMerge');
|
||||
}
|
||||
|
||||
acceptConflict(conflict: URI, content: string): Promise<void> {
|
||||
return this.channel.call('acceptConflict', [conflict, content]);
|
||||
}
|
||||
|
||||
resolveContent(resource: URI): Promise<string | null> {
|
||||
return this.channel.call('resolveContent', [resource]);
|
||||
}
|
||||
|
||||
isFirstTimeSyncWithMerge(): Promise<boolean> {
|
||||
return this.channel.call('isFirstTimeSyncWithMerge');
|
||||
async getLocalSyncResourceHandles(resource: SyncResource): Promise<ISyncResourceHandle[]> {
|
||||
const handles = await this.channel.call<ISyncResourceHandle[]>('getLocalSyncResourceHandles', [resource]);
|
||||
return handles.map(({ created, uri }) => ({ created, uri: URI.revive(uri) }));
|
||||
}
|
||||
|
||||
async getRemoteSyncResourceHandles(resource: SyncResource): Promise<ISyncResourceHandle[]> {
|
||||
const handles = await this.channel.call<ISyncResourceHandle[]>('getRemoteSyncResourceHandles', [resource]);
|
||||
return handles.map(({ created, uri }) => ({ created, uri: URI.revive(uri) }));
|
||||
}
|
||||
|
||||
async getAssociatedResources(resource: SyncResource, syncResourceHandle: ISyncResourceHandle): Promise<{ resource: URI, comparableResource?: URI }[]> {
|
||||
const result = await this.channel.call<{ resource: URI, comparableResource?: URI }[]>('getAssociatedResources', [resource, syncResourceHandle]);
|
||||
return result.map(({ resource, comparableResource }) => ({ resource: URI.revive(resource), comparableResource: URI.revive(comparableResource) }));
|
||||
}
|
||||
|
||||
private async updateStatus(status: SyncStatus): Promise<void> {
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { SyncResource, IUserDataSyncStoreService, IUserDataSyncStore, getUserDataSyncStore, IUserData, IUserDataManifest, IResourceRefHandle } from 'vs/platform/userDataSync/common/userDataSync';
|
||||
import { ISharedProcessService } from 'vs/platform/ipc/electron-browser/sharedProcessService';
|
||||
import { IChannel } from 'vs/base/parts/ipc/common/ipc';
|
||||
import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
|
||||
export class UserDataSyncStoreService implements IUserDataSyncStoreService {
|
||||
|
||||
_serviceBrand: undefined;
|
||||
private readonly channel: IChannel;
|
||||
readonly userDataSyncStore: IUserDataSyncStore | undefined;
|
||||
|
||||
constructor(
|
||||
@ISharedProcessService sharedProcessService: ISharedProcessService,
|
||||
@IProductService productService: IProductService,
|
||||
@IConfigurationService configurationService: IConfigurationService
|
||||
) {
|
||||
this.channel = sharedProcessService.getChannel('userDataSyncStoreService');
|
||||
this.userDataSyncStore = getUserDataSyncStore(productService, configurationService);
|
||||
}
|
||||
|
||||
read(key: SyncResource, oldValue: IUserData | null, source?: SyncResource): Promise<IUserData> {
|
||||
throw new Error('Not Supported');
|
||||
}
|
||||
|
||||
write(key: SyncResource, content: string, ref: string | null, source?: SyncResource): Promise<string> {
|
||||
throw new Error('Not Supported');
|
||||
}
|
||||
|
||||
manifest(): Promise<IUserDataManifest | null> {
|
||||
throw new Error('Not Supported');
|
||||
}
|
||||
|
||||
clear(): Promise<void> {
|
||||
throw new Error('Not Supported');
|
||||
}
|
||||
|
||||
getAllRefs(key: SyncResource): Promise<IResourceRefHandle[]> {
|
||||
return this.channel.call('getAllRefs', [key]);
|
||||
}
|
||||
|
||||
resolveContent(key: SyncResource, ref: string): Promise<string | null> {
|
||||
return this.channel.call('resolveContent', [key, ref]);
|
||||
}
|
||||
|
||||
delete(key: SyncResource): Promise<void> {
|
||||
return this.channel.call('delete', [key]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
registerSingleton(IUserDataSyncStoreService, UserDataSyncStoreService);
|
||||
Reference in New Issue
Block a user