Update storage promise

A new doStore was added.
This commit is contained in:
Asher 2021-02-09 10:36:39 -06:00
parent 14c96d78ef
commit 89c38d3554
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A
5 changed files with 10 additions and 28 deletions

View File

@ -118,13 +118,8 @@ export class BrowserStorageService extends AbstractStorageService {
return this.getStorage(scope).getNumber(key, fallbackValue); return this.getStorage(scope).getNumber(key, fallbackValue);
} }
<<<<<<< HEAD protected doStore(key: string, value: string | boolean | number | undefined | null, scope: StorageScope): Promise<void> {
store(key: string, value: string | boolean | number | undefined | null, scope: StorageScope): Promise<void> {
return this.getStorage(scope).set(key, value); return this.getStorage(scope).set(key, value);
=======
protected doStore(key: string, value: string | boolean | number | undefined | null, scope: StorageScope): void {
this.getStorage(scope).set(key, value);
>>>>>>> e4a830e9b7ca039c7c70697786d29f5b6679d775
} }
protected doRemove(key: string, scope: StorageScope): void { protected doRemove(key: string, scope: StorageScope): void {

View File

@ -104,11 +104,7 @@ export interface IStorageService {
* @param target allows to define the target of the storage operation * @param target allows to define the target of the storage operation
* to either the current machine or user. * to either the current machine or user.
*/ */
<<<<<<< HEAD store(key: string, value: string | boolean | number | undefined | null, scope: StorageScope, target: StorageTarget): Promise<void> | void;
store(key: string, value: string | boolean | number | undefined | null, scope: StorageScope): Promise<void> | void;
=======
store(key: string, value: string | boolean | number | undefined | null, scope: StorageScope, target: StorageTarget): void;
>>>>>>> e4a830e9b7ca039c7c70697786d29f5b6679d775
/** /**
* Delete an element stored under the provided key from storage. * Delete an element stored under the provided key from storage.
@ -402,7 +398,7 @@ export abstract class AbstractStorageService extends Disposable implements IStor
abstract getNumber(key: string, scope: StorageScope, fallbackValue: number): number; abstract getNumber(key: string, scope: StorageScope, fallbackValue: number): number;
abstract getNumber(key: string, scope: StorageScope, fallbackValue?: number): number | undefined; abstract getNumber(key: string, scope: StorageScope, fallbackValue?: number): number | undefined;
protected abstract doStore(key: string, value: string | boolean | number, scope: StorageScope): void; protected abstract doStore(key: string, value: string | boolean | number, scope: StorageScope): Promise<void> | void;
protected abstract doRemove(key: string, scope: StorageScope): void; protected abstract doRemove(key: string, scope: StorageScope): void;

View File

@ -188,13 +188,8 @@ export class NativeStorageService extends AbstractStorageService {
return this.getStorage(scope).getNumber(key, fallbackValue); return this.getStorage(scope).getNumber(key, fallbackValue);
} }
<<<<<<< HEAD protected doStore(key: string, value: string | boolean | number | undefined | null, scope: StorageScope): Promise<void> {
store(key: string, value: string | boolean | number | undefined | null, scope: StorageScope): Promise<void> {
return this.getStorage(scope).set(key, value); return this.getStorage(scope).set(key, value);
=======
protected doStore(key: string, value: string | boolean | number | undefined | null, scope: StorageScope): void {
this.getStorage(scope).set(key, value);
>>>>>>> e4a830e9b7ca039c7c70697786d29f5b6679d775
} }
protected doRemove(key: string, scope: StorageScope): void { protected doRemove(key: string, scope: StorageScope): void {

View File

@ -1,23 +1,23 @@
import { Emitter } from 'vs/base/common/event'; import { Emitter } from 'vs/base/common/event';
import * as path from 'vs/base/common/path';
import { URI } from 'vs/base/common/uri'; import { URI } from 'vs/base/common/uri';
import { localize } from 'vs/nls'; import { localize } from 'vs/nls';
import { Extensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry'; import { Extensions, IConfigurationRegistry } from 'vs/platform/configuration/common/configurationRegistry';
import { registerSingleton } from 'vs/platform/instantiation/common/extensions'; import { registerSingleton } from 'vs/platform/instantiation/common/extensions';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection'; import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { ILocalizationsService } from 'vs/platform/localizations/common/localizations'; import { ILocalizationsService } from 'vs/platform/localizations/common/localizations';
import { ILogService } from 'vs/platform/log/common/log';
import { INotificationService, Severity } from 'vs/platform/notification/common/notification'; import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
import { Registry } from 'vs/platform/registry/common/platform'; import { Registry } from 'vs/platform/registry/common/platform';
import { PersistentConnectionEventType } from 'vs/platform/remote/common/remoteAgentConnection'; import { PersistentConnectionEventType } from 'vs/platform/remote/common/remoteAgentConnection';
import { IStorageService, StorageScope, StorageTarget } from 'vs/platform/storage/common/storage';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry'; import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { INodeProxyService, NodeProxyChannelClient } from 'vs/server/common/nodeProxy'; import { INodeProxyService, NodeProxyChannelClient } from 'vs/server/common/nodeProxy';
import { TelemetryChannelClient } from 'vs/server/common/telemetry'; import { TelemetryChannelClient } from 'vs/server/common/telemetry';
import { Options } from 'vs/server/ipc.d';
import 'vs/workbench/contrib/localizations/browser/localizations.contribution'; import 'vs/workbench/contrib/localizations/browser/localizations.contribution';
import { LocalizationsService } from 'vs/workbench/services/localizations/electron-browser/localizationsService'; import { LocalizationsService } from 'vs/workbench/services/localizations/electron-browser/localizationsService';
import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService'; import { IRemoteAgentService } from 'vs/workbench/services/remote/common/remoteAgentService';
import { Options } from 'vs/server/ipc.d';
import { IStorageService, StorageScope } from 'vs/platform/storage/common/storage';
import { ILogService } from 'vs/platform/log/common/log';
import * as path from 'vs/base/common/path';
class TelemetryService extends TelemetryChannelClient { class TelemetryService extends TelemetryChannelClient {
public constructor( public constructor(
@ -179,7 +179,7 @@ export const initialize = async (services: ServiceCollection): Promise<void> =>
} }
} }
storageService.store('csLastUpdateNotification', Date.now(), StorageScope.GLOBAL); storageService.store('csLastUpdateNotification', Date.now(), StorageScope.GLOBAL, StorageTarget.MACHINE);
(services.get(INotificationService) as INotificationService).notify({ (services.get(INotificationService) as INotificationService).notify({
severity: Severity.Info, severity: Severity.Info,
message: `[code-server v${json.latest}](https://github.com/cdr/code-server/releases/tag/v${json.latest}) has been released!`, message: `[code-server v${json.latest}](https://github.com/cdr/code-server/releases/tag/v${json.latest}) has been released!`,

View File

@ -66,12 +66,8 @@ export class MainThreadStorage implements MainThreadStorageShape {
let jsonValue: string; let jsonValue: string;
try { try {
jsonValue = JSON.stringify(value); jsonValue = JSON.stringify(value);
<<<<<<< HEAD
await this._storageService.store(key, jsonValue, shared ? StorageScope.GLOBAL : StorageScope.WORKSPACE);
=======
// Extension state is synced separately through extensions // Extension state is synced separately through extensions
this._storageService.store(key, jsonValue, shared ? StorageScope.GLOBAL : StorageScope.WORKSPACE, StorageTarget.MACHINE); await this._storageService.store(key, jsonValue, shared ? StorageScope.GLOBAL : StorageScope.WORKSPACE, StorageTarget.MACHINE);
>>>>>>> e4a830e9b7ca039c7c70697786d29f5b6679d775
} catch (err) { } catch (err) {
return Promise.reject(err); return Promise.reject(err);
} }