Skip to content

Commit 32f401f

Browse files
author
Benjamin Pasero
committed
sqlite - storage => legacy storage
1 parent e4b21b6 commit 32f401f

9 files changed

Lines changed: 181 additions & 199 deletions

File tree

build/lib/compilation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ function createCompile(src, build, emitError) {
4343
const opts = _.clone(getTypeScriptCompilerOptions(src));
4444
opts.inlineSources = !!build;
4545
opts.noFilesystemLookup = true;
46-
const ts = tsb.create(opts, true, undefined, err => reporter(err.toString()));
46+
const ts = tsb.create(opts, true, undefined, err => new reporter(err.toString()));
4747
return function (token) {
4848
const utf8Filter = util.filter(data => /(\/|\\)test(\/|\\).*utf8/.test(data.path));
4949
const tsFilter = util.filter(data => /\.ts$/.test(data.path));

src/vs/platform/storage/common/storage.ts

Lines changed: 0 additions & 77 deletions
This file was deleted.

src/vs/platform/storage/common/migration.ts renamed to src/vs/platform/storage/common/storageLegacyMigration.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { IStorage, StorageService } from 'vs/platform/storage/common/storageService';
6+
import { StorageLegacyService, IStorageLegacy } from 'vs/platform/storage/common/storageLegacyService';
77
import { endsWith, startsWith, rtrim } from 'vs/base/common/strings';
88
import { URI } from 'vs/base/common/uri';
99
import { IWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
@@ -29,8 +29,8 @@ import { IWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
2929
* => no longer being used (used for empty workspaces previously)
3030
*/
3131

32-
const EMPTY_WORKSPACE_PREFIX = `${StorageService.COMMON_PREFIX}workspace/empty:`;
33-
const MULTI_ROOT_WORKSPACE_PREFIX = `${StorageService.COMMON_PREFIX}workspace/root:`;
32+
const EMPTY_WORKSPACE_PREFIX = `${StorageLegacyService.COMMON_PREFIX}workspace/empty:`;
33+
const MULTI_ROOT_WORKSPACE_PREFIX = `${StorageLegacyService.COMMON_PREFIX}workspace/root:`;
3434

3535
export type StorageObject = { [key: string]: string };
3636

@@ -44,7 +44,7 @@ export interface IParsedStorage {
4444
/**
4545
* Parses the local storage implementation into global, multi root, folder and empty storage.
4646
*/
47-
export function parseStorage(storage: IStorage): IParsedStorage {
47+
export function parseStorage(storage: IStorageLegacy): IParsedStorage {
4848
const globalStorage = new Map<string, string>();
4949
const folderWorkspacesStorage = new Map<string /* workspace file resource */, StorageObject>();
5050
const emptyWorkspacesStorage = new Map<string /* empty workspace id */, StorageObject>();
@@ -55,14 +55,14 @@ export function parseStorage(storage: IStorage): IParsedStorage {
5555
const key = storage.key(i);
5656

5757
// Workspace Storage (storage://workspace/)
58-
if (startsWith(key, StorageService.WORKSPACE_PREFIX)) {
58+
if (startsWith(key, StorageLegacyService.WORKSPACE_PREFIX)) {
5959

6060
// We are looking for key: storage://workspace/<folder>/workspaceIdentifier to be able to find all folder
6161
// paths that are known to the storage. is the only way how to parse all folder paths known in storage.
62-
if (endsWith(key, StorageService.WORKSPACE_IDENTIFIER)) {
62+
if (endsWith(key, StorageLegacyService.WORKSPACE_IDENTIFIER)) {
6363

6464
// storage://workspace/<folder>/workspaceIdentifier => <folder>/
65-
let workspace = key.substring(StorageService.WORKSPACE_PREFIX.length, key.length - StorageService.WORKSPACE_IDENTIFIER.length);
65+
let workspace = key.substring(StorageLegacyService.WORKSPACE_PREFIX.length, key.length - StorageLegacyService.WORKSPACE_IDENTIFIER.length);
6666

6767
// macOS/Unix: Users/name/folder/
6868
// Windows: c%3A/Users/name/folder/
@@ -76,7 +76,7 @@ export function parseStorage(storage: IStorage): IParsedStorage {
7676
}
7777

7878
// storage://workspace/<folder>/workspaceIdentifier => storage://workspace/<folder>/
79-
const prefix = key.substr(0, key.length - StorageService.WORKSPACE_IDENTIFIER.length);
79+
const prefix = key.substr(0, key.length - StorageLegacyService.WORKSPACE_IDENTIFIER.length);
8080
workspaces.push({ prefix, resource: workspace });
8181
}
8282

@@ -120,11 +120,11 @@ export function parseStorage(storage: IStorage): IParsedStorage {
120120
}
121121

122122
// Global Storage (storage://global)
123-
else if (startsWith(key, StorageService.GLOBAL_PREFIX)) {
123+
else if (startsWith(key, StorageLegacyService.GLOBAL_PREFIX)) {
124124

125125
// storage://global/someKey => someKey
126-
const globalStorageKey = key.substr(StorageService.GLOBAL_PREFIX.length);
127-
if (startsWith(globalStorageKey, StorageService.COMMON_PREFIX)) {
126+
const globalStorageKey = key.substr(StorageLegacyService.GLOBAL_PREFIX.length);
127+
if (startsWith(globalStorageKey, StorageLegacyService.COMMON_PREFIX)) {
128128
continue; // filter out faulty keys that have the form storage://something/storage://
129129
}
130130

@@ -168,7 +168,7 @@ export function parseStorage(storage: IStorage): IParsedStorage {
168168
};
169169
}
170170

171-
export function migrateStorageToMultiRootWorkspace(fromWorkspaceId: string, toWorkspace: IWorkspaceIdentifier, storage: IStorage): string {
171+
export function migrateStorageToMultiRootWorkspace(fromWorkspaceId: string, toWorkspace: IWorkspaceIdentifier, storage: IStorageLegacy): string {
172172
const parsed = parseStorage(storage);
173173

174174
const newWorkspaceId = URI.from({ path: toWorkspace.id, scheme: 'root' }).toString();
@@ -186,11 +186,11 @@ export function migrateStorageToMultiRootWorkspace(fromWorkspaceId: string, toWo
186186
// Migrate existing storage to new workspace id
187187
if (storageForWorkspace) {
188188
Object.keys(storageForWorkspace).forEach(key => {
189-
if (key === StorageService.WORKSPACE_IDENTIFIER) {
189+
if (key === StorageLegacyService.WORKSPACE_IDENTIFIER) {
190190
return; // make sure to never migrate the workspace identifier
191191
}
192192

193-
storage.setItem(`${StorageService.WORKSPACE_PREFIX}${newWorkspaceId}/${key}`, storageForWorkspace[key]);
193+
storage.setItem(`${StorageLegacyService.WORKSPACE_PREFIX}${newWorkspaceId}/${key}`, storageForWorkspace[key]);
194194
});
195195
}
196196

0 commit comments

Comments
 (0)