WeddingThankYou 1.0.0.0
결혼식 이후 감사 인사와 사진, 계좌 안내, 연락처를 모바일 페이지로 전달하는 감사장 서비스입니다.
로딩중...
검색중...
일치하는것 없음
WeddingThankYou.Services.JsonMediaMigrationService 클래스 참조sealed

더 자세히 ...

WeddingThankYou.Services.JsonMediaMigrationService에 대한 상속 다이어그램 :
WeddingThankYou.Services.JsonMediaMigrationService에 대한 협력 다이어그램:

Public 멤버 함수

 JsonMediaMigrationService (ITenantStore tenants, WeddingOptions options, IMediaQuotaPolicyResolver policyResolver, IImageOptimizationService imageOptimization)
async Task< IReadOnlyDictionary< string, MediaMigrationTenantStatus > > GetAllAsync (CancellationToken ct=default)
async Task< MediaMigrationTenantStatus?> GetTenantStatusAsync (string slug, CancellationToken ct=default)
async Task QueueTenantAsync (string slug, CancellationToken ct=default)
async Task RetryTenantAsync (string slug, CancellationToken ct=default)

속성

string StatusPath [get]

Private 멤버 함수

async Task ProcessTenantSafeAsync (string slug, CancellationToken ct)
async Task ProcessTenantAsync (string slug, CancellationToken ct)
async Task< Dictionary< string, MediaMigrationTenantStatus > > LoadAsync (CancellationToken ct)
async Task SaveAsync (Dictionary< string, MediaMigrationTenantStatus > status, CancellationToken ct)
bool IsRunning (string slug)
void StartBackground (string slug)
string ResolveWritableOutputFormat (string? preferredFormat, string? sourceFileName)

정적 Private 멤버 함수

static MediaMigrationTenantStatus GetOrCreate (Dictionary< string, MediaMigrationTenantStatus > all, string slug)
static void MarkFile (MediaMigrationFileStatus fileStatus, MediaMigrationState state, string message)
static string BuildProgressMessage (MediaMigrationTenantStatus status, int processed, int total)
static string NormalizeFormat (string? outputFormat)

Private 속성

readonly ITenantStore _tenants
readonly WeddingOptions _options
readonly IMediaQuotaPolicyResolver _policyResolver
readonly IImageOptimizationService _imageOptimization
readonly SemaphoreSlim _gate = new(1, 1)
readonly object _runningGate = new()
readonly HashSet< string > _runningSlugs = new(StringComparer.OrdinalIgnoreCase)
readonly JsonSerializerOptions _jsonOptions = new() { WriteIndented = true }
Dictionary< string, MediaMigrationTenantStatus >? _cache

상세한 설명

JSON 상태 파일을 사용해 이미지 마이그레이션을 멱등적으로 수행합니다.

JsonMediaMigrationService.cs 파일의 15 번째 라인에서 정의되었습니다.

생성자 & 소멸자 문서화

◆ JsonMediaMigrationService()

WeddingThankYou.Services.JsonMediaMigrationService.JsonMediaMigrationService ( ITenantStore tenants,
WeddingOptions options,
IMediaQuotaPolicyResolver policyResolver,
IImageOptimizationService imageOptimization )
inline

지정한 설정으로 JsonMediaMigrationService 클래스의 새 인스턴스를 초기화합니다.

매개변수
tenantstenants에 사용할 ITenantStore 값입니다.
options동작을 구성하는 설정입니다.
policyResolverpolicy Resolver에 사용할 IMediaQuotaPolicyResolver 값입니다.
imageOptimizationimage Optimization에 사용할 IImageOptimizationService 값입니다.

JsonMediaMigrationService.cs 파일의 140 번째 라인에서 정의되었습니다.

145 {
146 _tenants = tenants;
147 _options = options;
148 _policyResolver = policyResolver;
149 _imageOptimization = imageOptimization;
150 }

다음을 참조함 : _imageOptimization, _options, _policyResolver, _tenants.

멤버 함수 문서화

◆ BuildProgressMessage()

string WeddingThankYou.Services.JsonMediaMigrationService.BuildProgressMessage ( MediaMigrationTenantStatus status,
int processed,
int total )
inlinestaticprivate

Progress Message 값을 구성합니다.

매개변수
statusstatus에 사용할 MediaMigrationTenantStatus 값입니다.
processedprocessed에 사용할 int 값입니다.
totaltotal에 사용할 int 값입니다.
반환값
Build Progress Message 작업에서 생성한 string 결과입니다.

JsonMediaMigrationService.cs 파일의 910 번째 라인에서 정의되었습니다.

911 {
912 var failed = status.Files.Count(x => x.State == MediaMigrationState.Failed);
913 var completed = status.Files.Count(x => x.State == MediaMigrationState.Completed);
914 var skipped = status.Files.Count(x => x.State == MediaMigrationState.Skipped);
915 if (failed > 0) return $"처리 중 ({processed}/{total}, 실패 {failed})";
916 return $"처리 중 ({processed}/{total}, 완료 {completed}, 건너뜀 {skipped})";
917 }
List< MediaMigrationFileStatus > Files

다음을 참조함 : WeddingThankYou.Models.MediaMigrationTenantStatus.Files.

다음에 의해서 참조됨 : ProcessTenantAsync().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ GetAllAsync()

async Task< IReadOnlyDictionary< string, MediaMigrationTenantStatus > > WeddingThankYou.Services.JsonMediaMigrationService.GetAllAsync ( CancellationToken ct = default)
inline

All Async 값을 가져옵니다.

매개변수
ct취소 요청을 감시하는 토큰입니다.
반환값
Get All Async 작업에서 생성한 Task<IReadOnlyDictionary<string, MediaMigrationTenantStatus>> 결과입니다.

WeddingThankYou.Services.IMediaMigrationService를 구현.

JsonMediaMigrationService.cs 파일의 176 번째 라인에서 정의되었습니다.

177 {
178 return await LoadAsync(ct).ConfigureAwait(false);
179 }

다음을 참조함 : LoadAsync().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ GetOrCreate()

MediaMigrationTenantStatus WeddingThankYou.Services.JsonMediaMigrationService.GetOrCreate ( Dictionary< string, MediaMigrationTenantStatus > all,
string slug )
inlinestaticprivate

Or Create 값을 가져옵니다.

매개변수
allall에 사용할 Dictionary<string, MediaMigrationTenantStatus> 값입니다.
slugslug에 사용할 string 값입니다.
반환값
Get Or Create 작업에서 생성한 MediaMigrationTenantStatus 결과입니다.

JsonMediaMigrationService.cs 파일의 780 번째 라인에서 정의되었습니다.

781 {
782 if (all.TryGetValue(slug, out var status)) return status;
783 status = new MediaMigrationTenantStatus { Slug = slug, State = MediaMigrationState.Pending };
784 all[slug] = status;
785 return status;
786 }

다음을 참조함 : WeddingThankYou.Models.Pending.

다음에 의해서 참조됨 : ProcessTenantAsync(), ProcessTenantSafeAsync().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ GetTenantStatusAsync()

async Task< MediaMigrationTenantStatus?> WeddingThankYou.Services.JsonMediaMigrationService.GetTenantStatusAsync ( string slug,
CancellationToken ct = default )
inline

Tenant Status Async 값을 가져옵니다.

매개변수
slugslug에 사용할 string 값입니다.
ct취소 요청을 감시하는 토큰입니다.
반환값
Get Tenant Status Async 작업에서 생성한 Task<MediaMigrationTenantStatus?> 결과입니다.

WeddingThankYou.Services.IMediaMigrationService를 구현.

JsonMediaMigrationService.cs 파일의 213 번째 라인에서 정의되었습니다.

214 {
215 var all = await LoadAsync(ct).ConfigureAwait(false);
216 return all.TryGetValue(slug, out var status) ? status : null;
217 }

다음을 참조함 : LoadAsync().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ IsRunning()

bool WeddingThankYou.Services.JsonMediaMigrationService.IsRunning ( string slug)
inlineprivate

Is Running 조건을 확인합니다.

매개변수
slugslug에 사용할 string 값입니다.
반환값
Is Running 조건이 충족되면 true이고, 그렇지 않으면 false입니다.

JsonMediaMigrationService.cs 파일의 698 번째 라인에서 정의되었습니다.

699 {
700 lock (_runningGate)
701 {
702 return _runningSlugs.Contains(slug);
703 }
704 }

다음을 참조함 : _runningGate, _runningSlugs.

다음에 의해서 참조됨 : QueueTenantAsync().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ LoadAsync()

async Task< Dictionary< string, MediaMigrationTenantStatus > > WeddingThankYou.Services.JsonMediaMigrationService.LoadAsync ( CancellationToken ct)
inlineprivate

Async 데이터를 불러옵니다.

매개변수
ct취소 요청을 감시하는 토큰입니다.
반환값
Load Async 작업에서 생성한 Task<Dictionary<string, MediaMigrationTenantStatus>> 결과입니다.

JsonMediaMigrationService.cs 파일의 576 번째 라인에서 정의되었습니다.

577 {
578 if (_cache is not null) return _cache;
579
580 await _gate.WaitAsync(ct).ConfigureAwait(false);
581 try
582 {
583 if (_cache is not null) return _cache;
584 var path = StatusPath;
585 if (!File.Exists(path))
586 {
587 _cache = new Dictionary<string, MediaMigrationTenantStatus>(StringComparer.OrdinalIgnoreCase);
588 return _cache;
589 }
590
591 await using var stream = File.OpenRead(path);
592 _cache = await JsonSerializer.DeserializeAsync<Dictionary<string, MediaMigrationTenantStatus>>(stream, _jsonOptions, ct).ConfigureAwait(false)
593 ?? new Dictionary<string, MediaMigrationTenantStatus>(StringComparer.OrdinalIgnoreCase);
594 return _cache;
595 }
596 finally
597 {
598 _gate.Release();
599 }
600 }

다음을 참조함 : _cache, _gate, _jsonOptions, StatusPath.

다음에 의해서 참조됨 : GetAllAsync(), GetTenantStatusAsync(), ProcessTenantAsync(), ProcessTenantSafeAsync(), QueueTenantAsync(), RetryTenantAsync().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ MarkFile()

void WeddingThankYou.Services.JsonMediaMigrationService.MarkFile ( MediaMigrationFileStatus fileStatus,
MediaMigrationState state,
string message )
inlinestaticprivate

Mark File 작업을 수행합니다.

매개변수
fileStatusfile Status에 사용할 MediaMigrationFileStatus 값입니다.
statestate에 사용할 MediaMigrationState 값입니다.
message처리할 메시지입니다.

JsonMediaMigrationService.cs 파일의 820 번째 라인에서 정의되었습니다.

821 {
822 fileStatus.State = state;
823 fileStatus.Message = message;
824 fileStatus.UpdatedAt = DateTime.Now;
825 }

다음에 의해서 참조됨 : ProcessTenantAsync().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ NormalizeFormat()

string WeddingThankYou.Services.JsonMediaMigrationService.NormalizeFormat ( string? outputFormat)
inlinestaticprivate

Normalize Format 작업을 수행합니다.

매개변수
outputFormatoutput Format에 사용할 string? 값입니다.
반환값
Normalize Format 작업에서 생성한 string 결과입니다.

JsonMediaMigrationService.cs 파일의 943 번째 라인에서 정의되었습니다.

944 {
945 var normalized = outputFormat?.Trim().TrimStart('.').ToLowerInvariant();
946 return string.IsNullOrWhiteSpace(normalized) ? "webp" : normalized;
947 }

다음에 의해서 참조됨 : ProcessTenantAsync(), ResolveWritableOutputFormat().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ ProcessTenantAsync()

async Task WeddingThankYou.Services.JsonMediaMigrationService.ProcessTenantAsync ( string slug,
CancellationToken ct )
inlineprivate

Process Tenant Async 작업을 수행합니다.

매개변수
slugslug에 사용할 string 값입니다.
ct취소 요청을 감시하는 토큰입니다.
반환값
Process Tenant Async 작업에서 생성한 Task 결과입니다.
예외
InvalidOperationException현재 객체 상태에서 Process Tenant Async 작업을 수행할 수 없는 경우 발생합니다.

JsonMediaMigrationService.cs 파일의 410 번째 라인에서 정의되었습니다.

411 {
412 var config = await _tenants.GetAsync(slug, ct).ConfigureAwait(false);
413 if (config is null) return;
414
415 var policy = await _policyResolver.ResolveAsync(config, ct).ConfigureAwait(false);
416 var all = await LoadAsync(ct).ConfigureAwait(false);
417 var status = GetOrCreate(all, slug);
418 status.State = MediaMigrationState.Processing;
419 status.Message = "처리 중";
420 status.UpdatedAt = DateTime.Now;
421 await SaveAsync(all, ct).ConfigureAwait(false);
422
423 var root = _tenants.GetTenantDataPath(slug);
424 var galleryDir = Path.Combine(root, "gallery");
425 var thumbDir = Path.Combine(root, "thumb");
426 var originalDir = Path.Combine(root, "original");
427 Directory.CreateDirectory(galleryDir);
428 Directory.CreateDirectory(thumbDir);
429 Directory.CreateDirectory(originalDir);
430
431 if (config.GalleryFileNames.Count == 0)
432 {
433 status.State = MediaMigrationState.Skipped;
434 status.Message = "변환할 이미지가 없습니다.";
435 status.UpdatedAt = DateTime.Now;
436 await SaveAsync(all, ct).ConfigureAwait(false);
437 return;
438 }
439
440 var anyFailed = false;
441 var anyProcessed = false;
442 var allSkipped = true;
443 var total = config.GalleryFileNames.Count;
444 var processed = 0;
445
446 foreach (var fileName in config.GalleryFileNames.ToArray())
447 {
448 ct.ThrowIfCancellationRequested();
449 var fileStatus = status.Files.FirstOrDefault(x => string.Equals(x.SourceFileName, fileName, StringComparison.OrdinalIgnoreCase));
450 if (fileStatus is { State: MediaMigrationState.Completed or MediaMigrationState.Skipped })
451 {
452 processed++;
453 continue;
454 }
455
456 fileStatus ??= new MediaMigrationFileStatus { SourceFileName = fileName };
457 if (!status.Files.Contains(fileStatus)) status.Files.Add(fileStatus);
458
459 var sourcePath = Path.Combine(galleryDir, fileName);
460 if (!File.Exists(sourcePath))
461 {
462 MarkFile(fileStatus, MediaMigrationState.Skipped, "원본 파일 없음");
463 continue;
464 }
465
466 var outputFormat = ResolveWritableOutputFormat(policy.ImageOutputFormat, fileName);
467 if (string.IsNullOrWhiteSpace(outputFormat))
468 {
469 MarkFile(fileStatus, MediaMigrationState.Skipped, $"{policy.ImageOutputFormat} 인코더 없음");
470 processed++;
471 continue;
472 }
473
474 try
475 {
476 fileStatus.State = MediaMigrationState.Processing;
477 fileStatus.Message = $"처리 중 ({processed + 1}/{total})";
478 fileStatus.UpdatedAt = DateTime.Now;
479 status.Message = fileStatus.Message;
480 await SaveAsync(all, ct).ConfigureAwait(false);
481
482 var targetName = $"{Path.GetFileNameWithoutExtension(fileName)}.{outputFormat}";
483 var tempPath = Path.Combine(galleryDir, $"{Path.GetFileNameWithoutExtension(fileName)}.migration.tmp.{outputFormat}");
484 var finalPath = Path.Combine(galleryDir, targetName);
485 var result = await _imageOptimization.OptimizeAsync(sourcePath, tempPath, policy, ct).ConfigureAwait(false);
486 if (!result.Succeeded || !File.Exists(tempPath) || new FileInfo(tempPath).Length == 0)
487 {
488 if (File.Exists(tempPath)) File.Delete(tempPath);
489 throw new InvalidOperationException(result.Message);
490 }
491
492 if (policy.KeepOriginalImages)
493 {
494 File.Copy(sourcePath, Path.Combine(originalDir, fileName), overwrite: true);
495 }
496
497 File.Move(tempPath, finalPath, overwrite: true);
498 File.Copy(finalPath, Path.Combine(thumbDir, targetName), overwrite: true);
499
500 var index = config.GalleryFileNames.FindIndex(x => string.Equals(x, fileName, StringComparison.OrdinalIgnoreCase));
501 if (index >= 0)
502 {
503 config.GalleryFileNames[index] = targetName;
504 await _tenants.SaveAsync(config, ct).ConfigureAwait(false);
505 }
506
507 if (!policy.KeepOriginalImages && !string.Equals(sourcePath, finalPath, StringComparison.OrdinalIgnoreCase))
508 {
509 File.Delete(sourcePath);
510 var oldThumb = Path.Combine(thumbDir, fileName);
511 if (File.Exists(oldThumb)) File.Delete(oldThumb);
512 }
513
514 fileStatus.TargetFileName = targetName;
515 var requestedFormat = NormalizeFormat(policy.ImageOutputFormat);
516 var formatMessage = string.Equals(requestedFormat, outputFormat, StringComparison.OrdinalIgnoreCase)
517 ? "완료"
518 : $"완료 ({policy.ImageOutputFormat} 미지원, {outputFormat.ToUpperInvariant()}로 최적화)";
519 MarkFile(fileStatus, MediaMigrationState.Completed, formatMessage);
520 anyProcessed = true;
521 allSkipped = false;
522 }
523 catch (Exception ex)
524 {
525 anyFailed = true;
526 MarkFile(fileStatus, MediaMigrationState.Failed, ex.Message);
527 }
528
529 processed++;
530 status.Message = BuildProgressMessage(status, processed, total);
531 await SaveAsync(all, ct).ConfigureAwait(false);
532 }
533
534 status.State = anyFailed
535 ? MediaMigrationState.Failed
536 : anyProcessed
537 ? MediaMigrationState.Completed
538 : allSkipped
539 ? MediaMigrationState.Skipped
540 : MediaMigrationState.Completed;
541 status.Message = status.State switch
542 {
543 MediaMigrationState.Completed => "완료",
544 MediaMigrationState.Failed => "실패 항목 있음",
545 MediaMigrationState.Skipped => "건너뜀",
546 _ => status.Message
547 };
548 status.UpdatedAt = DateTime.Now;
549 await SaveAsync(all, ct).ConfigureAwait(false);
550 }

다음을 참조함 : _imageOptimization, _policyResolver, _tenants, BuildProgressMessage(), WeddingThankYou.Models.Completed, WeddingThankYou.Models.Failed, GetOrCreate(), LoadAsync(), MarkFile(), NormalizeFormat(), ResolveWritableOutputFormat(), SaveAsync(), WeddingThankYou.Models.Skipped.

다음에 의해서 참조됨 : ProcessTenantSafeAsync().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ ProcessTenantSafeAsync()

async Task WeddingThankYou.Services.JsonMediaMigrationService.ProcessTenantSafeAsync ( string slug,
CancellationToken ct )
inlineprivate

Process Tenant Safe Async 작업을 수행합니다.

매개변수
slugslug에 사용할 string 값입니다.
ct취소 요청을 감시하는 토큰입니다.
반환값
Process Tenant Safe Async 작업에서 생성한 Task 결과입니다.

JsonMediaMigrationService.cs 파일의 353 번째 라인에서 정의되었습니다.

354 {
355 try
356 {
357 await ProcessTenantAsync(slug, ct).ConfigureAwait(false);
358 }
359 catch (Exception ex)
360 {
361 var all = await LoadAsync(CancellationToken.None).ConfigureAwait(false);
362 var status = GetOrCreate(all, slug);
363 status.State = MediaMigrationState.Failed;
364 status.Message = ex.Message;
365 status.UpdatedAt = DateTime.Now;
366 await SaveAsync(all, CancellationToken.None).ConfigureAwait(false);
367 }
368 }

다음을 참조함 : GetOrCreate(), LoadAsync(), ProcessTenantAsync(), SaveAsync().

다음에 의해서 참조됨 : StartBackground().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ QueueTenantAsync()

async Task WeddingThankYou.Services.JsonMediaMigrationService.QueueTenantAsync ( string slug,
CancellationToken ct = default )
inline

Queue Tenant Async 작업을 수행합니다.

매개변수
slugslug에 사용할 string 값입니다.
ct취소 요청을 감시하는 토큰입니다.
반환값
Queue Tenant Async 작업에서 생성한 Task 결과입니다.

WeddingThankYou.Services.IMediaMigrationService를 구현.

JsonMediaMigrationService.cs 파일의 251 번째 라인에서 정의되었습니다.

252 {
253 var all = await LoadAsync(ct).ConfigureAwait(false);
254 if (!all.TryGetValue(slug, out var status))
255 {
256 status = new MediaMigrationTenantStatus { Slug = slug, State = MediaMigrationState.Pending };
257 all[slug] = status;
258 }
259
260 if (status.State is MediaMigrationState.Processing && IsRunning(slug))
261 {
262 return;
263 }
264
265 status.State = MediaMigrationState.Pending;
266 status.Message = "변환 대기";
267 status.UpdatedAt = DateTime.Now;
268 await SaveAsync(all, ct).ConfigureAwait(false);
269 StartBackground(slug);
270 }

다음을 참조함 : IsRunning(), LoadAsync(), WeddingThankYou.Models.Pending, SaveAsync(), StartBackground().

다음에 의해서 참조됨 : RetryTenantAsync().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ ResolveWritableOutputFormat()

string WeddingThankYou.Services.JsonMediaMigrationService.ResolveWritableOutputFormat ( string? preferredFormat,
string? sourceFileName )
inlineprivate

Resolve Writable Output Format 작업을 수행합니다.

매개변수
preferredFormatpreferred Format에 사용할 string? 값입니다.
sourceFileNamesource File Name에 사용할 string? 값입니다.
반환값
Resolve Writable Output Format 작업에서 생성한 string 결과입니다.

JsonMediaMigrationService.cs 파일의 859 번째 라인에서 정의되었습니다.

860 {
861 var preferred = NormalizeFormat(preferredFormat);
862 if (_imageOptimization.CanEncode(preferred)) return preferred;
863
864 if (_imageOptimization.CanEncode("jpg")) return "jpg";
865
866 var original = NormalizeFormat(Path.GetExtension(sourceFileName));
867 return _imageOptimization.CanEncode(original) ? original : "";
868 }

다음을 참조함 : _imageOptimization, NormalizeFormat().

다음에 의해서 참조됨 : ProcessTenantAsync().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ RetryTenantAsync()

async Task WeddingThankYou.Services.JsonMediaMigrationService.RetryTenantAsync ( string slug,
CancellationToken ct = default )
inline

Retry Tenant Async 작업을 수행합니다.

매개변수
slugslug에 사용할 string 값입니다.
ct취소 요청을 감시하는 토큰입니다.
반환값
Retry Tenant Async 작업에서 생성한 Task 결과입니다.

WeddingThankYou.Services.IMediaMigrationService를 구현.

JsonMediaMigrationService.cs 파일의 304 번째 라인에서 정의되었습니다.

305 {
306 var all = await LoadAsync(ct).ConfigureAwait(false);
307 if (all.TryGetValue(slug, out var status))
308 {
309 foreach (var file in status.Files.Where(x => x.State == MediaMigrationState.Failed))
310 {
311 file.State = MediaMigrationState.Pending;
312 file.Message = "재시도 대기";
313 file.UpdatedAt = DateTime.Now;
314 }
315 }
316
317 await SaveAsync(all, ct).ConfigureAwait(false);
318 await QueueTenantAsync(slug, ct).ConfigureAwait(false);
319 }

다음을 참조함 : LoadAsync(), QueueTenantAsync(), SaveAsync().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:

◆ SaveAsync()

async Task WeddingThankYou.Services.JsonMediaMigrationService.SaveAsync ( Dictionary< string, MediaMigrationTenantStatus > status,
CancellationToken ct )
inlineprivate

Async 데이터를 저장합니다.

매개변수
statusstatus에 사용할 Dictionary<string, MediaMigrationTenantStatus> 값입니다.
ct취소 요청을 감시하는 토큰입니다.
반환값
Save Async 작업에서 생성한 Task 결과입니다.

JsonMediaMigrationService.cs 파일의 634 번째 라인에서 정의되었습니다.

635 {
636 await _gate.WaitAsync(ct).ConfigureAwait(false);
637 try
638 {
639 Directory.CreateDirectory(Path.GetDirectoryName(StatusPath)!);
640 var tmp = StatusPath + ".tmp";
641 await using (var stream = File.Create(tmp))
642 {
643 await JsonSerializer.SerializeAsync(stream, status, _jsonOptions, ct).ConfigureAwait(false);
644 }
645
646 File.Copy(tmp, StatusPath, overwrite: true);
647 File.Delete(tmp);
648 _cache = status;
649 }
650 finally
651 {
652 _gate.Release();
653 }
654 }

다음을 참조함 : _cache, _gate, _jsonOptions, StatusPath.

다음에 의해서 참조됨 : ProcessTenantAsync(), ProcessTenantSafeAsync(), QueueTenantAsync(), RetryTenantAsync().

이 함수를 호출하는 함수들에 대한 그래프입니다.:

◆ StartBackground()

void WeddingThankYou.Services.JsonMediaMigrationService.StartBackground ( string slug)
inlineprivate

Start Background 작업을 수행합니다.

매개변수
slugslug에 사용할 string 값입니다.

JsonMediaMigrationService.cs 파일의 722 번째 라인에서 정의되었습니다.

723 {
724 lock (_runningGate)
725 {
726 if (!_runningSlugs.Add(slug))
727 {
728 return;
729 }
730 }
731
732 _ = Task.Run(async () =>
733 {
734 try
735 {
736 await ProcessTenantSafeAsync(slug, CancellationToken.None).ConfigureAwait(false);
737 }
738 finally
739 {
740 lock (_runningGate)
741 {
742 _runningSlugs.Remove(slug);
743 }
744 }
745 });
746 }

다음을 참조함 : _runningGate, _runningSlugs, ProcessTenantSafeAsync().

다음에 의해서 참조됨 : QueueTenantAsync().

이 함수 내부에서 호출하는 함수들에 대한 그래프입니다.:
이 함수를 호출하는 함수들에 대한 그래프입니다.:

멤버 데이터 문서화

◆ _cache

Dictionary<string, MediaMigrationTenantStatus>? WeddingThankYou.Services.JsonMediaMigrationService._cache
private

cache 값을 보관합니다.

JsonMediaMigrationService.cs 파일의 98 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : LoadAsync(), SaveAsync().

◆ _gate

readonly SemaphoreSlim WeddingThankYou.Services.JsonMediaMigrationService._gate = new(1, 1)
private

gate 값을 보관합니다.

JsonMediaMigrationService.cs 파일의 61 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : LoadAsync(), SaveAsync().

◆ _imageOptimization

readonly IImageOptimizationService WeddingThankYou.Services.JsonMediaMigrationService._imageOptimization
private

image Optimization 값을 보관합니다.

JsonMediaMigrationService.cs 파일의 52 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : JsonMediaMigrationService(), ProcessTenantAsync(), ResolveWritableOutputFormat().

◆ _jsonOptions

readonly JsonSerializerOptions WeddingThankYou.Services.JsonMediaMigrationService._jsonOptions = new() { WriteIndented = true }
private

json Options 값을 보관합니다.

JsonMediaMigrationService.cs 파일의 88 번째 라인에서 정의되었습니다.

88{ WriteIndented = true };

다음에 의해서 참조됨 : LoadAsync(), SaveAsync().

◆ _options

readonly WeddingOptions WeddingThankYou.Services.JsonMediaMigrationService._options
private

options 값을 보관합니다.

JsonMediaMigrationService.cs 파일의 34 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : JsonMediaMigrationService().

◆ _policyResolver

readonly IMediaQuotaPolicyResolver WeddingThankYou.Services.JsonMediaMigrationService._policyResolver
private

policy Resolver 값을 보관합니다.

JsonMediaMigrationService.cs 파일의 43 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : JsonMediaMigrationService(), ProcessTenantAsync().

◆ _runningGate

readonly object WeddingThankYou.Services.JsonMediaMigrationService._runningGate = new()
private

running Gate 값을 보관합니다.

JsonMediaMigrationService.cs 파일의 70 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : IsRunning(), StartBackground().

◆ _runningSlugs

readonly HashSet<string> WeddingThankYou.Services.JsonMediaMigrationService._runningSlugs = new(StringComparer.OrdinalIgnoreCase)
private

running Slugs 값을 보관합니다.

JsonMediaMigrationService.cs 파일의 79 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : IsRunning(), StartBackground().

◆ _tenants

readonly ITenantStore WeddingThankYou.Services.JsonMediaMigrationService._tenants
private

tenants 값을 보관합니다.

JsonMediaMigrationService.cs 파일의 25 번째 라인에서 정의되었습니다.

다음에 의해서 참조됨 : JsonMediaMigrationService(), ProcessTenantAsync().

속성 문서화

◆ StatusPath

string WeddingThankYou.Services.JsonMediaMigrationService.StatusPath
getprivate

Status Path 값을 가져옵니다.

JsonMediaMigrationService.cs 파일의 664 번째 라인에서 정의되었습니다.

665 {
666 get
667 {
668 var dataRoot = Path.GetDirectoryName(_options.ResolvedDataPath.TrimEnd(Path.DirectorySeparatorChar))
669 ?? Path.Combine(AppContext.BaseDirectory, "App_Data");
670 return Path.Combine(dataRoot, "media-migration-status.json");
671 }
672 }

다음에 의해서 참조됨 : LoadAsync(), SaveAsync().


이 클래스에 대한 문서화 페이지는 다음의 파일로부터 생성되었습니다.: