public int GetId() { var id = idHelper.GetNextId(); if (binaryArray.Count <= id * structSize) { var newSize = (id * 2) * structSize; if (newSize > MaxArraySizeExpoentialIncrement) { newSize = (id + 1) * structSize; } rwLock.EnterWriteLock(); binaryArray.Resize(newSize, false); rwLock.ExitWriteLock(); logger.Log(Logger.LogLevel.Debug, $"Resize struct array to " + $"{structSize} * {id + 1} = {binaryArray.Count}", tag); } logger.Log(Logger.LogLevel.Debug, $"Getting new id {id} on struct size {StructSize}.", tag); return(id); }
protected override ArrayStorage OnCreate(ref int key, ref int argument) { logger.Log(Logger.LogLevel.Information, $"Creating new struct array with size {argument}"); return(new ArrayStorage(argument, logger)); }