From a9b041a7e62f408e07d15cb7cf253d76919b6fa1 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sat, 29 Apr 2017 22:37:51 -0400 Subject: rework refresh queue --- .../Manager/IFixedSizePriorityQueue.cs | 28 ++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 MediaBrowser.Providers/Manager/IFixedSizePriorityQueue.cs (limited to 'MediaBrowser.Providers/Manager/IFixedSizePriorityQueue.cs') diff --git a/MediaBrowser.Providers/Manager/IFixedSizePriorityQueue.cs b/MediaBrowser.Providers/Manager/IFixedSizePriorityQueue.cs new file mode 100644 index 000000000..8da88e1c6 --- /dev/null +++ b/MediaBrowser.Providers/Manager/IFixedSizePriorityQueue.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Priority_Queue +{ + /// + /// Credit: https://github.com/BlueRaja/High-Speed-Priority-Queue-for-C-Sharp + /// A helper-interface only needed to make writing unit tests a bit easier (hence the 'internal' access modifier) + /// + internal interface IFixedSizePriorityQueue : IPriorityQueue + where TPriority : IComparable + { + /// + /// Resize the queue so it can accept more nodes. All currently enqueued nodes are remain. + /// Attempting to decrease the queue size to a size too small to hold the existing nodes results in undefined behavior + /// + void Resize(int maxNodes); + + /// + /// Returns the maximum number of items that can be enqueued at once in this queue. Once you hit this number (ie. once Count == MaxSize), + /// attempting to enqueue another item will cause undefined behavior. + /// + int MaxSize { get; } + } +} \ No newline at end of file -- cgit v1.2.3