Modifying the migration extension to use its own service. (#21781)

* Adding migration service to sql migrations

* enabling auto flush log

* Adding support for env variable

* Adding TDE Migration service

* code cleanup

* updating service downloader

* Removing custom output channel

* remove unnecessary await

* Updated service version to get latest code

* Consolidate TDE into migration service

* Sync to latest main

* Update sql-migration package version

* Fix merge conflict error

* Fixing all merge conflicts

* Fixing stuff

* removing extra whitespace

* Cleaning up

---------

Co-authored-by: Akshay Mata <akma@microsoft.com>
This commit is contained in:
Aasim Khan
2023-02-12 09:59:09 -08:00
committed by GitHub
parent 12a3bf6b3b
commit 837236be0f
18 changed files with 1569 additions and 69 deletions

View File

@@ -0,0 +1,46 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ApiType, MigrationExtensionService } from './features';
import * as constants from '../constants/strings';
import * as vscode from 'vscode';
export class MigrationServiceProvider {
private services: Map<ApiType, MigrationExtensionService> = new Map();
constructor() {
}
public addService(service: MigrationExtensionService) {
this.services.set(service.providerId, service);
}
public async getService(serviceId: ApiType): Promise<MigrationExtensionService> {
if (this.services.has(serviceId)) {
return this.services.get(serviceId)!;
}
return this.waitUntilProviderReady(serviceId);
}
public async waitUntilProviderReady(serviceId: ApiType): Promise<MigrationExtensionService> {
const service = await vscode.window.withProgress({
location: vscode.ProgressLocation.Notification,
title: constants.waitingForService(serviceId),
cancellable: false
}, (progress, token) => {
return new Promise<MigrationExtensionService>(resolve => {
const interval = setInterval(() => {
if (this.services.has(serviceId)) {
clearInterval(interval);
resolve(this.services.get(serviceId)!);
}
}, 250);
});
});
return service;
}
}
export const migrationServiceProvider = new MigrationServiceProvider();