Merge pull request #488 from ONLYOFFICE/feature/support-elasticache
Feature/support elasticache
This commit is contained in:
commit
a7648624a6
@ -1,23 +1,33 @@
|
||||
@echo off
|
||||
|
||||
PUSHD %~dp0..
|
||||
dotnet build ASC.Web.slnf /fl1 /flp1:LogFile=build/ASC.Web.log;Verbosity=Normal
|
||||
echo.
|
||||
echo Install nodejs projects dependencies...
|
||||
echo Start build backend...
|
||||
echo.
|
||||
|
||||
cd /D "%~dp0"
|
||||
call runasadmin.bat "%~dpnx0"
|
||||
|
||||
if %errorlevel% == 0 (
|
||||
for /R "build\scripts\" %%f in (*.bat) do (
|
||||
call start\stop.bat nopause
|
||||
dotnet build ..\asc.web.slnf /fl1 /flp1:logfile=asc.web.log;verbosity=normal
|
||||
echo.
|
||||
|
||||
call start\start.bat nopause
|
||||
|
||||
echo install nodejs projects dependencies...
|
||||
echo.
|
||||
|
||||
|
||||
for /R "scripts\" %%f in (*.bat) do (
|
||||
echo Run script %%~nxf...
|
||||
echo.
|
||||
call build\scripts\%%~nxf
|
||||
)
|
||||
call scripts\%%~nxf
|
||||
)
|
||||
|
||||
echo.
|
||||
|
||||
POPD
|
||||
|
||||
if "%1"=="nopause" goto start
|
||||
if "%1"=="nopause" goto end
|
||||
pause
|
||||
:start
|
||||
|
||||
)
|
||||
|
||||
:end
|
@ -1,6 +1,6 @@
|
||||
@echo off
|
||||
|
||||
PUSHD %~dp0
|
||||
cd /D "%~dp0"
|
||||
call runasadmin.bat "%~dpnx0"
|
||||
|
||||
if %errorlevel% == 0 (
|
||||
|
@ -6,14 +6,11 @@ echo "##########################################################"
|
||||
|
||||
echo.
|
||||
|
||||
PUSHD %~dp0
|
||||
setlocal EnableDelayedExpansion
|
||||
|
||||
cd /D "%~dp0"
|
||||
call runasadmin.bat "%~dpnx0"
|
||||
|
||||
if %errorlevel% == 0 (
|
||||
|
||||
call start\stop.bat nopause
|
||||
|
||||
echo "FRONT-END static"
|
||||
call build.static.bat nopause
|
||||
@ -21,9 +18,8 @@ call build.static.bat nopause
|
||||
echo "BACK-END"
|
||||
call build.backend.bat nopause
|
||||
|
||||
call start\start.bat nopause
|
||||
|
||||
echo.
|
||||
|
||||
pause
|
||||
|
||||
)
|
@ -1 +1 @@
|
||||
yarn install --cwd common/ASC.UrlShortener/ --frozen-lockfile
|
||||
yarn install --cwd %~dp0../../common/ASC.UrlShortener/ --frozen-lockfile
|
@ -23,6 +23,7 @@ using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Builder;
|
||||
using Microsoft.AspNetCore.Diagnostics.HealthChecks;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.AspNetCore.Http.Extensions;
|
||||
using Microsoft.AspNetCore.HttpOverrides;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.AspNetCore.Mvc.Authorization;
|
||||
@ -34,6 +35,8 @@ using Microsoft.Extensions.Hosting;
|
||||
using NLog;
|
||||
using NLog.Extensions.Logging;
|
||||
|
||||
using StackExchange.Redis.Extensions.Core.Configuration;
|
||||
|
||||
namespace ASC.Api.Core
|
||||
{
|
||||
public abstract class BaseStartup
|
||||
@ -101,7 +104,18 @@ namespace ASC.Api.Core
|
||||
DIHelper.TryAdd<CookieAuthHandler>();
|
||||
DIHelper.TryAdd<WebhooksGlobalFilterAttribute>();
|
||||
|
||||
DIHelper.TryAdd(typeof(ICacheNotify<>), typeof(KafkaCache<>));
|
||||
var redisConfiguration = Configuration.GetSection("Redis").Get<RedisConfiguration>();
|
||||
|
||||
if (redisConfiguration != null)
|
||||
{
|
||||
DIHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>));
|
||||
}
|
||||
else
|
||||
{
|
||||
DIHelper.TryAdd(typeof(ICacheNotify<>), typeof(MemoryCacheNotify<>));
|
||||
}
|
||||
|
||||
|
||||
DIHelper.TryAdd(typeof(IWebhookPublisher), typeof(WebhookPublisher));
|
||||
|
||||
if (LoadProducts)
|
||||
|
@ -32,8 +32,8 @@
|
||||
<PackageReference Include="Autofac.Configuration" Version="6.0.0" />
|
||||
<PackageReference Include="AutoMapper" Version="10.1.1" />
|
||||
<PackageReference Include="Confluent.Kafka" Version="1.4.3" />
|
||||
<PackageReference Include="Google.Protobuf" Version="3.14.0" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.32.0">
|
||||
<PackageReference Include="Google.Protobuf" Version="3.19.1" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.40.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
@ -55,12 +55,14 @@
|
||||
</PackageReference> -->
|
||||
<PackageReference Include="NLog" Version="4.7.10" />
|
||||
<PackageReference Include="NVelocity" Version="1.2.0" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.2.88" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.Core" Version="7.2.1" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Protobuf Include="protos\AscCacheItem.proto" />
|
||||
<Protobuf Include="protos\NotifyItem.proto" />
|
||||
<Protobuf Include="protos\DistributedTaskCache.proto" />
|
||||
<Protobuf Include="protos\DistributedTaskCancelation.proto" />
|
||||
<Protobuf Include="protos\asc_cache_item.proto" />
|
||||
<Protobuf Include="protos\notify_item.proto" />
|
||||
<Protobuf Include="protos\distributed_task_cache.proto" />
|
||||
<Protobuf Include="protos\distributed_task_cancelation.proto" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Notify\" />
|
||||
|
@ -50,7 +50,7 @@ namespace ASC.Common.Caching
|
||||
|
||||
public void ClearCache()
|
||||
{
|
||||
CacheNotify.Publish(new AscCacheItem { Id = ByteString.CopyFrom(Guid.NewGuid().ToByteArray()) }, CacheNotifyAction.Any);
|
||||
CacheNotify.Publish(new AscCacheItem { Id = Guid.NewGuid().ToString() }, CacheNotifyAction.Any);
|
||||
}
|
||||
|
||||
public static void OnClearCache()
|
||||
|
@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
@ -24,8 +23,6 @@ namespace ASC.Common.Caching
|
||||
private ILog Log { get; set; }
|
||||
private ConcurrentDictionary<string, CancellationTokenSource> Cts { get; set; }
|
||||
private ConcurrentDictionary<string, Action<T>> Actions { get; set; }
|
||||
private MemoryCacheNotify<T> MemoryCacheNotify { get; set; }
|
||||
private string ChannelName { get; } = $"ascchannel{typeof(T).Name}";
|
||||
private ProtobufSerializer<T> ValueSerializer { get; } = new ProtobufSerializer<T>();
|
||||
private ProtobufDeserializer<T> ValueDeserializer { get; } = new ProtobufDeserializer<T>();
|
||||
private ProtobufSerializer<AscCacheItem> KeySerializer { get; } = new ProtobufSerializer<AscCacheItem>();
|
||||
@ -41,26 +38,13 @@ namespace ASC.Common.Caching
|
||||
Key = Guid.NewGuid();
|
||||
|
||||
var settings = configuration.GetSetting<KafkaSettings>("kafka");
|
||||
if (settings != null && !string.IsNullOrEmpty(settings.BootstrapServers))
|
||||
{
|
||||
|
||||
ClientConfig = new ClientConfig { BootstrapServers = settings.BootstrapServers };
|
||||
AdminClientConfig = new AdminClientConfig { BootstrapServers = settings.BootstrapServers };
|
||||
}
|
||||
else
|
||||
{
|
||||
MemoryCacheNotify = new MemoryCacheNotify<T>();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void Publish(T obj, CacheNotifyAction cacheNotifyAction)
|
||||
{
|
||||
if (ClientConfig == null)
|
||||
{
|
||||
MemoryCacheNotify.Publish(obj, cacheNotifyAction);
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (Producer == null)
|
||||
@ -84,7 +68,7 @@ namespace ASC.Common.Caching
|
||||
Value = obj,
|
||||
Key = new AscCacheItem
|
||||
{
|
||||
Id = ByteString.CopyFrom(Key.ToByteArray())
|
||||
Id = Key.ToString()
|
||||
}
|
||||
};
|
||||
|
||||
@ -102,12 +86,8 @@ namespace ASC.Common.Caching
|
||||
|
||||
public void Subscribe(Action<T> onchange, CacheNotifyAction cacheNotifyAction)
|
||||
{
|
||||
if (ClientConfig == null)
|
||||
{
|
||||
MemoryCacheNotify.Subscribe(onchange, cacheNotifyAction);
|
||||
return;
|
||||
}
|
||||
var channelName = GetChannelName(cacheNotifyAction);
|
||||
|
||||
Cts[channelName] = new CancellationTokenSource();
|
||||
Actions[channelName] = onchange;
|
||||
|
||||
@ -137,7 +117,7 @@ namespace ASC.Common.Caching
|
||||
}
|
||||
}).Wait();
|
||||
}
|
||||
catch(AggregateException)
|
||||
catch (AggregateException)
|
||||
{
|
||||
|
||||
}
|
||||
@ -159,7 +139,7 @@ namespace ASC.Common.Caching
|
||||
try
|
||||
{
|
||||
var cr = c.Consume(Cts[channelName].Token);
|
||||
if (cr != null && cr.Message != null && cr.Message.Value != null && !(new Guid(cr.Message.Key.Id.ToByteArray())).Equals(Key) && Actions.TryGetValue(channelName, out var act))
|
||||
if (cr != null && cr.Message != null && cr.Message.Value != null && !(new Guid(cr.Message.Key.Id)).Equals(Key) && Actions.TryGetValue(channelName, out var act))
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -189,7 +169,7 @@ namespace ASC.Common.Caching
|
||||
|
||||
private string GetChannelName(CacheNotifyAction cacheNotifyAction)
|
||||
{
|
||||
return $"{ChannelName}{cacheNotifyAction}";
|
||||
return $"asc:channel:{cacheNotifyAction}:{typeof(T).FullName}".ToLower();
|
||||
}
|
||||
|
||||
public void Unsubscribe(CacheNotifyAction action)
|
||||
@ -231,40 +211,4 @@ namespace ASC.Common.Caching
|
||||
{
|
||||
public string BootstrapServers { get; set; }
|
||||
}
|
||||
|
||||
public class MemoryCacheNotify<T> : ICacheNotify<T> where T : IMessage<T>, new()
|
||||
{
|
||||
private readonly Dictionary<string, List<Action<T>>> actions = new Dictionary<string, List<Action<T>>>();
|
||||
|
||||
public void Publish(T obj, CacheNotifyAction action)
|
||||
{
|
||||
if (actions.TryGetValue(GetKey(action), out var onchange) && onchange != null)
|
||||
{
|
||||
foreach (var a in onchange)
|
||||
{
|
||||
a(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Subscribe(Action<T> onchange, CacheNotifyAction notifyAction)
|
||||
{
|
||||
if (onchange != null)
|
||||
{
|
||||
var key = GetKey(notifyAction);
|
||||
actions.TryAdd(key, new List<Action<T>>());
|
||||
actions[key].Add(onchange);
|
||||
}
|
||||
}
|
||||
|
||||
public void Unsubscribe(CacheNotifyAction action)
|
||||
{
|
||||
actions.Remove(GetKey(action));
|
||||
}
|
||||
|
||||
private string GetKey(CacheNotifyAction cacheNotifyAction)
|
||||
{
|
||||
return $"{typeof(T).Name}{cacheNotifyAction}";
|
||||
}
|
||||
}
|
||||
}
|
48
common/ASC.Common/Caching/MemoryCacheNotify.cs
Normal file
48
common/ASC.Common/Caching/MemoryCacheNotify.cs
Normal file
@ -0,0 +1,48 @@
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Google.Protobuf;
|
||||
|
||||
namespace ASC.Common.Caching
|
||||
{
|
||||
[Singletone]
|
||||
public class MemoryCacheNotify<T> : ICacheNotify<T> where T : IMessage<T>, new()
|
||||
{
|
||||
private readonly ConcurrentDictionary<string, List<Action<T>>> _actions;
|
||||
|
||||
public MemoryCacheNotify()
|
||||
{
|
||||
_actions = new ConcurrentDictionary<string, List<Action<T>>>();
|
||||
}
|
||||
|
||||
public void Publish(T obj, CacheNotifyAction action)
|
||||
{
|
||||
if (_actions.TryGetValue(GetKey(action), out var onchange) && onchange != null)
|
||||
{
|
||||
Parallel.ForEach(onchange, a => a(obj));
|
||||
}
|
||||
}
|
||||
|
||||
public void Subscribe(Action<T> onchange, CacheNotifyAction notifyAction)
|
||||
{
|
||||
if (onchange != null)
|
||||
{
|
||||
var key = GetKey(notifyAction);
|
||||
_actions.TryAdd(key, new List<Action<T>>());
|
||||
_actions[key].Add(onchange);
|
||||
}
|
||||
}
|
||||
|
||||
public void Unsubscribe(CacheNotifyAction action)
|
||||
{
|
||||
_actions.TryRemove(GetKey(action), out _);
|
||||
}
|
||||
|
||||
private string GetKey(CacheNotifyAction cacheNotifyAction)
|
||||
{
|
||||
return $"asc:channel:{cacheNotifyAction}:{typeof(T).FullName}".ToLower();
|
||||
}
|
||||
}
|
||||
}
|
78
common/ASC.Common/Caching/RedisCache.cs
Normal file
78
common/ASC.Common/Caching/RedisCache.cs
Normal file
@ -0,0 +1,78 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System Limited 2010-2021
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Google.Protobuf;
|
||||
|
||||
using StackExchange.Redis.Extensions.Core.Abstractions;
|
||||
|
||||
namespace ASC.Common.Caching;
|
||||
|
||||
[Singletone]
|
||||
public class RedisCache<T> : ICacheNotify<T> where T : IMessage<T>, new()
|
||||
{
|
||||
private readonly IRedisDatabase _redis;
|
||||
|
||||
public RedisCache(IRedisCacheClient redisCacheClient)
|
||||
{
|
||||
_redis = redisCacheClient.GetDbFromConfiguration();
|
||||
}
|
||||
|
||||
public void Publish(T obj, CacheNotifyAction action)
|
||||
{
|
||||
Task.Run(() => _redis.PublishAsync(GetChannelName(action), new RedisCachePubSubItem<T>() { Object = obj, Action = action }))
|
||||
.GetAwaiter()
|
||||
.GetResult();
|
||||
}
|
||||
|
||||
public void Subscribe(Action<T> onchange, CacheNotifyAction action)
|
||||
{
|
||||
Task.Run(() => _redis.SubscribeAsync<RedisCachePubSubItem<T>>(GetChannelName(action), (i) =>
|
||||
{
|
||||
onchange(i.Object);
|
||||
|
||||
return Task.FromResult(true);
|
||||
})).GetAwaiter()
|
||||
.GetResult();
|
||||
}
|
||||
|
||||
public void Unsubscribe(CacheNotifyAction action)
|
||||
{
|
||||
Task.Run(() => _redis.UnsubscribeAsync<RedisCachePubSubItem<T>>(GetChannelName(action), (i) =>
|
||||
{
|
||||
return Task.FromResult(true);
|
||||
})).GetAwaiter()
|
||||
.GetResult();
|
||||
}
|
||||
|
||||
private string GetChannelName(CacheNotifyAction cacheNotifyAction)
|
||||
{
|
||||
return $"asc:channel:{cacheNotifyAction}:{typeof(T).FullName}".ToLower();
|
||||
}
|
||||
|
||||
class RedisCachePubSubItem<T0>
|
||||
{
|
||||
public T0 Object { get; set; }
|
||||
|
||||
public CacheNotifyAction Action { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,21 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package ASC.Common.Threading;
|
||||
|
||||
message DistributedTaskCache {
|
||||
string Id = 1;
|
||||
int32 InstanceId = 2;
|
||||
string Status = 3;
|
||||
string Exception = 4;
|
||||
repeated DistributedTaskCacheProp Props = 5;
|
||||
string Key = 6;
|
||||
double Percentage = 7;
|
||||
bool IsCompleted = 8;
|
||||
int32 StepCount = 9;
|
||||
|
||||
message DistributedTaskCacheProp
|
||||
{
|
||||
string Key = 1;
|
||||
string Value = 2;
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
syntax = "proto3";
|
||||
import "google/protobuf/wrappers.proto";
|
||||
package ASC.Notify.Model;
|
||||
|
||||
message NotifyItem {
|
||||
NotifyActionItem Action = 1;
|
||||
string ObjectID = 2;
|
||||
repeated Recipient Recipients = 3;
|
||||
repeated string SenderNames = 4;
|
||||
repeated Tag Tags = 5;
|
||||
bool CheckSubsciption = 6;
|
||||
int32 TenantId = 7;
|
||||
string UserId = 8;
|
||||
string BaseUrl = 9;
|
||||
}
|
||||
|
||||
message NotifyActionItem {
|
||||
string ID = 1;
|
||||
}
|
||||
|
||||
message Recipient {
|
||||
string ID = 1;
|
||||
google.protobuf.StringValue Name = 2;
|
||||
bool CheckActivation = 3;
|
||||
repeated string Addresses = 4;
|
||||
bool IsGroup = 5;
|
||||
}
|
||||
|
||||
message Tag {
|
||||
string Tag = 1;
|
||||
string Value = 2;
|
||||
}
|
@ -3,5 +3,5 @@
|
||||
package ASC.Common;
|
||||
|
||||
message AscCacheItem {
|
||||
bytes Id = 1;
|
||||
string id = 1;
|
||||
}
|
21
common/ASC.Common/protos/distributed_task_cache.proto
Normal file
21
common/ASC.Common/protos/distributed_task_cache.proto
Normal file
@ -0,0 +1,21 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package ASC.Common.Threading;
|
||||
|
||||
message DistributedTaskCache {
|
||||
string id = 1;
|
||||
int32 instance_id = 2;
|
||||
string status = 3;
|
||||
string exception = 4;
|
||||
repeated DistributedTaskCacheProp props = 5;
|
||||
string key = 6;
|
||||
double percentage = 7;
|
||||
bool is_completed = 8;
|
||||
int32 step_count = 9;
|
||||
|
||||
message DistributedTaskCacheProp
|
||||
{
|
||||
string key = 1;
|
||||
string value = 2;
|
||||
}
|
||||
}
|
@ -3,5 +3,5 @@
|
||||
package ASC.Common.Threading;
|
||||
|
||||
message DistributedTaskCancelation {
|
||||
string Id = 1;
|
||||
string id = 1;
|
||||
}
|
32
common/ASC.Common/protos/notify_item.proto
Normal file
32
common/ASC.Common/protos/notify_item.proto
Normal file
@ -0,0 +1,32 @@
|
||||
syntax = "proto3";
|
||||
import "google/protobuf/wrappers.proto";
|
||||
package ASC.Notify.Model;
|
||||
|
||||
message NotifyItem {
|
||||
NotifyActionItem action = 1;
|
||||
string object_id = 2;
|
||||
repeated Recipient recipients = 3;
|
||||
repeated string sender_names = 4;
|
||||
repeated Tag tags = 5;
|
||||
bool check_subsciption = 6;
|
||||
int32 tenant_id = 7;
|
||||
string user_id = 8;
|
||||
string base_url = 9;
|
||||
}
|
||||
|
||||
message NotifyActionItem {
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message Recipient {
|
||||
string id = 1;
|
||||
google.protobuf.StringValue name = 2;
|
||||
bool check_activation = 3;
|
||||
repeated string addresses = 4;
|
||||
bool is_group = 5;
|
||||
}
|
||||
|
||||
message Tag {
|
||||
string tag = 1;
|
||||
string value = 2;
|
||||
}
|
@ -29,29 +29,29 @@
|
||||
<Compile Remove="Notify\Jabber\IReverseJabberService.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="protos\AzRecordCache.proto" />
|
||||
<None Remove="protos\ConsumerCacheItem.proto" />
|
||||
<None Remove="protos\CreateClientProto.proto" />
|
||||
<None Remove="protos\DisableClientProto.proto" />
|
||||
<None Remove="protos\EncryptionSettingsProto.proto" />
|
||||
<None Remove="protos\GroupCacheItem.proto" />
|
||||
<None Remove="protos\NotifyInvoke.proto" />
|
||||
<None Remove="protos\NotifyMessage.proto" />
|
||||
<None Remove="protos\QuotaCacheItem.proto" />
|
||||
<None Remove="protos\RegisterUserProto.proto" />
|
||||
<None Remove="protos\SettingsCacheItem.proto" />
|
||||
<None Remove="protos\SubscriptionMethodCache.proto" />
|
||||
<None Remove="protos\SubscriptionRecord.proto" />
|
||||
<None Remove="protos\TenantCacheItem.proto" />
|
||||
<None Remove="protos\TenantSetting.proto" />
|
||||
<None Remove="protos\UserGroupRefCacheItem.proto" />
|
||||
<None Remove="protos\UserInfoCacheItem.proto" />
|
||||
<None Remove="protos\UserPhotoCacheItem.proto" />
|
||||
<None Remove="protos\az_record_cache.proto" />
|
||||
<None Remove="protos\consumer_cache_item.proto" />
|
||||
<None Remove="protos\create_client_proto.proto" />
|
||||
<None Remove="protos\disable_client_proto.proto" />
|
||||
<None Remove="protos\encryption_settings_proto.proto" />
|
||||
<None Remove="protos\group_cache_item.proto" />
|
||||
<None Remove="protos\notify_invoke.proto" />
|
||||
<None Remove="protos\notify_message.proto" />
|
||||
<None Remove="protos\quota_cache_item.proto" />
|
||||
<None Remove="protos\register_user_proto.proto" />
|
||||
<None Remove="protos\settings_cache_item.proto" />
|
||||
<None Remove="protos\subscription_method_cache.proto" />
|
||||
<None Remove="protos\subscription_record.proto" />
|
||||
<None Remove="protos\tenant_cache_item.proto" />
|
||||
<None Remove="protos\tenant_setting.proto" />
|
||||
<None Remove="protos\user_group_ref_cache_item.proto" />
|
||||
<None Remove="protos\user_info_cache_item.proto" />
|
||||
<None Remove="protos\user_photo_cache_item.proto" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AWSSDK.Core" Version="3.5.1.25" />
|
||||
<PackageReference Include="AWSSDK.SimpleEmail" Version="3.5.0.27" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.32.0">
|
||||
<PackageReference Include="Grpc.Tools" Version="2.40.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
@ -61,25 +61,25 @@
|
||||
<PackageReference Include="Telegram.Bot" Version="15.7.1" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Protobuf Include="protos\CreateClientProto.proto" />
|
||||
<Protobuf Include="protos\EncryptionSettingsProto.proto" />
|
||||
<Protobuf Include="protos\NotifyInvoke.proto" />
|
||||
<Protobuf Include="protos\NotifyMessage.proto" />
|
||||
<Protobuf Include="protos\DisableClientProto.proto" />
|
||||
<Protobuf Include="protos\RegisterUserProto.proto" />
|
||||
<Protobuf Include="protos\SettingsCacheItem.proto" />
|
||||
<Protobuf Include="protos\ConsumerCacheItem.proto" />
|
||||
<Protobuf Include="protos\TenantCacheItem.proto" />
|
||||
<Protobuf Include="protos\GroupCacheItem.proto" />
|
||||
<Protobuf Include="protos\UserGroupRefCacheItem.proto" />
|
||||
<Protobuf Include="protos\UserInfoCacheItem.proto" />
|
||||
<Protobuf Include="protos\UserPhotoCacheItem.proto" />
|
||||
<Protobuf Include="protos\TenantSetting.proto" />
|
||||
<Protobuf Include="protos\SubscriptionMethodCache.proto" />
|
||||
<Protobuf Include="protos\SubscriptionRecord.proto" />
|
||||
<Protobuf Include="protos\TariffCacheItem.proto" />
|
||||
<Protobuf Include="protos\AzRecordCache.proto" />
|
||||
<Protobuf Include="protos\QuotaCacheItem.proto" />
|
||||
<Protobuf Include="protos\create_client_proto.proto" />
|
||||
<Protobuf Include="protos\encryption_settings_proto.proto" />
|
||||
<Protobuf Include="protos\notify_invoke.proto" />
|
||||
<Protobuf Include="protos\notify_message.proto" />
|
||||
<Protobuf Include="protos\disable_client_proto.proto" />
|
||||
<Protobuf Include="protos\register_user_proto.proto" />
|
||||
<Protobuf Include="protos\settings_cache_item.proto" />
|
||||
<Protobuf Include="protos\consumer_cache_item.proto" />
|
||||
<Protobuf Include="protos\tenant_cache_item.proto" />
|
||||
<Protobuf Include="protos\group_cache_item.proto" />
|
||||
<Protobuf Include="protos\user_group_ref_cache_item.proto" />
|
||||
<Protobuf Include="protos\user_info_cache_item.proto" />
|
||||
<Protobuf Include="protos\user_photo_cache_item.proto" />
|
||||
<Protobuf Include="protos\tenant_setting.proto" />
|
||||
<Protobuf Include="protos\subscription_method_cache.proto" />
|
||||
<Protobuf Include="protos\subscription_record.proto" />
|
||||
<Protobuf Include="protos\tariff_cache_item.proto" />
|
||||
<Protobuf Include="protos\az_record_cache.proto" />
|
||||
<Protobuf Include="protos\quota_cache_item.proto" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Migrations\MySql\DbContextMySql\" />
|
||||
|
@ -85,7 +85,7 @@ namespace ASC.Core.Caching
|
||||
{
|
||||
if (userInfo != null)
|
||||
{
|
||||
var key = GetUserCacheKey(userInfo.Tenant, userInfo.ID.FromByteString());
|
||||
var key = GetUserCacheKey(userInfo.Tenant, new Guid(userInfo.Id));
|
||||
Cache.Remove(key);
|
||||
}
|
||||
}
|
||||
@ -275,14 +275,14 @@ namespace ASC.Core.Caching
|
||||
public UserInfo SaveUser(int tenant, UserInfo user)
|
||||
{
|
||||
user = Service.SaveUser(tenant, user);
|
||||
CacheUserInfoItem.Publish(new UserInfoCacheItem { ID = user.ID.ToByteString(), Tenant = tenant }, CacheNotifyAction.Any);
|
||||
CacheUserInfoItem.Publish(new UserInfoCacheItem { Id = user.ID.ToString(), Tenant = tenant }, CacheNotifyAction.Any);
|
||||
return user;
|
||||
}
|
||||
|
||||
public void RemoveUser(int tenant, Guid id)
|
||||
{
|
||||
Service.RemoveUser(tenant, id);
|
||||
CacheUserInfoItem.Publish(new UserInfoCacheItem { Tenant = tenant, ID = id.ToByteString() }, CacheNotifyAction.Any);
|
||||
CacheUserInfoItem.Publish(new UserInfoCacheItem { Tenant = tenant, Id = id.ToString() }, CacheNotifyAction.Any);
|
||||
}
|
||||
|
||||
public byte[] GetUserPhoto(int tenant, Guid id)
|
||||
@ -330,14 +330,14 @@ namespace ASC.Core.Caching
|
||||
public Group SaveGroup(int tenant, Group group)
|
||||
{
|
||||
group = Service.SaveGroup(tenant, group);
|
||||
CacheGroupCacheItem.Publish(new GroupCacheItem { ID = group.Id.ToString() }, CacheNotifyAction.Any);
|
||||
CacheGroupCacheItem.Publish(new GroupCacheItem { Id = group.Id.ToString() }, CacheNotifyAction.Any);
|
||||
return group;
|
||||
}
|
||||
|
||||
public void RemoveGroup(int tenant, Guid id)
|
||||
{
|
||||
Service.RemoveGroup(tenant, id);
|
||||
CacheGroupCacheItem.Publish(new GroupCacheItem { ID = id.ToString() }, CacheNotifyAction.Any);
|
||||
CacheGroupCacheItem.Publish(new GroupCacheItem { Id = id.ToString() }, CacheNotifyAction.Any);
|
||||
}
|
||||
|
||||
|
||||
|
@ -83,8 +83,8 @@ namespace ASC.Core
|
||||
{
|
||||
var result = new UserGroupRef
|
||||
{
|
||||
UserId = cache.UserId.FromByteString(),
|
||||
GroupId = cache.GroupId.FromByteString()
|
||||
UserId = new Guid(cache.UserId),
|
||||
GroupId = new Guid(cache.GroupId)
|
||||
};
|
||||
|
||||
if (Enum.TryParse<UserGroupRefType>(cache.RefType, out var refType))
|
||||
@ -103,8 +103,8 @@ namespace ASC.Core
|
||||
{
|
||||
return new UserGroupRefCacheItem
|
||||
{
|
||||
GroupId = cache.GroupId.ToByteString(),
|
||||
UserId = cache.UserId.ToByteString(),
|
||||
GroupId = cache.GroupId.ToString(),
|
||||
UserId = cache.UserId.ToString(),
|
||||
RefType = cache.RefType.ToString(),
|
||||
LastModified = cache.LastModified.Ticks,
|
||||
Removed = cache.Removed,
|
||||
|
@ -49,12 +49,12 @@ namespace ASC.Notify.Model
|
||||
|
||||
public static implicit operator NotifyActionItem(NotifyAction cache)
|
||||
{
|
||||
return new NotifyActionItem() { ID = cache.ID };
|
||||
return new NotifyActionItem() { Id = cache.ID };
|
||||
}
|
||||
|
||||
public static explicit operator NotifyAction(NotifyActionItem cache)
|
||||
{
|
||||
return new NotifyAction(cache.ID);
|
||||
return new NotifyAction(cache.Id);
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
|
@ -1,15 +0,0 @@
|
||||
syntax = "proto3";
|
||||
import "google/protobuf/wrappers.proto";
|
||||
package ASC.Core;
|
||||
|
||||
message AzRecordCache {
|
||||
google.protobuf.StringValue SubjectId = 1;
|
||||
|
||||
google.protobuf.StringValue ActionId = 2;
|
||||
|
||||
google.protobuf.StringValue ObjectId = 3;
|
||||
|
||||
google.protobuf.StringValue Reaction = 4;
|
||||
|
||||
int32 Tenant = 5;
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package ASC.Core.Common.Notify;
|
||||
|
||||
message CreateClientProto {
|
||||
int32 TenantId = 1;
|
||||
string Token = 2;
|
||||
int32 TokenLifespan = 3;
|
||||
string Proxy = 4;
|
||||
string Time = 5;
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package ASC.Core.Encryption;
|
||||
|
||||
message EncryptionSettingsProto {
|
||||
string password = 1;
|
||||
EncryprtionStatus Status = 2;
|
||||
bool NotifyUsers = 3;
|
||||
string ServerRootPath = 4;
|
||||
}
|
||||
|
||||
enum EncryprtionStatus {
|
||||
Decrypted = 0;
|
||||
EncryptionStarted = 1;
|
||||
Encrypted = 2;
|
||||
DecryptionStarted = 3;
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package ASC.Notify.Messages;
|
||||
|
||||
message NotifyInvoke {
|
||||
string Service = 1;
|
||||
string Method = 2;
|
||||
int32 Tenant = 3;
|
||||
repeated string Parameters = 4;
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package ASC.Notify.Messages;
|
||||
|
||||
message NotifyMessage {
|
||||
int32 Tenant = 1;
|
||||
string Sender = 2;
|
||||
string From = 3;
|
||||
string To = 4;
|
||||
string ReplyTo = 5;
|
||||
string Subject = 6;
|
||||
string ContentType = 7;
|
||||
string Content = 8;
|
||||
int64 CreationDate = 9;
|
||||
int32 Priority = 10;
|
||||
repeated NotifyMessageAttachment EmbeddedAttachments = 11;
|
||||
string AutoSubmitted = 12;
|
||||
}
|
||||
message NotifyMessageAttachment {
|
||||
string FileName = 1;
|
||||
string ContentId = 2;
|
||||
bytes Content = 3;
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package ASC.Core;
|
||||
|
||||
message SubscriptionMethodCache {
|
||||
string RecipientId = 1;
|
||||
|
||||
string ActionId = 2;
|
||||
|
||||
string SourceId = 3;
|
||||
|
||||
repeated string Methods = 4;
|
||||
|
||||
int32 Tenant = 5;
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package ASC.Core;
|
||||
|
||||
message SubscriptionRecord {
|
||||
string RecipientId = 1;
|
||||
|
||||
string ActionId = 2;
|
||||
|
||||
string ObjectId = 3;
|
||||
|
||||
string SourceId = 4;
|
||||
|
||||
bool Subscribed = 5;
|
||||
|
||||
int32 Tenant = 6;
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package ASC.Core.Caching;
|
||||
|
||||
message UserGroupRefCacheItem {
|
||||
bytes UserId = 1;
|
||||
bytes GroupId = 2;
|
||||
bool Removed = 3;
|
||||
string RefType = 4;
|
||||
int64 LastModified = 5;
|
||||
int32 Tenant = 6;
|
||||
}
|
15
common/ASC.Core.Common/protos/az_record_cache.proto
Normal file
15
common/ASC.Core.Common/protos/az_record_cache.proto
Normal file
@ -0,0 +1,15 @@
|
||||
syntax = "proto3";
|
||||
import "google/protobuf/wrappers.proto";
|
||||
package ASC.Core;
|
||||
|
||||
message AzRecordCache {
|
||||
google.protobuf.StringValue subject_id = 1;
|
||||
|
||||
google.protobuf.StringValue action_id = 2;
|
||||
|
||||
google.protobuf.StringValue object_id = 3;
|
||||
|
||||
google.protobuf.StringValue reaction = 4;
|
||||
|
||||
int32 tenant = 5;
|
||||
}
|
@ -3,6 +3,6 @@
|
||||
package ASC.Core.Common.Configuration;
|
||||
|
||||
message ConsumerCacheItem {
|
||||
string Name = 1;
|
||||
int32 TenantId = 2;
|
||||
string name = 1;
|
||||
int32 tenant_id = 2;
|
||||
}
|
11
common/ASC.Core.Common/protos/create_client_proto.proto
Normal file
11
common/ASC.Core.Common/protos/create_client_proto.proto
Normal file
@ -0,0 +1,11 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package ASC.Core.Common.Notify;
|
||||
|
||||
message CreateClientProto {
|
||||
int32 tenant_id = 1;
|
||||
string token = 2;
|
||||
int32 token_lifespan = 3;
|
||||
string proxy = 4;
|
||||
string time = 5;
|
||||
}
|
@ -3,5 +3,5 @@
|
||||
package ASC.Core.Common.Notify;
|
||||
|
||||
message DisableClientProto {
|
||||
int32 TenantId= 1;
|
||||
int32 tenant_id= 1;
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package ASC.Core.Encryption;
|
||||
|
||||
message EncryptionSettingsProto {
|
||||
string password = 1;
|
||||
EncryprtionStatus status = 2;
|
||||
bool notify_users = 3;
|
||||
string server_root_path = 4;
|
||||
}
|
||||
|
||||
enum EncryprtionStatus {
|
||||
DECRYPTED = 0;
|
||||
ENCRYPTION_STARTED = 1;
|
||||
ENCRYPTED = 2;
|
||||
DECRYPTION_STARTED = 3;
|
||||
}
|
@ -3,5 +3,5 @@
|
||||
package ASC.Core.Caching;
|
||||
|
||||
message GroupCacheItem {
|
||||
string ID = 1;
|
||||
string id = 1;
|
||||
}
|
10
common/ASC.Core.Common/protos/notify_invoke.proto
Normal file
10
common/ASC.Core.Common/protos/notify_invoke.proto
Normal file
@ -0,0 +1,10 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package ASC.Notify.Messages;
|
||||
|
||||
message NotifyInvoke {
|
||||
string service = 1;
|
||||
string method = 2;
|
||||
int32 tenant = 3;
|
||||
repeated string parameters = 4;
|
||||
}
|
23
common/ASC.Core.Common/protos/notify_message.proto
Normal file
23
common/ASC.Core.Common/protos/notify_message.proto
Normal file
@ -0,0 +1,23 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package ASC.Notify.Messages;
|
||||
|
||||
message NotifyMessage {
|
||||
int32 tenant = 1;
|
||||
string sender = 2;
|
||||
string from = 3;
|
||||
string to = 4;
|
||||
string reply_to = 5;
|
||||
string subject = 6;
|
||||
string content_type = 7;
|
||||
string content = 8;
|
||||
int64 creation_date = 9;
|
||||
int32 priority = 10;
|
||||
repeated NotifyMessageAttachment embedded_attachments = 11;
|
||||
string auto_submitted = 12;
|
||||
}
|
||||
message NotifyMessageAttachment {
|
||||
string FileName = 1;
|
||||
string ContentId = 2;
|
||||
bytes Content = 3;
|
||||
}
|
@ -3,5 +3,5 @@
|
||||
package ASC.Core.Caching;
|
||||
|
||||
message QuotaCacheItem {
|
||||
string Key = 1;
|
||||
string key = 1;
|
||||
}
|
@ -3,7 +3,7 @@
|
||||
package ASC.Core.Common.Notify;
|
||||
|
||||
message RegisterUserProto {
|
||||
string UserId= 1;
|
||||
int32 TenantId= 2;
|
||||
string Token= 3;
|
||||
string user_id= 1;
|
||||
int32 tenant_id= 2;
|
||||
string token= 3;
|
||||
}
|
@ -3,5 +3,5 @@
|
||||
package ASC.Core.Data;
|
||||
|
||||
message SettingsCacheItem {
|
||||
string Key = 1;
|
||||
string key = 1;
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package ASC.Core;
|
||||
|
||||
message SubscriptionMethodCache {
|
||||
string recipient_id = 1;
|
||||
|
||||
string action_id = 2;
|
||||
|
||||
string source_id = 3;
|
||||
|
||||
repeated string methods = 4;
|
||||
|
||||
int32 tenant = 5;
|
||||
}
|
17
common/ASC.Core.Common/protos/subscription_record.proto
Normal file
17
common/ASC.Core.Common/protos/subscription_record.proto
Normal file
@ -0,0 +1,17 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package ASC.Core;
|
||||
|
||||
message SubscriptionRecord {
|
||||
string recipient_id = 1;
|
||||
|
||||
string action_id = 2;
|
||||
|
||||
string object_id = 3;
|
||||
|
||||
string source_id = 4;
|
||||
|
||||
bool subscribed = 5;
|
||||
|
||||
int32 tenant = 6;
|
||||
}
|
@ -3,5 +3,5 @@
|
||||
package ASC.Core.Billing;
|
||||
|
||||
message TariffCacheItem {
|
||||
int32 TenantId = 1;
|
||||
int32 tenant_id = 1;
|
||||
}
|
@ -3,5 +3,5 @@
|
||||
package ASC.Core.Caching;
|
||||
|
||||
message TenantCacheItem {
|
||||
int32 TenantId = 1;
|
||||
int32 tenant_id = 1;
|
||||
}
|
@ -3,5 +3,5 @@
|
||||
package ASC.Core.Caching;
|
||||
|
||||
message TenantSetting {
|
||||
string Key = 1;
|
||||
string key = 1;
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package ASC.Core.Caching;
|
||||
|
||||
message UserGroupRefCacheItem {
|
||||
string user_id = 1;
|
||||
string group_id = 2;
|
||||
bool removed = 3;
|
||||
string ref_type = 4;
|
||||
int64 last_modified = 5;
|
||||
int32 tenant = 6;
|
||||
}
|
@ -3,6 +3,6 @@
|
||||
package ASC.Core.Caching;
|
||||
|
||||
message UserInfoCacheItem {
|
||||
bytes ID = 1;
|
||||
int32 Tenant = 2;
|
||||
string id = 1;
|
||||
int32 tenant = 2;
|
||||
}
|
@ -3,5 +3,5 @@
|
||||
package ASC.Core.Caching;
|
||||
|
||||
message UserPhotoCacheItem {
|
||||
string Key = 1;
|
||||
string key = 1;
|
||||
}
|
@ -8,15 +8,15 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="protos\BackupProgress.proto" />
|
||||
<None Remove="protos\DeleteSchedule.proto" />
|
||||
<None Remove="protos\backup_progress.proto" />
|
||||
<None Remove="protos\delete_schedule.proto" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Grpc" Version="2.32.0">
|
||||
<TreatAsUsed>true</TreatAsUsed>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Grpc.Tools" Version="2.32.0">
|
||||
<PackageReference Include="Grpc.Tools" Version="2.40.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
@ -29,8 +29,8 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Protobuf Include="protos\BackupProgress.proto" />
|
||||
<Protobuf Include="protos\DeleteSchedule.proto" />
|
||||
<Protobuf Include="protos\backup_progress.proto" />
|
||||
<Protobuf Include="protos\delete_schedule.proto" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -1,18 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package ASC.Data.Backup.Contracts;
|
||||
|
||||
message BackupProgress {
|
||||
bool IsCompleted = 1;
|
||||
int32 Progress = 2;
|
||||
string Error = 3;
|
||||
string Link = 4;
|
||||
int32 TenantId = 5;
|
||||
BackupProgressEnum BackupProgressEnum = 6;
|
||||
}
|
||||
|
||||
enum BackupProgressEnum {
|
||||
Backup = 0;
|
||||
Restore = 1;
|
||||
Transfer = 2;
|
||||
}
|
18
common/ASC.Data.Backup.Core/protos/backup_progress.proto
Normal file
18
common/ASC.Data.Backup.Core/protos/backup_progress.proto
Normal file
@ -0,0 +1,18 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package ASC.Data.Backup.Contracts;
|
||||
|
||||
message BackupProgress {
|
||||
bool is_completed = 1;
|
||||
int32 progress = 2;
|
||||
string error = 3;
|
||||
string link = 4;
|
||||
int32 tenant_id = 5;
|
||||
BackupProgressEnum backup_progress_enum = 6;
|
||||
}
|
||||
|
||||
enum BackupProgressEnum {
|
||||
BACKUP = 0;
|
||||
RESTORE = 1;
|
||||
TRANSFER = 2;
|
||||
}
|
@ -3,5 +3,5 @@
|
||||
package ASC.Data.Backup.Contracts;
|
||||
|
||||
message DeleteSchedule {
|
||||
int32 TenantId = 1;
|
||||
int32 tenant_id = 1;
|
||||
}
|
@ -22,11 +22,11 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="protos\EncryptionStop.proto" />
|
||||
<None Remove="protos\MigrationCache.proto" />
|
||||
<None Remove="protos\MigrationProgress.proto" />
|
||||
<None Remove="protos\MigrationUploadCdn.proto" />
|
||||
<None Remove="protos\ProgressEncryption.proto" />
|
||||
<None Remove="protos\encryption_stop.proto" />
|
||||
<None Remove="protos\migration_cache.proto" />
|
||||
<None Remove="protos\migration_progress.proto" />
|
||||
<None Remove="protos\migration_upload_cdn.proto" />
|
||||
<None Remove="protos\progress_encryption.proto" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -38,7 +38,7 @@
|
||||
<PackageReference Include="Google.Apis.Core" Version="1.49.0" />
|
||||
<PackageReference Include="Google.Apis.Storage.v1" Version="1.49.0.2102" />
|
||||
<PackageReference Include="Google.Cloud.Storage.V1" Version="3.3.0" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.32.0">
|
||||
<PackageReference Include="Grpc.Tools" Version="2.40.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
@ -50,12 +50,12 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Protobuf Include="protos\DataStoreCacheItem.proto" />
|
||||
<Protobuf Include="protos\EncryptionStop.proto" />
|
||||
<Protobuf Include="protos\MigrationCache.proto" />
|
||||
<Protobuf Include="protos\MigrationProgress.proto" />
|
||||
<Protobuf Include="protos\MigrationUploadCdn.proto" />
|
||||
<Protobuf Include="protos\ProgressEncryption.proto" />
|
||||
<Protobuf Include="protos\data_store_cache_item.proto" />
|
||||
<Protobuf Include="protos\encryption_stop.proto" />
|
||||
<Protobuf Include="protos\migration_cache.proto" />
|
||||
<Protobuf Include="protos\migration_progress.proto" />
|
||||
<Protobuf Include="protos\migration_upload_cdn.proto" />
|
||||
<Protobuf Include="protos\progress_encryption.proto" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -102,7 +102,7 @@ namespace ASC.Data.Storage.Migration
|
||||
|
||||
public void Migrate(int tenant, StorageSettings storageSettings)
|
||||
{
|
||||
var storSettings = new StorSettings { ID = storageSettings.ID.ToString(), Module = storageSettings.Module };
|
||||
var storSettings = new StorSettings { Id = storageSettings.ID.ToString(), Module = storageSettings.Module };
|
||||
|
||||
CacheMigrationNotify.Publish(new MigrationCache
|
||||
{
|
||||
@ -114,7 +114,7 @@ namespace ASC.Data.Storage.Migration
|
||||
|
||||
public void UploadCdn(int tenantId, string relativePath, string mappedPath, CdnStorageSettings settings = null)
|
||||
{
|
||||
var cdnStorSettings = new CdnStorSettings { ID = settings.ID.ToString(), Module = settings.Module };
|
||||
var cdnStorSettings = new CdnStorSettings { Id = settings.ID.ToString(), Module = settings.Module };
|
||||
|
||||
UploadCdnMigrationNotify.Publish(new MigrationUploadCdn
|
||||
{
|
||||
|
@ -1,11 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package ASC.Protos.Migration;
|
||||
|
||||
message MigrationProgress{
|
||||
bool IsCompleted = 1;
|
||||
double Progress = 2;
|
||||
string Error = 3;
|
||||
string Link = 4;
|
||||
int32 TenantId = 5;
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package ASC.Protos.Migration;
|
||||
|
||||
message MigrationUploadCdn {
|
||||
int32 Tenant = 1;
|
||||
string RelativePath = 2;
|
||||
string MappedPath = 3;
|
||||
CdnStorSettings CdnStorSettings = 4;
|
||||
}
|
||||
|
||||
message CdnStorSettings {
|
||||
string ID = 1;
|
||||
string Module = 2;
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
package ASC.Core;
|
||||
|
||||
message DataStoreCacheItem {
|
||||
string Module = 1;
|
||||
string module = 1;
|
||||
|
||||
string TenantId = 2;
|
||||
string tenant_id = 2;
|
||||
}
|
@ -3,12 +3,12 @@ syntax = "proto3";
|
||||
package ASC.Protos.Migration;
|
||||
|
||||
message MigrationCache {
|
||||
int32 TenantId = 1;
|
||||
StorSettings StorSettings = 2;
|
||||
int32 tenant_id = 1;
|
||||
StorSettings stor_settings = 2;
|
||||
}
|
||||
|
||||
message StorSettings {
|
||||
string ID = 1;
|
||||
string Module = 2;
|
||||
string id = 1;
|
||||
string module = 2;
|
||||
}
|
||||
|
11
common/ASC.Data.Storage/protos/migration_progress.proto
Normal file
11
common/ASC.Data.Storage/protos/migration_progress.proto
Normal file
@ -0,0 +1,11 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package ASC.Protos.Migration;
|
||||
|
||||
message MigrationProgress{
|
||||
bool is_completed = 1;
|
||||
double progress = 2;
|
||||
string error = 3;
|
||||
string link = 4;
|
||||
int32 tenant_id = 5;
|
||||
}
|
16
common/ASC.Data.Storage/protos/migration_upload_cdn.proto
Normal file
16
common/ASC.Data.Storage/protos/migration_upload_cdn.proto
Normal file
@ -0,0 +1,16 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package ASC.Protos.Migration;
|
||||
|
||||
message MigrationUploadCdn {
|
||||
int32 tenant = 1;
|
||||
string relative_path = 2;
|
||||
string mapped_path = 3;
|
||||
CdnStorSettings cdn_stor_settings = 4;
|
||||
}
|
||||
|
||||
message CdnStorSettings {
|
||||
string id = 1;
|
||||
string module = 2;
|
||||
}
|
||||
|
@ -3,6 +3,6 @@
|
||||
package ASC.Data.Storage.Encryption;
|
||||
|
||||
message ProgressEncryption {
|
||||
double Progress = 1;
|
||||
int32 TenantId = 2;
|
||||
double progress = 1;
|
||||
int32 tenant_id = 2;
|
||||
}
|
@ -26,7 +26,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DotNetOpenAuth.Ultimate" Version="4.3.4.13329" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.32.0">
|
||||
<PackageReference Include="Grpc.Tools" Version="2.40.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
@ -37,7 +37,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Protobuf Include="protos\LinkerCacheItem.proto" />
|
||||
<Protobuf Include="protos\linker_cache_item.proto" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -3,5 +3,5 @@
|
||||
package ASC.FederatedLogin;
|
||||
|
||||
message LinkerCacheItem {
|
||||
string Obj = 1;
|
||||
string obj = 1;
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Grpc.Tools" Version="2.32.0">
|
||||
<PackageReference Include="Grpc.Tools" Version="2.40.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
@ -24,6 +24,6 @@
|
||||
<ProjectReference Include="..\ASC.Core.Common\ASC.Core.Common.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Protobuf Include="protos\IPRestrictionItem.proto" />
|
||||
<Protobuf Include="protos\ip_restriction_item.proto" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@ -3,5 +3,5 @@
|
||||
package ASC.IPSecurity;
|
||||
|
||||
message IPRestrictionItem {
|
||||
int32 TenantId = 1;
|
||||
int32 tenant_id = 1;
|
||||
}
|
@ -22,7 +22,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Grpc.Tools" Version="2.32.0">
|
||||
<PackageReference Include="Grpc.Tools" Version="2.40.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
@ -34,6 +34,6 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Protobuf Include="protos\CachedVoipItem.proto" />
|
||||
<Protobuf Include="protos\cached_voip_item.proto" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@ -3,5 +3,5 @@
|
||||
package ASC.VoipService.Dao;
|
||||
|
||||
message CachedVoipItem {
|
||||
int32 Tenant = 1;
|
||||
int32 tenant = 1;
|
||||
}
|
@ -15,11 +15,11 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="proto\WebhookRequest.proto" />
|
||||
<None Remove="proto\webhook_request.proto" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Grpc.Tools" Version="2.32.0">
|
||||
<PackageReference Include="Grpc.Tools" Version="2.40.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
@ -30,7 +30,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Protobuf Include="proto\WebhookRequest.proto" />
|
||||
<Protobuf Include="proto\webhook_request.proto" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
@ -3,5 +3,5 @@ syntax = "proto3";
|
||||
package ASC.Web.Webhooks;
|
||||
|
||||
message WebhookRequest {
|
||||
int32 Id = 1;
|
||||
int32 id = 1;
|
||||
};
|
@ -23,7 +23,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
#if DEBUG
|
||||
namespace ASC.Core.Common.Tests
|
||||
{
|
||||
@ -206,3 +206,4 @@ namespace ASC.Core.Common.Tests
|
||||
}
|
||||
}
|
||||
#endif
|
||||
*/
|
@ -23,7 +23,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
#if DEBUG
|
||||
namespace ASC.Core.Common.Tests
|
||||
{
|
||||
@ -251,3 +251,4 @@ namespace ASC.Core.Common.Tests
|
||||
}
|
||||
}
|
||||
#endif
|
||||
*/
|
@ -9,7 +9,7 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
|
||||
<PackageReference Include="NUnit" Version="3.13.1" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0" />
|
||||
<PackageReference Include="coverlet.collector" Version="3.0.2" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -11,7 +11,7 @@
|
||||
<PackageReference Include="Microsoft.AspNetCore.TestHost" Version="6.0.0" />
|
||||
<PackageReference Include="Moq" Version="4.14.7" />
|
||||
<PackageReference Include="NUnit" Version="3.13.1" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="4.0.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.9.4" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -20,6 +20,8 @@
|
||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNet.WebApi.Core" Version="5.2.7" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="6.0.0" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.AspNetCore" Version="7.2.1" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.Newtonsoft" Version="7.2.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -93,6 +93,8 @@ namespace ASC.ApiSystem
|
||||
.AddJsonFile("storage.json")
|
||||
.AddJsonFile("kafka.json")
|
||||
.AddJsonFile($"kafka.{hostingContext.HostingEnvironment.EnvironmentName}.json", true)
|
||||
.AddJsonFile("redis.json")
|
||||
.AddJsonFile($"redis.{hostingContext.HostingEnvironment.EnvironmentName}.json", true)
|
||||
.AddEnvironmentVariables()
|
||||
.AddCommandLine(args)
|
||||
.AddInMemoryCollection(new Dictionary<string, string>
|
||||
|
@ -42,6 +42,8 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
using StackExchange.Redis.Extensions.Core.Configuration;
|
||||
using StackExchange.Redis.Extensions.Newtonsoft;
|
||||
|
||||
namespace ASC.ApiSystem
|
||||
{
|
||||
@ -73,7 +75,17 @@ namespace ASC.ApiSystem
|
||||
|
||||
services.AddMemoryCache();
|
||||
|
||||
diHelper.TryAdd(typeof(ICacheNotify<>), typeof(KafkaCache<>));
|
||||
var redisConfiguration = Configuration.GetSection("Redis").Get<RedisConfiguration>();
|
||||
|
||||
if (redisConfiguration != null)
|
||||
{
|
||||
diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>));
|
||||
}
|
||||
else
|
||||
{
|
||||
diHelper.TryAdd(typeof(ICacheNotify<>), typeof(MemoryCacheNotify<>));
|
||||
}
|
||||
|
||||
diHelper.TryAdd<AuthHandler>();
|
||||
diHelper.TryAdd<CalDavController>();
|
||||
diHelper.TryAdd<PortalController>();
|
||||
@ -83,6 +95,8 @@ namespace ASC.ApiSystem
|
||||
services.AddAuthentication()
|
||||
.AddScheme<AuthenticationSchemeOptions, AuthHandler>("auth.allowskip", _ => { })
|
||||
.AddScheme<AuthenticationSchemeOptions, AuthHandler>("auth.allowskip.registerportal", _ => { });
|
||||
|
||||
services.AddStackExchangeRedisExtensions<NewtonsoftSerializer>(Configuration.GetSection("Redis").Get<RedisConfiguration>());
|
||||
}
|
||||
|
||||
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
||||
|
@ -41,10 +41,11 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
using StackExchange.Redis.Extensions.Core.Configuration;
|
||||
|
||||
namespace ASC.Thumbnails.Svc
|
||||
{
|
||||
public class Program
|
||||
public class Program
|
||||
{
|
||||
public async static Task Main(string[] args)
|
||||
{
|
||||
@ -83,7 +84,17 @@ namespace ASC.Thumbnails.Svc
|
||||
services.AddMemoryCache();
|
||||
var diHelper = new DIHelper(services);
|
||||
|
||||
diHelper.TryAdd(typeof(ICacheNotify<>), typeof(KafkaCache<>));
|
||||
var redisConfiguration = hostContext.Configuration.GetSection("Redis").Get<RedisConfiguration>();
|
||||
|
||||
if (redisConfiguration != null)
|
||||
{
|
||||
diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>));
|
||||
}
|
||||
else
|
||||
{
|
||||
diHelper.TryAdd(typeof(ICacheNotify<>), typeof(MemoryCacheNotify<>));
|
||||
}
|
||||
|
||||
services.AddHostedService<ClearEventsServiceLauncher>();
|
||||
diHelper.TryAdd<ClearEventsServiceLauncher>();
|
||||
})
|
||||
|
@ -24,6 +24,8 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="6.0.0" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.AspNetCore" Version="7.2.1" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.Newtonsoft" Version="7.2.1" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\ASC.Data.Backup.Core\ASC.Data.Backup.Core.csproj" />
|
||||
|
@ -71,6 +71,8 @@ namespace ASC.Data.Backup
|
||||
.AddJsonFile("backup.json")
|
||||
.AddJsonFile("kafka.json")
|
||||
.AddJsonFile($"kafka.{env}.json", true)
|
||||
.AddJsonFile("redis.json")
|
||||
.AddJsonFile($"redis.{env}.json", true)
|
||||
.AddEnvironmentVariables()
|
||||
.AddCommandLine(args)
|
||||
.AddInMemoryCollection(new Dictionary<string, string>
|
||||
|
@ -34,6 +34,9 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
using StackExchange.Redis.Extensions.Core.Configuration;
|
||||
using StackExchange.Redis.Extensions.Newtonsoft;
|
||||
|
||||
namespace ASC.Data.Backup
|
||||
{
|
||||
public class Startup : BaseStartup
|
||||
@ -58,6 +61,7 @@ namespace ASC.Data.Backup
|
||||
NotifyConfigurationExtension.Register(DIHelper);
|
||||
|
||||
services.AddHostedService<BackupServiceLauncher>();
|
||||
services.AddStackExchangeRedisExtensions<NewtonsoftSerializer>(Configuration.GetSection("Redis").Get<RedisConfiguration>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,11 +23,13 @@
|
||||
<PackageReference Include="Grpc" Version="2.32.0">
|
||||
<TreatAsUsed>true</TreatAsUsed>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Grpc.Tools" Version="2.32.0">
|
||||
<PackageReference Include="Grpc.Tools" Version="2.40.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="6.0.0" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.AspNetCore" Version="7.2.1" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.Newtonsoft" Version="7.2.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -99,6 +99,8 @@ namespace ASC.Data.Storage.Encryption
|
||||
.AddJsonFile($"notify.{env}.json", true)
|
||||
.AddJsonFile("kafka.json")
|
||||
.AddJsonFile($"kafka.{env}.json", true)
|
||||
.AddJsonFile("redis.json")
|
||||
.AddJsonFile($"redis.{env}.json", true)
|
||||
.AddEnvironmentVariables();
|
||||
})
|
||||
.ConfigureNLogLogging();
|
||||
|
@ -30,6 +30,9 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
using StackExchange.Redis.Extensions.Core.Configuration;
|
||||
using StackExchange.Redis.Extensions.Newtonsoft;
|
||||
|
||||
namespace ASC.Data.Storage.Encryption
|
||||
{
|
||||
public class Startup : BaseStartup
|
||||
@ -46,6 +49,7 @@ namespace ASC.Data.Storage.Encryption
|
||||
DIHelper.TryAdd<EncryptionServiceLauncher>();
|
||||
|
||||
services.AddHostedService<EncryptionServiceLauncher>();
|
||||
services.AddStackExchangeRedisExtensions<NewtonsoftSerializer>(Configuration.GetSection("Redis").Get<RedisConfiguration>());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,8 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="6.0.0" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.AspNetCore" Version="7.2.1" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.Newtonsoft" Version="7.2.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -16,6 +16,9 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
using StackExchange.Redis.Extensions.Core.Configuration;
|
||||
using StackExchange.Redis.Extensions.Newtonsoft;
|
||||
|
||||
namespace ASC.Data.Storage.Migration
|
||||
{
|
||||
public class Program
|
||||
@ -52,6 +55,8 @@ namespace ASC.Data.Storage.Migration
|
||||
.AddJsonFile($"notify.{env}.json", true)
|
||||
.AddJsonFile("kafka.json")
|
||||
.AddJsonFile($"kafka.{env}.json", true)
|
||||
.AddJsonFile("redis.json")
|
||||
.AddJsonFile($"redis.{env}.json", true)
|
||||
.AddEnvironmentVariables()
|
||||
.AddCommandLine(args)
|
||||
.AddInMemoryCollection(new Dictionary<string, string>
|
||||
@ -64,7 +69,19 @@ namespace ASC.Data.Storage.Migration
|
||||
{
|
||||
services.AddMemoryCache();
|
||||
var diHelper = new DIHelper(services);
|
||||
diHelper.TryAdd(typeof(ICacheNotify<>), typeof(KafkaCache<>));
|
||||
|
||||
var redisConfiguration = hostContext.Configuration.GetSection("Redis").Get<RedisConfiguration>();
|
||||
|
||||
if (redisConfiguration != null)
|
||||
{
|
||||
diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>));
|
||||
|
||||
services.AddStackExchangeRedisExtensions<NewtonsoftSerializer>(redisConfiguration);
|
||||
}
|
||||
else
|
||||
{
|
||||
diHelper.TryAdd(typeof(ICacheNotify<>), typeof(MemoryCacheNotify<>));
|
||||
}
|
||||
|
||||
diHelper.RegisterProducts(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath);
|
||||
|
||||
|
@ -24,11 +24,11 @@
|
||||
<None Remove="Properties\**" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Remove="protos\SearchItem.proto" />
|
||||
<None Remove="protos\search_item.proto" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Elasticsearch.Net" Version="7.7.1" />
|
||||
<PackageReference Include="Grpc.Tools" Version="2.32.0">
|
||||
<PackageReference Include="Grpc.Tools" Version="2.40.0">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
@ -43,6 +43,6 @@
|
||||
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Protobuf Include="protos\SearchItem.proto" />
|
||||
<Protobuf Include="protos\search_item.proto" />
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -1,17 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package ASC.ElasticSearch;
|
||||
|
||||
message ClearIndexAction {
|
||||
string Id = 1;
|
||||
}
|
||||
|
||||
message ReIndexAction {
|
||||
int32 Tenant = 1;
|
||||
repeated string Names = 2;
|
||||
}
|
||||
|
||||
message IndexAction {
|
||||
string Indexing = 1;
|
||||
int64 LastIndexed = 2;
|
||||
}
|
17
common/services/ASC.ElasticSearch/protos/search_item.proto
Normal file
17
common/services/ASC.ElasticSearch/protos/search_item.proto
Normal file
@ -0,0 +1,17 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package ASC.ElasticSearch;
|
||||
|
||||
message ClearIndexAction {
|
||||
string id = 1;
|
||||
}
|
||||
|
||||
message ReIndexAction {
|
||||
int32 tenant = 1;
|
||||
repeated string names = 2;
|
||||
}
|
||||
|
||||
message IndexAction {
|
||||
string indexing = 1;
|
||||
int64 last_indexed = 2;
|
||||
}
|
@ -18,6 +18,8 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="6.0.0" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.AspNetCore" Version="7.2.1" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.Newtonsoft" Version="7.2.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -18,6 +18,9 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
using StackExchange.Redis.Extensions.Core.Configuration;
|
||||
using StackExchange.Redis.Extensions.Newtonsoft;
|
||||
|
||||
namespace ASC.Notify
|
||||
{
|
||||
public class Program
|
||||
@ -54,6 +57,8 @@ namespace ASC.Notify
|
||||
.AddJsonFile($"notify.{env}.json", true)
|
||||
.AddJsonFile("kafka.json")
|
||||
.AddJsonFile($"kafka.{env}.json", true)
|
||||
.AddJsonFile("redis.json")
|
||||
.AddJsonFile($"redis.{env}.json", true)
|
||||
.AddEnvironmentVariables()
|
||||
.AddCommandLine(args)
|
||||
.AddInMemoryCollection(new Dictionary<string, string>
|
||||
@ -67,7 +72,19 @@ namespace ASC.Notify
|
||||
services.AddMemoryCache();
|
||||
var diHelper = new DIHelper(services);
|
||||
|
||||
diHelper.TryAdd(typeof(ICacheNotify<>), typeof(KafkaCache<>));
|
||||
var redisConfiguration = hostContext.Configuration.GetSection("Redis").Get<RedisConfiguration>();
|
||||
|
||||
if (redisConfiguration != null)
|
||||
{
|
||||
diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>));
|
||||
|
||||
services.AddStackExchangeRedisExtensions<NewtonsoftSerializer>(redisConfiguration);
|
||||
}
|
||||
else
|
||||
{
|
||||
diHelper.TryAdd(typeof(ICacheNotify<>), typeof(MemoryCacheNotify<>));
|
||||
}
|
||||
|
||||
diHelper.RegisterProducts(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath);
|
||||
|
||||
services.Configure<NotifyServiceCfg>(hostContext.Configuration.GetSection("notify"));
|
||||
|
@ -22,6 +22,8 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="6.0.0" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.AspNetCore" Version="7.2.1" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.Newtonsoft" Version="7.2.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -42,10 +42,13 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
using StackExchange.Redis.Extensions.Core.Configuration;
|
||||
using StackExchange.Redis.Extensions.Newtonsoft;
|
||||
|
||||
namespace ASC.Radicale
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static async Task Main(string[] args)
|
||||
{
|
||||
var host = CreateHostBuilder(args).Build();
|
||||
@ -72,9 +75,11 @@ namespace ASC.Radicale
|
||||
.AddJsonFile("appsettings.json")
|
||||
.AddJsonFile("storage.json")
|
||||
.AddJsonFile("kafka.json")
|
||||
.AddJsonFile($"kafka.{env}.json", true)
|
||||
.AddJsonFile("redis.json")
|
||||
.AddJsonFile($"redis.{env}.json", true)
|
||||
.AddJsonFile($"appsettings.services.json", true)
|
||||
//.AddJsonFile("radicale.json")
|
||||
.AddJsonFile($"kafka.{env}.json", true)
|
||||
.AddJsonFile($"appsettings.{env}.json", true)
|
||||
.AddJsonFile($"radicale.{env}.json", true)
|
||||
.AddEnvironmentVariables()
|
||||
@ -89,11 +94,25 @@ namespace ASC.Radicale
|
||||
{
|
||||
services.AddMemoryCache();
|
||||
var diHelper = new DIHelper(services);
|
||||
diHelper.TryAdd(typeof(ICacheNotify<>), typeof(KafkaCache<>));
|
||||
|
||||
var redisConfiguration = hostContext.Configuration.GetSection("Redis").Get<RedisConfiguration>();
|
||||
|
||||
if (redisConfiguration != null)
|
||||
{
|
||||
diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>));
|
||||
|
||||
services.AddStackExchangeRedisExtensions<NewtonsoftSerializer>(redisConfiguration);
|
||||
}
|
||||
else
|
||||
{
|
||||
diHelper.TryAdd(typeof(ICacheNotify<>), typeof(MemoryCacheNotify<>));
|
||||
}
|
||||
|
||||
diHelper.RegisterProducts(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath);
|
||||
|
||||
services.AddHostedService<RadicaleServiceLauncher>();
|
||||
diHelper.TryAdd<RadicaleServiceLauncher>();
|
||||
|
||||
})
|
||||
.ConfigureContainer<ContainerBuilder>((context, builder) =>
|
||||
{
|
||||
|
@ -21,6 +21,8 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="6.0.0" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.AspNetCore" Version="7.2.1" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.Newtonsoft" Version="7.2.1" />
|
||||
<PackageReference Include="WebSocketSharpNetStandart" Version="1.0.3-rc12" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -42,10 +42,12 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
using StackExchange.Redis.Extensions.Core.Configuration;
|
||||
using StackExchange.Redis.Extensions.Newtonsoft;
|
||||
|
||||
namespace ASC.Socket.IO.Svc
|
||||
{
|
||||
public class Program
|
||||
public class Program
|
||||
{
|
||||
public async static Task Main(string[] args)
|
||||
{
|
||||
@ -74,8 +76,10 @@ namespace ASC.Socket.IO.Svc
|
||||
.AddJsonFile("appsettings.json")
|
||||
.AddJsonFile("storage.json")
|
||||
.AddJsonFile("kafka.json")
|
||||
.AddJsonFile("socket.json")
|
||||
.AddJsonFile($"kafka.{env}.json", true)
|
||||
.AddJsonFile("redis.json")
|
||||
.AddJsonFile($"redis.{env}.json", true)
|
||||
.AddJsonFile("socket.json")
|
||||
.AddJsonFile($"appsettings.{env}.json", true)
|
||||
.AddJsonFile($"socket.{env}.json", true)
|
||||
.AddEnvironmentVariables()
|
||||
@ -90,11 +94,25 @@ namespace ASC.Socket.IO.Svc
|
||||
{
|
||||
services.AddMemoryCache();
|
||||
var diHelper = new DIHelper(services);
|
||||
diHelper.TryAdd(typeof(ICacheNotify<>), typeof(KafkaCache<>));
|
||||
|
||||
var redisConfiguration = hostContext.Configuration.GetSection("Redis").Get<RedisConfiguration>();
|
||||
|
||||
if (redisConfiguration != null)
|
||||
{
|
||||
diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>));
|
||||
|
||||
services.AddStackExchangeRedisExtensions<NewtonsoftSerializer>(redisConfiguration);
|
||||
}
|
||||
else
|
||||
{
|
||||
diHelper.TryAdd(typeof(ICacheNotify<>), typeof(MemoryCacheNotify<>));
|
||||
}
|
||||
|
||||
diHelper.RegisterProducts(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath);
|
||||
|
||||
services.AddHostedService<SocketServiceLauncher>();
|
||||
diHelper.TryAdd<SocketServiceLauncher>();
|
||||
|
||||
})
|
||||
.ConfigureContainer<ContainerBuilder>((context, builder) =>
|
||||
{
|
||||
|
@ -21,6 +21,8 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="6.0.0" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.AspNetCore" Version="7.2.1" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.Newtonsoft" Version="7.2.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -43,10 +43,12 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
using StackExchange.Redis.Extensions.Core.Configuration;
|
||||
using StackExchange.Redis.Extensions.Newtonsoft;
|
||||
|
||||
namespace ASC.Socket.IO.Svc
|
||||
{
|
||||
public class Program
|
||||
public class Program
|
||||
{
|
||||
public async static Task Main(string[] args)
|
||||
{
|
||||
@ -75,8 +77,10 @@ namespace ASC.Socket.IO.Svc
|
||||
.AddJsonFile("appsettings.json")
|
||||
.AddJsonFile("storage.json")
|
||||
.AddJsonFile("kafka.json")
|
||||
.AddJsonFile("ssoauth.json")
|
||||
.AddJsonFile($"kafka.{env}.json", true)
|
||||
.AddJsonFile("redis.json")
|
||||
.AddJsonFile($"redis.{env}.json", true)
|
||||
.AddJsonFile("ssoauth.json")
|
||||
.AddJsonFile($"appsettings.{env}.json", true)
|
||||
.AddJsonFile($"ssoauth.{env}.json", true)
|
||||
.AddEnvironmentVariables()
|
||||
@ -91,11 +95,25 @@ namespace ASC.Socket.IO.Svc
|
||||
{
|
||||
services.AddMemoryCache();
|
||||
var diHelper = new DIHelper(services);
|
||||
diHelper.TryAdd(typeof(ICacheNotify<>), typeof(KafkaCache<>));
|
||||
|
||||
var redisConfiguration = hostContext.Configuration.GetSection("Redis").Get<RedisConfiguration>();
|
||||
|
||||
if (redisConfiguration != null)
|
||||
{
|
||||
diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>));
|
||||
|
||||
services.AddStackExchangeRedisExtensions<NewtonsoftSerializer>(redisConfiguration);
|
||||
}
|
||||
else
|
||||
{
|
||||
diHelper.TryAdd(typeof(ICacheNotify<>), typeof(MemoryCacheNotify<>));
|
||||
}
|
||||
|
||||
diHelper.RegisterProducts(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath);
|
||||
|
||||
services.AddHostedService<Launcher>();
|
||||
diHelper.TryAdd<Launcher>();
|
||||
|
||||
})
|
||||
.ConfigureContainer<ContainerBuilder>((context, builder) =>
|
||||
{
|
||||
|
@ -16,6 +16,8 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="6.0.0" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.AspNetCore" Version="7.2.1" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.Newtonsoft" Version="7.2.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -19,6 +19,9 @@ using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
using StackExchange.Redis.Extensions.Core.Configuration;
|
||||
using StackExchange.Redis.Extensions.Newtonsoft;
|
||||
|
||||
namespace ASC.Studio.Notify
|
||||
{
|
||||
public class Program
|
||||
@ -55,6 +58,8 @@ namespace ASC.Studio.Notify
|
||||
.AddJsonFile($"notify.{env}.json", true)
|
||||
.AddJsonFile("kafka.json")
|
||||
.AddJsonFile($"kafka.{env}.json", true)
|
||||
.AddJsonFile("redis.json")
|
||||
.AddJsonFile($"redis.{env}.json", true)
|
||||
.AddEnvironmentVariables()
|
||||
.AddCommandLine(args)
|
||||
.AddInMemoryCollection(new Dictionary<string, string>
|
||||
@ -67,12 +72,26 @@ namespace ASC.Studio.Notify
|
||||
{
|
||||
services.AddMemoryCache();
|
||||
var diHelper = new DIHelper(services);
|
||||
diHelper.TryAdd(typeof(ICacheNotify<>), typeof(KafkaCache<>));
|
||||
|
||||
var redisConfiguration = hostContext.Configuration.GetSection("Redis").Get<RedisConfiguration>();
|
||||
|
||||
if (redisConfiguration != null)
|
||||
{
|
||||
diHelper.TryAdd(typeof(ICacheNotify<>), typeof(RedisCache<>));
|
||||
|
||||
services.AddStackExchangeRedisExtensions<NewtonsoftSerializer>(redisConfiguration);
|
||||
}
|
||||
else
|
||||
{
|
||||
diHelper.TryAdd(typeof(ICacheNotify<>), typeof(MemoryCacheNotify<>));
|
||||
}
|
||||
|
||||
diHelper.RegisterProducts(hostContext.Configuration, hostContext.HostingEnvironment.ContentRootPath);
|
||||
services.AddHostedService<ServiceLauncher>();
|
||||
diHelper.TryAdd<ServiceLauncher>();
|
||||
NotifyConfigurationExtension.Register(diHelper);
|
||||
diHelper.TryAdd<EmailSenderSink>();
|
||||
|
||||
})
|
||||
.ConfigureContainer<ContainerBuilder>((context, builder) =>
|
||||
{
|
||||
|
@ -18,6 +18,8 @@
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Autofac.Extensions.DependencyInjection" Version="7.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting.Systemd" Version="6.0.0" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.AspNetCore" Version="7.2.1" />
|
||||
<PackageReference Include="StackExchange.Redis.Extensions.Newtonsoft" Version="7.2.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -99,6 +99,8 @@ namespace ASC.TelegramService
|
||||
.AddJsonFile($"notify.{env}.json", true)
|
||||
.AddJsonFile("kafka.json")
|
||||
.AddJsonFile($"kafka.{env}.json", true)
|
||||
.AddJsonFile("redis.json")
|
||||
.AddJsonFile($"redis.{env}.json", true)
|
||||
.AddEnvironmentVariables();
|
||||
})
|
||||
.ConfigureNLogLogging();
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user