public ChunkHandler(long battleId, ChunkSettings chunkSettings, ChunkKey chunkKey, IChunklerClient chunklerClient) { _chunkKey = chunkKey; _chunkSettings = chunkSettings ?? throw new ArgumentNullException(nameof(chunkSettings)); _chunklerClient = chunklerClient ?? throw new ArgumentNullException(nameof(chunklerClient)); _subscriptions = new ConcurrentDictionary <IChunkHandlerSubscription, Func <ChunkKey, ChunkUpdate, Task> >(); _lastUpdatedTicksUTC = DateTime.MinValue.Ticks; _subscriptionCounter = 0; _battleId = battleId; }
public BattleHandler(long battleId, BattleSettings battleSettings, IChunklerClient chunklerClient, IChunkHandlerFactory chunkHandlerFactory) { _isClosing = false; _battleId = battleId; _battleSettings = battleSettings ?? throw new ArgumentNullException(nameof(battleSettings)); _subscriptionCounter = 0; _lastUpdatedTicksUTC = DateTime.UtcNow.Ticks; _chunklerClient = chunklerClient ?? throw new ArgumentNullException(nameof(chunklerClient)); _chunkHandlerFactory = chunkHandlerFactory ?? throw new ArgumentNullException(nameof(chunkHandlerFactory)); _chunkHandlers = new ConcurrentDictionary <ChunkKey, AsyncLazy <ChunkHandler> >(); _compactedChunkHandlers = new Dictionary <ChunkKey, AsyncLazy <ChunkHandler> >(); }
public async Task <ChunkHandler> CreateChunkHandlerAsync(long battleId, ChunkSettings chunkSettings, ChunkKey chunkKey, IChunklerClient chunklerClient) { var handler = new ChunkHandler(battleId, chunkSettings, chunkKey, chunklerClient); await handler.SubscribeToChunkAsync(); return(handler); }