Storage: removed 's' prefix

This commit is contained in:
Maksim Chegulov 2022-02-10 15:34:26 +03:00
parent d3d2f85c3b
commit 359d5efe8d
3 changed files with 21 additions and 21 deletions

View File

@ -30,9 +30,9 @@ public class StaticUploader
{
protected readonly DistributedTaskQueue Queue;
private ICache _cache;
private static readonly TaskScheduler s_scheduler;
private static readonly CancellationTokenSource s_tokenSource;
private static readonly object s_locker;
private static readonly TaskScheduler _scheduler;
private static readonly CancellationTokenSource _tokenSource;
private static readonly object _locker;
private readonly IServiceProvider _serviceProvider;
private readonly TenantManager _tenantManager;
private readonly SettingsManager _settingsManager;
@ -40,9 +40,9 @@ public class StaticUploader
static StaticUploader()
{
s_scheduler = new ConcurrentExclusiveSchedulerPair(TaskScheduler.Default, 4).ConcurrentScheduler;
s_locker = new object();
s_tokenSource = new CancellationTokenSource();
_scheduler = new ConcurrentExclusiveSchedulerPair(TaskScheduler.Default, 4).ConcurrentScheduler;
_locker = new object();
_tokenSource = new CancellationTokenSource();
}
public StaticUploader(
@ -63,7 +63,7 @@ public class StaticUploader
public string UploadFile(string relativePath, string mappedPath, Action<string> onComplete = null)
{
if (s_tokenSource.Token.IsCancellationRequested)
if (_tokenSource.Token.IsCancellationRequested)
{
return null;
}
@ -82,7 +82,7 @@ public class StaticUploader
UploadOperation uploadOperation;
var key = GetCacheKey(tenantId.ToString(), relativePath);
lock (s_locker)
lock (_locker)
{
uploadOperation = _cache.Get<UploadOperation>(key);
if (uploadOperation != null)
@ -115,7 +115,7 @@ public class StaticUploader
task.ConfigureAwait(false);
task.Start(s_scheduler);
task.Start(_scheduler);
return task;
}
@ -136,7 +136,7 @@ public class StaticUploader
var key = typeof(UploadOperationProgress).FullName + tenant.TenantId;
UploadOperationProgress uploadOperation;
lock (s_locker)
lock (_locker)
{
uploadOperation = Queue.GetTask<UploadOperationProgress>(key);
if (uploadOperation != null)
@ -162,12 +162,12 @@ public class StaticUploader
public static void Stop()
{
s_tokenSource.Cancel();
_tokenSource.Cancel();
}
public UploadOperationProgress GetProgress(int tenantId)
{
lock (s_locker)
lock (_locker)
{
var key = typeof(UploadOperationProgress).FullName + tenantId;

View File

@ -30,14 +30,14 @@ public class StorageUploader
{
protected readonly DistributedTaskQueue Queue;
private static readonly object s_locker;
private static readonly object _locker;
private readonly IServiceProvider _serviceProvider;
private readonly TempStream _tempStream;
private readonly ICacheNotify<MigrationProgress> _cacheMigrationNotify;
static StorageUploader()
{
s_locker = new object();
_locker = new object();
}
public StorageUploader(IServiceProvider serviceProvider, TempStream tempStream, ICacheNotify<MigrationProgress> cacheMigrationNotify, DistributedTaskQueueOptionsManager options)
@ -50,7 +50,7 @@ public class StorageUploader
public void Start(int tenantId, StorageSettings newStorageSettings, StorageFactoryConfig storageFactoryConfig)
{
lock (s_locker)
lock (_locker)
{
var id = GetCacheKey(tenantId);
var migrateOperation = Queue.GetTask<MigrateOperation>(id);
@ -66,7 +66,7 @@ public class StorageUploader
public MigrateOperation GetProgress(int tenantId)
{
lock (s_locker)
lock (_locker)
{
return Queue.GetTask<MigrateOperation>(GetCacheKey(tenantId));
}

View File

@ -130,7 +130,7 @@ public class WebPath
public IServiceProvider ServiceProvider { get; }
public IHostEnvironment HostEnvironment { get; }
private static readonly IDictionary<string, bool> s_existing = new ConcurrentDictionary<string, bool>();
private static readonly IDictionary<string, bool> _existing = new ConcurrentDictionary<string, bool>();
private readonly WebPathSettings _webPathSettings;
private readonly SettingsManager _settingsManager;
private readonly StorageSettingsHelper _storageSettingsHelper;
@ -200,21 +200,21 @@ public class WebPath
public bool Exists(string relativePath)
{
var path = GetPath(relativePath);
if (!s_existing.ContainsKey(path))
if (!_existing.ContainsKey(path))
{
if (Uri.IsWellFormedUriString(path, UriKind.Relative) && _httpContextAccessor?.HttpContext != null)
{
//Local
s_existing[path] = File.Exists(CrossPlatform.PathCombine(HostEnvironment.ContentRootPath, path));
_existing[path] = File.Exists(CrossPlatform.PathCombine(HostEnvironment.ContentRootPath, path));
}
if (Uri.IsWellFormedUriString(path, UriKind.Absolute))
{
//Make request
s_existing[path] = CheckWebPath(path);
_existing[path] = CheckWebPath(path);
}
}
return s_existing[path];
return _existing[path];
}
private bool CheckWebPath(string path)