public async ValueTask <long> GetMessageIdAsync(int minuteNo)
        {
            if (!_initialized)
            {
                await InitAsync();
            }

            var minuteIndex = MessagesMinuteUtils.GetIndexOffset(minuteNo);

            return(await _builder.ReadInt64Async(minuteIndex));
        }
        public async ValueTask WriteAsync(int minute, long messageId)
        {
            if (!_initialized)
            {
                await InitAsync();
            }

            var minuteIndex = MessagesMinuteUtils.GetIndexOffset(minute);

            _appLogger?.AddLog(LogProcess.MinuteIndexWriter, _topicId, "MessageId:" + messageId, $"[{_topicId}] Writing minute index with minutes. " + minute + "min=" + messageId + "msgId;");

            await _builder.WriteInt64Async(messageId, minuteIndex);
        }
예제 #3
0
        public static IEnumerable <int> GetAffectedPages(IEnumerable <int> minutes)
        {
            var result = new Dictionary <int, int>();

            foreach (var minute in minutes)
            {
                var offset = MessagesMinuteUtils.GetIndexOffset(minute);

                var page = offset / MyAzurePageBlobUtils.PageSize;

                if (!result.ContainsKey(page))
                {
                    result.Add(page, page);
                }
            }

            return(result.Keys);
        }