Families.Web 1.0.0.0
사진, 동영상, 글, 댓글과 반응을 가족끼리만 공유하는 비공개 앨범·타임라인 서비스입니다.
로딩중...
검색중...
일치하는것 없음
FamiliesApp.Services.JsonReactionStore 클래스 참조sealed

더 자세히 ...

FamiliesApp.Services.JsonReactionStore에 대한 상속 다이어그램 :
FamiliesApp.Services.JsonReactionStore에 대한 협력 다이어그램:

Public 멤버 함수

 JsonReactionStore (IFamilyTenantStore tenants)
async Task< ReactionSummaryGetAsync (string slug, string postId, CancellationToken ct=default)
async Task AddReactionAsync (string slug, string postId, string emoji, CancellationToken ct=default)
async Task AddCommentAsync (string slug, string postId, CommentEntry comment, CancellationToken ct=default)
async Task DeleteCommentAsync (string slug, string postId, string commentId, CancellationToken ct=default)

Private 멤버 함수

string ReactionsDir (string slug)
string ReactionPath (string slug, string postId)
async Task SaveAsync (string slug, ReactionSummary summary, CancellationToken ct=default)

정적 Private 멤버 함수

static string Sanitize (string id)

Private 속성

readonly IFamilyTenantStore _tenants

정적 Private 속성

static readonly SemaphoreSlim _gate = new(1, 1)
static readonly JsonSerializerOptions _jsonOpts

상세한 설명

Json Reaction Store 기능과 관련 상태를 캡슐화합니다.

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

생성자 & 소멸자 문서화

◆ JsonReactionStore()

FamiliesApp.Services.JsonReactionStore.JsonReactionStore ( IFamilyTenantStore tenants)
inline

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

매개변수
tenantstenants에 사용할 IFamilyTenantStore 값입니다.

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

66=> _tenants = tenants;

다음을 참조함 : _tenants.

멤버 함수 문서화

◆ AddCommentAsync()

async Task FamiliesApp.Services.JsonReactionStore.AddCommentAsync ( string slug,
string postId,
CommentEntry comment,
CancellationToken ct = default )
inline

Comment Async 항목을 추가합니다.

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

FamiliesApp.Services.IReactionStore를 구현.

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

290 {
291 var summary = await GetAsync(slug, postId, ct).ConfigureAwait(false);
292 comment.PostId = postId;
293 summary.Comments.Add(comment);
294 await SaveAsync(slug, summary, ct).ConfigureAwait(false);
295 }

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

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

◆ AddReactionAsync()

async Task FamiliesApp.Services.JsonReactionStore.AddReactionAsync ( string slug,
string postId,
string emoji,
CancellationToken ct = default )
inline

Reaction Async 항목을 추가합니다.

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

FamiliesApp.Services.IReactionStore를 구현.

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

234 {
235 var summary = await GetAsync(slug, postId, ct).ConfigureAwait(false);
236 summary.EmojiCounts.TryGetValue(emoji, out int current);
237 summary.EmojiCounts[emoji] = current + 1;
238 await SaveAsync(slug, summary, ct).ConfigureAwait(false);
239 }

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

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

◆ DeleteCommentAsync()

async Task FamiliesApp.Services.JsonReactionStore.DeleteCommentAsync ( string slug,
string postId,
string commentId,
CancellationToken ct = default )
inline

Delete Comment Async 작업을 수행합니다.

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

FamiliesApp.Services.IReactionStore를 구현.

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

346 {
347 var summary = await GetAsync(slug, postId, ct).ConfigureAwait(false);
348 summary.Comments.RemoveAll(c => c.Id == commentId);
349 await SaveAsync(slug, summary, ct).ConfigureAwait(false);
350 }

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

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

◆ GetAsync()

async Task< ReactionSummary > FamiliesApp.Services.JsonReactionStore.GetAsync ( string slug,
string postId,
CancellationToken ct = default )
inline

Async 값을 가져옵니다.

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

FamiliesApp.Services.IReactionStore를 구현.

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

171 {
172 var path = ReactionPath(slug, postId);
173 if (!File.Exists(path)) return new ReactionSummary { PostId = postId };
174
175 await _gate.WaitAsync(ct).ConfigureAwait(false);
176 try
177 {
178 await using var fs = File.OpenRead(path);
179 return await JsonSerializer.DeserializeAsync<ReactionSummary>(fs, _jsonOpts, ct).ConfigureAwait(false)
180 ?? new ReactionSummary { PostId = postId };
181 }
182 finally { _gate.Release(); }
183 }

다음을 참조함 : _gate, _jsonOpts, ReactionPath().

다음에 의해서 참조됨 : AddCommentAsync(), AddReactionAsync(), DeleteCommentAsync().

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

◆ ReactionPath()

string FamiliesApp.Services.JsonReactionStore.ReactionPath ( string slug,
string postId )
inlineprivate

Reaction Path 작업을 수행합니다.

매개변수
slugslug에 사용할 string 값입니다.
postIdpost Id에 사용할 string 값입니다.
반환값
Reaction Path 작업에서 생성한 string 결과입니다.

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

127 =>
128 Path.Combine(ReactionsDir(slug), $"{Sanitize(postId)}.json");

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

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

◆ ReactionsDir()

string FamiliesApp.Services.JsonReactionStore.ReactionsDir ( string slug)
inlineprivate

Reactions Dir 작업을 수행합니다.

매개변수
slugslug에 사용할 string 값입니다.
반환값
Reactions Dir 작업에서 생성한 string 결과입니다.

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

92 =>
93 Path.Combine(_tenants.GetTenantDataPath(slug), "reactions");

다음을 참조함 : _tenants.

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

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

◆ Sanitize()

string FamiliesApp.Services.JsonReactionStore.Sanitize ( string id)
inlinestaticprivate

Sanitize 작업을 수행합니다.

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

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

436 =>
437 string.Concat(id.Split(Path.GetInvalidFileNameChars()));

◆ SaveAsync()

async Task FamiliesApp.Services.JsonReactionStore.SaveAsync ( string slug,
ReactionSummary summary,
CancellationToken ct = default )
inlineprivate

Async 데이터를 저장합니다.

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

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

393 {
394 var dir = ReactionsDir(slug);
395 Directory.CreateDirectory(dir);
396
397 var path = ReactionPath(slug, summary.PostId);
398 var tmp = path + ".tmp";
399
400 await _gate.WaitAsync(ct).ConfigureAwait(false);
401 try
402 {
403 await using (var fs = File.Create(tmp))
404 await JsonSerializer.SerializeAsync(fs, summary, _jsonOpts, ct).ConfigureAwait(false);
405
406 File.Copy(tmp, path, overwrite: true);
407 File.Delete(tmp);
408 }
409 finally { _gate.Release(); }
410 }

다음을 참조함 : _gate, _jsonOpts, FamiliesApp.Models.ReactionSummary.PostId, ReactionPath(), ReactionsDir().

다음에 의해서 참조됨 : AddCommentAsync(), AddReactionAsync(), DeleteCommentAsync().

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

멤버 데이터 문서화

◆ _gate

readonly SemaphoreSlim FamiliesApp.Services.JsonReactionStore._gate = new(1, 1)
staticprivate

gate 값을 보관합니다.

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

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

◆ _jsonOpts

readonly JsonSerializerOptions FamiliesApp.Services.JsonReactionStore._jsonOpts
staticprivate
초기값:
= new()
{
WriteIndented = true,
PropertyNameCaseInsensitive = true
}

json Opts 값을 보관합니다.

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

45 {
46 WriteIndented = true,
47 PropertyNameCaseInsensitive = true
48 };

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

◆ _tenants

readonly IFamilyTenantStore FamiliesApp.Services.JsonReactionStore._tenants
private

tenants 값을 보관합니다.

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

다음에 의해서 참조됨 : JsonReactionStore(), ReactionsDir().


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