public void CleanupDocuments(Etag lastIndexedEtag) { foreach (var docToRemove in documentsToRemove) { if (docToRemove.Value.All(etag => lastIndexedEtag.CompareTo(etag) > 0) == false) { continue; } HashSet <Etag> _; documentsToRemove.TryRemove(docToRemove.Key, out _); } updatedDocumentsLock.EnterWriteLock(); try { updatedDocuments.RemoveSmallerOrEqual(lastIndexedEtag); } finally { updatedDocumentsLock.ExitWriteLock(); } JsonDocument result; while (prefetchingQueue.TryPeek(out result) && lastIndexedEtag.CompareTo(result.Etag) >= 0) { prefetchingQueue.TryDequeue(out result); } }
public void EmptyList() { var list = new SortedKeyList <Etag>(); list.RemoveSmallerOrEqual(zero); Assert.Equal(0, list.Count); }
public void EmptyList() { var list = new SortedKeyList<Etag>(); list.RemoveSmallerOrEqual(zero); Assert.Equal(0, list.Count); }
public void ShouldNotRemoveAnything() { var list = new SortedKeyList <Etag>(); list.Add(ToEtag(6)); list.Add(ToEtag(8)); list.Add(ToEtag(7)); list.RemoveSmallerOrEqual(ToEtag(5)); Assert.Equal(3, list.Count); }
public void ShouldNotRemoveAnything() { var list = new SortedKeyList<Etag>(); list.Add(ToEtag(6)); list.Add(ToEtag(8)); list.Add(ToEtag(7)); list.RemoveSmallerOrEqual(ToEtag(5)); Assert.Equal(3, list.Count); }
public void ShouldRemainOneItem_RemovingItemIsOnTheList() { var list = new SortedKeyList <Etag>(); list.Add(ToEtag(1)); list.Add(ToEtag(3)); list.Add(ToEtag(5)); list.RemoveSmallerOrEqual(ToEtag(3)); Assert.Equal(1, list.Count); Assert.True(list.Contains(ToEtag(5))); }
public void ShouldRemainOneItem_RemovingItemIsntOnTheList() { var list = new SortedKeyList<Etag>(); list.Add(ToEtag(1)); list.Add(ToEtag(3)); list.Add(ToEtag(5)); list.RemoveSmallerOrEqual(ToEtag(4)); Assert.Equal(1, list.Count); Assert.True(list.Contains(ToEtag(5))); }