// SPDX-License-Identifier: AGPL-3.0-or-later // Copyright (C) 2022-2026 Aykut Alparslan KOC using Ferrite.Data.Primitives; namespace Ferrite.Data.UpdateState; public class FasterUpdatesContextFactory : IUpdatesContextFactory, IAsyncDisposable { private readonly FasterContext _counterContext; private readonly FasterContext> _unreadContext; private readonly FasterContext> _dialogContex; private readonly FasterContext _settledPtsContext; public FasterUpdatesContextFactory(string path) { _counterContext = new FasterContext(path + "-counter"); _unreadContext = new FasterContext>(path + "-unread"); _dialogContex = new FasterContext>(path + "-dialog"); _settledPtsContext = new FasterContext(path + "-settled-pts"); } public IUpdatesContext GetUpdatesContext(long? authKeyId, long userId) { return new FasterUpdatesContext(_counterContext, _unreadContext, _dialogContex, _settledPtsContext, authKeyId, userId); } public async ValueTask DisposeAsync() { await _counterContext.DisposeAsync(); await _unreadContext.DisposeAsync(); await _dialogContex.DisposeAsync(); await _settledPtsContext.DisposeAsync(); } }