Implement getAllRefs and resolveContent for backup store

This commit is contained in:
Sandeep Somavarapu
2020-03-06 11:54:09 +01:00
parent 7d17f6f926
commit c584c5c177
13 changed files with 202 additions and 51 deletions

View File

@@ -88,6 +88,10 @@ export class SettingsSyncService extends Disposable implements ISettingsSyncServ
return this.channel.call('getRemoteContent', [ref, fragment]);
}
getLocalBackupContent(ref?: string, fragment?: string): Promise<string | null> {
return this.channel.call('getLocalBackupContent', [ref, fragment]);
}
getRemoteContentFromPreview(): Promise<string | null> {
return this.channel.call('getRemoteContentFromPreview', []);
}

View File

@@ -0,0 +1,37 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ResourceKey, IResourceRefHandle, IUserDataSyncBackupStoreService } 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: ResourceKey, content: string): Promise<void> {
return this.channel.call('backup', [key, content]);
}
getAllRefs(key: ResourceKey): Promise<IResourceRefHandle[]> {
return this.channel.call('getAllRefs', [key]);
}
resolveContent(key: ResourceKey, ref: string): Promise<string | null> {
return this.channel.call('resolveContent', [key, ref]);
}
}
registerSingleton(IUserDataSyncBackupStoreService, UserDataSyncBackupStoreService);