private static async Task <List <Guid> > GetOldGetMsgIds(GetOldMessagesInput input, IReliableDictionary2 <Guid, List <Guid> > indexDict, ITransaction tx) { if (await indexDict.ContainsKeyAsync(tx, input.Id)) { var lstMessageIndex = (await indexDict.TryGetValueAsync(tx, input.Id)).Value; var oldestMsgIndex = lstMessageIndex.IndexOf(input.OldestMsgId); if (oldestMsgIndex == 0) { return(null); } var endIndex = oldestMsgIndex - 1; var startIndex = oldestMsgIndex - MaxMessageAmount; var amount = MaxMessageAmount; if (startIndex < 0) { startIndex = 0; amount = endIndex - startIndex + 1; } return(lstMessageIndex.GetRange(startIndex, amount)); } return(null); }
public Task <bool> ContainsKeyAsync(ITransaction tx, TKey key) { return(_dictionary.ContainsKeyAsync(tx, key)); }