#85619 Enable following

- getting all refs
- resolving content for a ref
- deleting a resource
This commit is contained in:
Sandeep Somavarapu
2020-03-05 03:38:27 +01:00
parent 014ddafc91
commit 36141fa1f3
6 changed files with 141 additions and 6 deletions

View File

@@ -0,0 +1,58 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { SyncSource, IUserDataSyncStoreService, IUserDataSyncStore, getUserDataSyncStore, ResourceKey, IUserData, IUserDataManifest } 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: ResourceKey, oldValue: IUserData | null, source?: SyncSource): Promise<IUserData> {
throw new Error('Not Supported');
}
write(key: ResourceKey, content: string, ref: string | null, source?: SyncSource): 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: ResourceKey): Promise<string[]> {
return this.channel.call('getAllRefs', [key]);
}
resolveContent(key: ResourceKey, ref: string): Promise<string | null> {
return this.channel.call('resolveContent', [key, ref]);
}
delete(key: ResourceKey): Promise<void> {
return this.channel.call('delete', [key]);
}
}
registerSingleton(IUserDataSyncStoreService, UserDataSyncStoreService);