Migration: registering dependencies in program
This commit is contained in:
parent
b6b2490442
commit
326d352a7c
10
ASC.Web.sln
10
ASC.Web.sln
@ -62,7 +62,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Data.Backup", "common\s
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Files.Core", "products\ASC.Files\Core\ASC.Files.Core.csproj", "{F0A39728-940D-4DBE-A37A-05D4EB57F342}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ASC.Data.Storage.Migration", "ASC.Data.Storage.Migration\ASC.Data.Storage.Migration.csproj", "{4182F17A-82DE-4BE5-A5E1-F4886D0C92E4}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ASC.Data.Storage.Migration", "common\ASC.Data.Storage.Migration\ASC.Data.Storage.Migration.csproj", "{43331B08-2E36-4C08-A1EF-0521211B681D}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
@ -182,10 +182,10 @@ Global
|
||||
{F0A39728-940D-4DBE-A37A-05D4EB57F342}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{F0A39728-940D-4DBE-A37A-05D4EB57F342}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{F0A39728-940D-4DBE-A37A-05D4EB57F342}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4182F17A-82DE-4BE5-A5E1-F4886D0C92E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4182F17A-82DE-4BE5-A5E1-F4886D0C92E4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4182F17A-82DE-4BE5-A5E1-F4886D0C92E4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4182F17A-82DE-4BE5-A5E1-F4886D0C92E4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{43331B08-2E36-4C08-A1EF-0521211B681D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{43331B08-2E36-4C08-A1EF-0521211B681D}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{43331B08-2E36-4C08-A1EF-0521211B681D}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{43331B08-2E36-4C08-A1EF-0521211B681D}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
@ -5,9 +5,9 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\common\ASC.Common\ASC.Common.csproj" />
|
||||
<ProjectReference Include="..\common\ASC.Core.Common\ASC.Core.Common.csproj" />
|
||||
<ProjectReference Include="..\common\ASC.Data.Storage\ASC.Data.Storage.csproj" />
|
||||
<ProjectReference Include="..\ASC.Common\ASC.Common.csproj" />
|
||||
<ProjectReference Include="..\ASC.Core.Common\ASC.Core.Common.csproj" />
|
||||
<ProjectReference Include="..\ASC.Data.Storage\ASC.Data.Storage.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -26,6 +26,7 @@
|
||||
|
||||
using System;
|
||||
|
||||
using ASC.Common;
|
||||
using ASC.Common.Logging;
|
||||
using ASC.Common.Threading.Progress;
|
||||
using ASC.Core;
|
||||
@ -85,4 +86,16 @@ namespace ASC.Data.Storage.Migration
|
||||
StorageUploader.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
public static class MigrationServiceExtension
|
||||
{
|
||||
public static DIHelper AddMigrationService(this DIHelper services)
|
||||
{
|
||||
services.TryAddSingleton<MigrationService>();
|
||||
|
||||
return services
|
||||
.AddStaticUploaderService()
|
||||
.AddStorageFactoryConfigService();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,8 +27,7 @@
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using ASC.Core;
|
||||
using ASC.Data.Storage.Configuration;
|
||||
using ASC.Common;
|
||||
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
@ -37,25 +36,14 @@ namespace ASC.Data.Storage.Migration
|
||||
public class MigrationServiceLauncher : IHostedService
|
||||
{
|
||||
public MigrationService MigrationService { get; }
|
||||
public TenantManager TenantManager { get; }
|
||||
public StorageSettings StorageSettings { get; }
|
||||
|
||||
public MigrationServiceLauncher(
|
||||
MigrationService migrationService,
|
||||
TenantManager tenantManager,
|
||||
StorageSettings storageSettings)
|
||||
public MigrationServiceLauncher(MigrationService migrationService)
|
||||
{
|
||||
MigrationService = migrationService;
|
||||
TenantManager = tenantManager;
|
||||
StorageSettings = storageSettings;
|
||||
}
|
||||
|
||||
public Task StartAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
var tenantId = TenantManager.GetCurrentTenant().TenantId;
|
||||
|
||||
MigrationService.Migrate(tenantId, StorageSettings);
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
@ -69,4 +57,13 @@ namespace ASC.Data.Storage.Migration
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
||||
public static class MigrationServiceLauncherExtension
|
||||
{
|
||||
public static DIHelper AddMigrationServiceLauncher(this DIHelper services)
|
||||
{
|
||||
return services
|
||||
.AddMigrationService();
|
||||
}
|
||||
}
|
||||
}
|
@ -6,9 +6,9 @@ using ASC.Common;
|
||||
using ASC.Common.DependencyInjection;
|
||||
using ASC.Common.Logging;
|
||||
using ASC.Core.Common;
|
||||
using ASC.Core.Notify.Senders;
|
||||
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace ASC.Data.Storage.Migration
|
||||
@ -52,10 +52,8 @@ namespace ASC.Data.Storage.Migration
|
||||
|
||||
diHelper.TryAddSingleton<CommonLinkUtilitySettings>();
|
||||
|
||||
diHelper
|
||||
.AddJabberSenderService()
|
||||
.AddSmtpSenderService()
|
||||
.AddAWSSenderService();
|
||||
diHelper.AddMigrationServiceLauncher();
|
||||
services.AddHostedService<MigrationServiceLauncher>();
|
||||
|
||||
services.AddAutofac(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath);
|
||||
})
|
||||
|
@ -19,6 +19,10 @@
|
||||
<None Remove="Selectel\**" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="protos\MigrationCacheItem.proto" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Google.Api.Gax" Version="3.0.0" />
|
||||
<PackageReference Include="Google.Api.Gax.Rest" Version="3.0.0" />
|
||||
@ -42,6 +46,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<Protobuf Include="protos\DataStoreCacheItem.proto" />
|
||||
<Protobuf Include="protos\MigrationCacheItem.proto" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -30,10 +30,12 @@ using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
using ASC.Common.Logging;
|
||||
using ASC.Core;
|
||||
using ASC.Data.Storage.Configuration;
|
||||
using ASC.Security.Cryptography;
|
||||
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
|
@ -26,8 +26,10 @@
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
using ASC.Common.Logging;
|
||||
using ASC.Core.ChunkedUploader;
|
||||
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
namespace ASC.Data.Storage
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
|
||||
using System;
|
||||
|
||||
using ASC.Common.Caching;
|
||||
|
||||
namespace ASC.Data.Storage
|
||||
|
@ -29,7 +29,9 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using ASC.Common.Web;
|
||||
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Routing;
|
||||
|
@ -27,6 +27,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
|
||||
using ASC.Data.Storage;
|
||||
|
||||
public static class Extensions
|
||||
|
@ -27,6 +27,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
using ASC.Data.Storage.Configuration;
|
||||
|
||||
namespace ASC.Data.Storage
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
|
||||
using System.ServiceModel;
|
||||
|
||||
using ASC.Data.Storage.Configuration;
|
||||
|
||||
namespace ASC.Data.Storage.Migration
|
||||
|
@ -29,14 +29,18 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
using ASC.Common.Logging;
|
||||
using ASC.Core;
|
||||
using ASC.Data.Storage.Configuration;
|
||||
using ASC.Security.Cryptography;
|
||||
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
using net.openstack.Core.Domain;
|
||||
using net.openstack.Providers.Rackspace;
|
||||
|
||||
using MimeMapping = ASC.Common.Web.MimeMapping;
|
||||
|
||||
namespace ASC.Data.Storage.RackspaceCloud
|
||||
|
@ -27,9 +27,11 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Amazon;
|
||||
using Amazon.S3;
|
||||
using Amazon.S3.Model;
|
||||
|
||||
using ASC.Core;
|
||||
|
||||
namespace ASC.Data.Storage.S3
|
||||
|
@ -26,7 +26,9 @@
|
||||
|
||||
using System;
|
||||
using System.Web;
|
||||
|
||||
using ASC.Common.Logging;
|
||||
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.Extensions.Options;
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
||||
using ASC.Core;
|
||||
using ASC.Core.Tenants;
|
||||
|
||||
|
8
common/ASC.Data.Storage/protos/MigrationCacheItem.proto
Normal file
8
common/ASC.Data.Storage/protos/MigrationCacheItem.proto
Normal file
@ -0,0 +1,8 @@
|
||||
syntax = "proto3";
|
||||
|
||||
message MigrationCacheItem {
|
||||
int32 Tenant = 1;
|
||||
int32 TenantId = 2;
|
||||
string RelativePath = 3;
|
||||
string MappedPath = 4;
|
||||
}
|
Loading…
Reference in New Issue
Block a user