WeddingPlatform.Web 1.0.0.0
지도, 갤러리, 방명록, 계좌 안내와 배경음악을 링크 하나에 담는 무료 모바일 청첩장 서비스입니다.
로딩중...
검색중...
일치하는것 없음
WeddingPlatform.Services.FileSystemMediaUsageQueryService 클래스 참조sealed

더 자세히 ...

WeddingPlatform.Services.FileSystemMediaUsageQueryService에 대한 상속 다이어그램 :
WeddingPlatform.Services.FileSystemMediaUsageQueryService에 대한 협력 다이어그램:

Public 멤버 함수

 FileSystemMediaUsageQueryService (ITenantStore tenants, IMediaMigrationService migrations)
async Task< TenantMediaUsageSummaryGetTenantUsageAsync (TenantConfig tenant, CancellationToken ct=default)
async Task< IReadOnlyDictionary< string, TenantMediaUsageSummary > > GetTenantUsageAsync (IEnumerable< TenantConfig > tenants, CancellationToken ct=default)

정적 Private 멤버 함수

static MediaMigrationState InferMigrationState (TenantConfig tenant)
static long SumTenantVideos (string root, IEnumerable< string > fileNames, out DateTime? lastModified)
static long SumFiles (string path, ISet< string > allowedExtensions, out DateTime? lastModified)
static void AddFile (string path, ref long total, ref DateTime? lastModified)
static ? DateTime MaxDate (params DateTime?[] values)

Private 속성

readonly ITenantStore _tenants
readonly IMediaMigrationService _migrations

정적 Private 속성

static readonly HashSet< string > ImageExtensions
static readonly HashSet< string > VideoExtensions
static readonly HashSet< string > RootMediaExtensions

상세한 설명

App_Data 파일 구조를 기준으로 테넌트별 미디어 사용량을 계산합니다.

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

생성자 & 소멸자 문서화

◆ FileSystemMediaUsageQueryService()

WeddingPlatform.Services.FileSystemMediaUsageQueryService.FileSystemMediaUsageQueryService ( ITenantStore tenants,
IMediaMigrationService migrations )
inline

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

매개변수
tenantstenants에 사용할 ITenantStore 값입니다.
migrationsmigrations에 사용할 IMediaMigrationService 값입니다.

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

99 {
100 _tenants = tenants;
101 _migrations = migrations;
102 }

다음을 참조함 : _migrations, _tenants.

멤버 함수 문서화

◆ AddFile()

void WeddingPlatform.Services.FileSystemMediaUsageQueryService.AddFile ( string path,
ref long total,
ref DateTime? lastModified )
inlinestaticprivate

File 항목을 추가합니다.

매개변수
pathpath에 사용할 string 값입니다.
totaltotal에 사용할 long 값입니다.
lastModifiedlast Modified에 사용할 DateTime? 값입니다.

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

382 {
383 try
384 {
385 var info = new FileInfo(path);
386 total += info.Length;
387 lastModified = MaxDate(lastModified, info.LastWriteTime);
388 }
389 catch
390 {
391 // 파일이 동시에 삭제되는 경우 사용량 계산에서만 제외합니다.
392 }
393 }

다음을 참조함 : MaxDate().

다음에 의해서 참조됨 : SumFiles(), SumTenantVideos().

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

◆ GetTenantUsageAsync() [1/2]

async Task< IReadOnlyDictionary< string, TenantMediaUsageSummary > > WeddingPlatform.Services.FileSystemMediaUsageQueryService.GetTenantUsageAsync ( IEnumerable< TenantConfig > tenants,
CancellationToken ct = default )
inline

Tenant Usage Async 값을 가져옵니다.

매개변수
tenantstenants에 사용할 IEnumerable<TenantConfig> 값입니다.
ct취소 요청을 감시하는 토큰입니다.
반환값
Get Tenant Usage Async 작업에서 생성한 Task<IReadOnlyDictionary<string, TenantMediaUsageSummary>> 결과입니다.

WeddingPlatform.Services.IMediaUsageQueryService를 구현.

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

197 {
198 var result = new Dictionary<string, TenantMediaUsageSummary>(StringComparer.OrdinalIgnoreCase);
199 foreach (var tenant in tenants)
200 {
201 result[tenant.Slug] = await GetTenantUsageAsync(tenant, ct).ConfigureAwait(false);
202 }
203
204 return result;
205 }

다음을 참조함 : GetTenantUsageAsync().

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

◆ GetTenantUsageAsync() [2/2]

async Task< TenantMediaUsageSummary > WeddingPlatform.Services.FileSystemMediaUsageQueryService.GetTenantUsageAsync ( TenantConfig tenant,
CancellationToken ct = default )
inline

Tenant Usage Async 값을 가져옵니다.

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

WeddingPlatform.Services.IMediaUsageQueryService를 구현.

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

137 {
138 var root = _tenants.GetTenantDataPath(tenant.Slug);
139 var galleryDir = Path.Combine(root, "gallery");
140 var thumbDir = Path.Combine(root, "thumb");
141 var originalDir = Path.Combine(root, "original");
142 var status = await _migrations.GetTenantStatusAsync(tenant.Slug, ct).ConfigureAwait(false);
143
144 var summary = new TenantMediaUsageSummary
145 {
146 Slug = tenant.Slug,
147 ImageCount = tenant.GalleryFileNames.Count,
148 VideoCount = tenant.VideoFileNames.Count,
149 MigrationState = status?.State ?? InferMigrationState(tenant),
150 LastModified = tenant.CreatedAt,
151 };
152
153 summary.OptimizedImageBytes = SumFiles(galleryDir, ImageExtensions, out var galleryModified);
154 var thumbBytes = SumFiles(thumbDir, ImageExtensions, out var thumbModified);
155 summary.OriginalImageBytes = SumFiles(originalDir, ImageExtensions, out var originalModified);
156 summary.VideoBytes = SumTenantVideos(root, tenant.VideoFileNames, out var videoModified);
157 var rootMediaBytes = SumFiles(root, RootMediaExtensions, out var rootModified);
158 summary.TotalBytes = summary.OptimizedImageBytes + thumbBytes + summary.OriginalImageBytes + summary.VideoBytes + rootMediaBytes;
159 summary.LastModified = MaxDate(galleryModified, thumbModified, originalModified, videoModified, rootModified) ?? tenant.CreatedAt;
160
161 return summary;
162 }

다음을 참조함 : _migrations, _tenants, WeddingPlatform.Models.TenantConfig.CreatedAt, WeddingPlatform.Models.TenantConfig.GalleryFileNames, ImageExtensions, InferMigrationState(), MaxDate(), RootMediaExtensions, WeddingPlatform.Models.TenantConfig.Slug, SumFiles(), SumTenantVideos(), WeddingPlatform.Models.TenantConfig.VideoFileNames.

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

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

◆ InferMigrationState()

MediaMigrationState WeddingPlatform.Services.FileSystemMediaUsageQueryService.InferMigrationState ( TenantConfig tenant)
inlinestaticprivate

Infer Migration State 작업을 수행합니다.

매개변수
tenanttenant에 사용할 TenantConfig 값입니다.
반환값
Infer Migration State 작업에서 생성한 MediaMigrationState 결과입니다.

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

232 {
233 if (tenant.GalleryFileNames.Count == 0) return MediaMigrationState.Skipped;
234 return tenant.GalleryFileNames.All(x => Path.GetExtension(x).Equals(".webp", StringComparison.OrdinalIgnoreCase))
235 ? MediaMigrationState.Completed
236 : MediaMigrationState.Pending;
237 }

다음을 참조함 : WeddingPlatform.Models.Completed, WeddingPlatform.Models.TenantConfig.GalleryFileNames.

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

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

◆ MaxDate()

? DateTime WeddingPlatform.Services.FileSystemMediaUsageQueryService.MaxDate ( params DateTime?[] values)
inlinestaticprivate

Max Date 작업을 수행합니다.

매개변수
valuesvalues에 사용할 DateTime?[] 값입니다.
반환값
Max Date 작업에서 생성한 DateTime? 결과입니다.

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

420 {
421 var concrete = values.Where(x => x.HasValue).Select(x => x!.Value).ToArray();
422 return concrete.Length == 0 ? null : concrete.Max();
423 }

다음에 의해서 참조됨 : AddFile(), GetTenantUsageAsync().

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

◆ SumFiles()

long WeddingPlatform.Services.FileSystemMediaUsageQueryService.SumFiles ( string path,
ISet< string > allowedExtensions,
out DateTime? lastModified )
inlinestaticprivate

Sum Files 작업을 수행합니다.

매개변수
pathpath에 사용할 string 값입니다.
allowedExtensionsallowed Extensions에 사용할 ISet<string> 값입니다.
lastModifiedlast Modified에 사용할 DateTime? 값입니다.
반환값
Sum Files 작업에서 생성한 long 결과입니다.

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

335 {
336 long total = 0;
337 lastModified = null;
338 if (!Directory.Exists(path)) return 0;
339
340 foreach (var file in Directory.EnumerateFiles(path, "*", SearchOption.TopDirectoryOnly))
341 {
342 if (!allowedExtensions.Contains(Path.GetExtension(file))) continue;
343 AddFile(file, ref total, ref lastModified);
344 }
345
346 return total;
347 }

다음을 참조함 : AddFile().

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

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

◆ SumTenantVideos()

long WeddingPlatform.Services.FileSystemMediaUsageQueryService.SumTenantVideos ( string root,
IEnumerable< string > fileNames,
out DateTime? lastModified )
inlinestaticprivate

Sum Tenant Videos 작업을 수행합니다.

매개변수
rootroot에 사용할 string 값입니다.
fileNamesfile Names에 사용할 IEnumerable<string> 값입니다.
lastModifiedlast Modified에 사용할 DateTime? 값입니다.
반환값
Sum Tenant Videos 작업에서 생성한 long 결과입니다.

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

280 {
281 long total = 0;
282 lastModified = null;
283
284 foreach (var fileName in fileNames)
285 {
286 var path = Path.Combine(root, fileName);
287 if (!File.Exists(path) || !VideoExtensions.Contains(Path.GetExtension(path))) continue;
288 AddFile(path, ref total, ref lastModified);
289 }
290
291 return total;
292 }

다음을 참조함 : AddFile(), VideoExtensions.

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

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

멤버 데이터 문서화

◆ _migrations

readonly IMediaMigrationService WeddingPlatform.Services.FileSystemMediaUsageQueryService._migrations
private

migrations 값을 보관합니다.

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

다음에 의해서 참조됨 : FileSystemMediaUsageQueryService(), GetTenantUsageAsync().

◆ _tenants

readonly ITenantStore WeddingPlatform.Services.FileSystemMediaUsageQueryService._tenants
private

tenants 값을 보관합니다.

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

다음에 의해서 참조됨 : FileSystemMediaUsageQueryService(), GetTenantUsageAsync().

◆ ImageExtensions

readonly HashSet<string> WeddingPlatform.Services.FileSystemMediaUsageQueryService.ImageExtensions
staticprivate
초기값:
= new(StringComparer.OrdinalIgnoreCase)
{
".jpg", ".jpeg", ".png", ".webp", ".gif"
}

Image Extensions 값을 보관합니다.

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

25 {
26 ".jpg", ".jpeg", ".png", ".webp", ".gif"
27 };

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

◆ RootMediaExtensions

readonly HashSet<string> WeddingPlatform.Services.FileSystemMediaUsageQueryService.RootMediaExtensions
staticprivate
초기값:
= new(StringComparer.OrdinalIgnoreCase)
{
".jpg", ".jpeg", ".png", ".webp", ".gif", ".mp3", ".ogg", ".wav", ".aac", ".m4a"
}

Root Media Extensions 값을 보관합니다.

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

51 {
52 ".jpg", ".jpeg", ".png", ".webp", ".gif", ".mp3", ".ogg", ".wav", ".aac", ".m4a"
53 };

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

◆ VideoExtensions

readonly HashSet<string> WeddingPlatform.Services.FileSystemMediaUsageQueryService.VideoExtensions
staticprivate
초기값:
= new(StringComparer.OrdinalIgnoreCase)
{
".mp4", ".webm", ".mov", ".m4v"
}

Video Extensions 값을 보관합니다.

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

38 {
39 ".mp4", ".webm", ".mov", ".m4v"
40 };

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


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