From 6d0398eb31a9d312ebdfeb7825f24ec1ff0adf6c Mon Sep 17 00:00:00 2001 From: justcoding121 Date: Wed, 8 Aug 2018 10:59:56 -0400 Subject: [PATCH 1/2] async queue --- Advanced.Algorithms/Distributed/AsyncQueue.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Advanced.Algorithms/Distributed/AsyncQueue.cs b/Advanced.Algorithms/Distributed/AsyncQueue.cs index 69e992d3..59c8ec7d 100644 --- a/Advanced.Algorithms/Distributed/AsyncQueue.cs +++ b/Advanced.Algorithms/Distributed/AsyncQueue.cs @@ -7,7 +7,7 @@ namespace Advanced.Algorithms.Distributed /// /// A simple asynchronous multi-thread supporting producer/consumer FIFO queue with minimal locking. /// - internal class AsyncQueue + public class AsyncQueue { //data queue. private readonly Queue queue = new Queue(); @@ -20,7 +20,7 @@ internal class AsyncQueue /// Supports multi-threaded producers. /// Time complexity: O(1). /// - internal async Task EnqueueAsync(T value, CancellationToken taskCancellationToken = default(CancellationToken)) + public async Task EnqueueAsync(T value, CancellationToken taskCancellationToken = default(CancellationToken)) { await consumerQueueLock.WaitAsync(taskCancellationToken); @@ -41,7 +41,7 @@ internal class AsyncQueue /// Supports multi-threaded consumers. /// Time complexity: O(1). /// - internal async Task DequeueAsync(CancellationToken taskCancellationToken = default(CancellationToken)) + public async Task DequeueAsync(CancellationToken taskCancellationToken = default(CancellationToken)) { await consumerQueueLock.WaitAsync(taskCancellationToken); From 3f83f35146f5b8ce525037c5cf053a7da0e4abcc Mon Sep 17 00:00:00 2001 From: buildbot121 Date: Wed, 8 Aug 2018 08:02:43 -0700 Subject: [PATCH 2/2] API documentation update by build server --- ...d.Algorithms.Distributed.AsyncQueue-1.html | 269 ++++++++++++++++++ docs/api/Advanced.Algorithms.Distributed.html | 3 + docs/api/toc.html | 3 + docs/index.json | 7 +- docs/xrefmap.yml | 43 +++ 5 files changed, 324 insertions(+), 1 deletion(-) create mode 100644 docs/api/Advanced.Algorithms.Distributed.AsyncQueue-1.html diff --git a/docs/api/Advanced.Algorithms.Distributed.AsyncQueue-1.html b/docs/api/Advanced.Algorithms.Distributed.AsyncQueue-1.html new file mode 100644 index 00000000..4bc669f9 --- /dev/null +++ b/docs/api/Advanced.Algorithms.Distributed.AsyncQueue-1.html @@ -0,0 +1,269 @@ + + + + + + + + Class AsyncQueue<T> + | Advanced Algorithms + + + + + + + + + + + + + + + +
+
+ +
+
+
+ + + + + +
+
+
+
+ +
+
+
+
+
+ +
+
+
    +
  • +
+
+
+
+
+ +
+
+
+

+
+
    +
    +
    +
    + +
    + Show / Hide Table of Contents +
    +
    +
    +
    +
    +
    +
    + + +

    Class AsyncQueue<T> +

    +

    A simple asynchronous multi-thread supporting producer/consumer FIFO queue with minimal locking.

    +
    +
    +
    +
    Inheritance
    +
    Object
    +
    AsyncQueue<T>
    +
    +
    +
    Inherited Members
    +
    + Object.ToString() +
    +
    + Object.Equals(Object) +
    +
    + Object.Equals(Object, Object) +
    +
    + Object.ReferenceEquals(Object, Object) +
    +
    + Object.GetHashCode() +
    +
    + Object.GetType() +
    +
    + Object.MemberwiseClone() +
    +
    +
    Namespace: Advanced.Algorithms.Distributed
    +
    Assembly: Advanced.Algorithms.dll
    +
    Syntax
    +
    +
    public class AsyncQueue<T>
    +
    +
    Type Parameters
    + + + + + + + + + + + + + +
    NameDescription
    T
    +

    Methods +

    + + + +

    DequeueAsync(CancellationToken)

    +

    Supports multi-threaded consumers. +Time complexity: O(1).

    +
    +
    +
    Declaration
    +
    +
    public Task<T> DequeueAsync(CancellationToken taskCancellationToken = default(CancellationToken))
    +
    +
    Parameters
    + + + + + + + + + + + + + + + +
    TypeNameDescription
    CancellationTokentaskCancellationToken
    +
    Returns
    + + + + + + + + + + + + + +
    TypeDescription
    Task<T>
    + + + +

    EnqueueAsync(T, CancellationToken)

    +

    Supports multi-threaded producers. +Time complexity: O(1).

    +
    +
    +
    Declaration
    +
    +
    public Task EnqueueAsync(T value, CancellationToken taskCancellationToken = default(CancellationToken))
    +
    +
    Parameters
    + + + + + + + + + + + + + + + + + + + + +
    TypeNameDescription
    Tvalue
    CancellationTokentaskCancellationToken
    +
    Returns
    + + + + + + + + + + + + + +
    TypeDescription
    Task
    +
    +
    + +
    +
    +
    +
      +
    +
    +
    + +
    +
    +
    +
    +
    + +
    +
    +
    +
    + + Back to top + + + Generated by DocFX +
    +
    +
    +
    + + + + + + diff --git a/docs/api/Advanced.Algorithms.Distributed.html b/docs/api/Advanced.Algorithms.Distributed.html index 4f1057a0..1c8b1863 100644 --- a/docs/api/Advanced.Algorithms.Distributed.html +++ b/docs/api/Advanced.Algorithms.Distributed.html @@ -87,6 +87,9 @@

    Classes

    +

    AsyncQueue<T>

    +

    A simple asynchronous multi-thread supporting producer/consumer FIFO queue with minimal locking.

    +

    CircularQueue<T>

    Cicular queue aka Ring Buffer using fixed size array.

    diff --git a/docs/api/toc.html b/docs/api/toc.html index 3a89a092..60f62e91 100644 --- a/docs/api/toc.html +++ b/docs/api/toc.html @@ -274,6 +274,9 @@ Advanced.Algorithms.Distributed
      +
    • + AsyncQueue<T> +
    • CircularQueue<T>
    • diff --git a/docs/index.json b/docs/index.json index 028fa6af..1adf3ffb 100644 --- a/docs/index.json +++ b/docs/index.json @@ -394,6 +394,11 @@ "title": "Class Trie | Advanced Algorithms", "keywords": "Class Trie A trie (prefix tree) implementation. Inheritance Object Trie Implements IEnumerable IEnumerable Inherited Members Object.ToString() Object.Equals(Object) Object.Equals(Object, Object) Object.ReferenceEquals(Object, Object) Object.GetHashCode() Object.GetType() Object.MemberwiseClone() Namespace : Advanced.Algorithms.DataStructures Assembly : Advanced.Algorithms.dll Syntax public class Trie : IEnumerable, IEnumerable Type Parameters Name Description T Constructors Trie() Declaration public Trie() Properties Count Declaration public int Count { get; } Property Value Type Description Int32 Methods Contains(T[]) Returns true if the entry exist. Time complexity: O(e) where e is the length of the given entry. Declaration public bool Contains(T[] entry) Parameters Type Name Description T[] entry Returns Type Description Boolean ContainsPrefix(T[]) Returns true if any records match this prefix. Time complexity: O(e) where e is the length of the given entry. Declaration public bool ContainsPrefix(T[] prefix) Parameters Type Name Description T[] prefix Returns Type Description Boolean Delete(T[]) Deletes a record from this trie. Time complexity: O(m) where m is the length of entry. Declaration public void Delete(T[] entry) Parameters Type Name Description T[] entry GetEnumerator() Declaration public IEnumerator GetEnumerator() Returns Type Description IEnumerator Insert(T[]) Insert a new record to this trie. Time complexity: O(m) where m is the length of entry. Declaration public void Insert(T[] entry) Parameters Type Name Description T[] entry StartsWith(T[]) Returns a list of records matching this prefix. Time complexity: O(rm) where r is the number of results and m is the average length of each entry. Declaration public List StartsWith(T[] prefix) Parameters Type Name Description T[] prefix Returns Type Description List Explicit Interface Implementations IEnumerable.GetEnumerator() Declaration IEnumerator IEnumerable.GetEnumerator() Returns Type Description IEnumerator Implements System.Collections.Generic.IEnumerable System.Collections.IEnumerable" }, + "api/Advanced.Algorithms.Distributed.AsyncQueue-1.html": { + "href": "api/Advanced.Algorithms.Distributed.AsyncQueue-1.html", + "title": "Class AsyncQueue | Advanced Algorithms", + "keywords": "Class AsyncQueue A simple asynchronous multi-thread supporting producer/consumer FIFO queue with minimal locking. Inheritance Object AsyncQueue Inherited Members Object.ToString() Object.Equals(Object) Object.Equals(Object, Object) Object.ReferenceEquals(Object, Object) Object.GetHashCode() Object.GetType() Object.MemberwiseClone() Namespace : Advanced.Algorithms.Distributed Assembly : Advanced.Algorithms.dll Syntax public class AsyncQueue Type Parameters Name Description T Methods DequeueAsync(CancellationToken) Supports multi-threaded consumers. Time complexity: O(1). Declaration public Task DequeueAsync(CancellationToken taskCancellationToken = default(CancellationToken)) Parameters Type Name Description CancellationToken taskCancellationToken Returns Type Description Task EnqueueAsync(T, CancellationToken) Supports multi-threaded producers. Time complexity: O(1). Declaration public Task EnqueueAsync(T value, CancellationToken taskCancellationToken = default(CancellationToken)) Parameters Type Name Description T value CancellationToken taskCancellationToken Returns Type Description Task" + }, "api/Advanced.Algorithms.Distributed.CircularQueue-1.html": { "href": "api/Advanced.Algorithms.Distributed.CircularQueue-1.html", "title": "Class CircularQueue | Advanced Algorithms", @@ -407,7 +412,7 @@ "api/Advanced.Algorithms.Distributed.html": { "href": "api/Advanced.Algorithms.Distributed.html", "title": "Namespace Advanced.Algorithms.Distributed | Advanced Algorithms", - "keywords": "Namespace Advanced.Algorithms.Distributed Classes CircularQueue Cicular queue aka Ring Buffer using fixed size array. ConsistentHash A consistant hash implementation with murmur hash. LRUCache A least recently used cache implemetation." + "keywords": "Namespace Advanced.Algorithms.Distributed Classes AsyncQueue A simple asynchronous multi-thread supporting producer/consumer FIFO queue with minimal locking. CircularQueue Cicular queue aka Ring Buffer using fixed size array. ConsistentHash A consistant hash implementation with murmur hash. LRUCache A least recently used cache implemetation." }, "api/Advanced.Algorithms.Distributed.LRUCache-2.html": { "href": "api/Advanced.Algorithms.Distributed.LRUCache-2.html", diff --git a/docs/xrefmap.yml b/docs/xrefmap.yml index c817aab3..fc7ca8be 100644 --- a/docs/xrefmap.yml +++ b/docs/xrefmap.yml @@ -9281,6 +9281,49 @@ references: commentId: N:Advanced.Algorithms.Distributed fullName: Advanced.Algorithms.Distributed nameWithType: Advanced.Algorithms.Distributed +- uid: Advanced.Algorithms.Distributed.AsyncQueue`1 + name: AsyncQueue + href: api/Advanced.Algorithms.Distributed.AsyncQueue-1.html + commentId: T:Advanced.Algorithms.Distributed.AsyncQueue`1 + name.vb: AsyncQueue(Of T) + fullName: Advanced.Algorithms.Distributed.AsyncQueue + fullName.vb: Advanced.Algorithms.Distributed.AsyncQueue(Of T) + nameWithType: AsyncQueue + nameWithType.vb: AsyncQueue(Of T) +- uid: Advanced.Algorithms.Distributed.AsyncQueue`1.DequeueAsync(System.Threading.CancellationToken) + name: DequeueAsync(CancellationToken) + href: api/Advanced.Algorithms.Distributed.AsyncQueue-1.html#Advanced_Algorithms_Distributed_AsyncQueue_1_DequeueAsync_System_Threading_CancellationToken_ + commentId: M:Advanced.Algorithms.Distributed.AsyncQueue`1.DequeueAsync(System.Threading.CancellationToken) + fullName: Advanced.Algorithms.Distributed.AsyncQueue.DequeueAsync(System.Threading.CancellationToken) + fullName.vb: Advanced.Algorithms.Distributed.AsyncQueue(Of T).DequeueAsync(System.Threading.CancellationToken) + nameWithType: AsyncQueue.DequeueAsync(CancellationToken) + nameWithType.vb: AsyncQueue(Of T).DequeueAsync(CancellationToken) +- uid: Advanced.Algorithms.Distributed.AsyncQueue`1.DequeueAsync* + name: DequeueAsync + href: api/Advanced.Algorithms.Distributed.AsyncQueue-1.html#Advanced_Algorithms_Distributed_AsyncQueue_1_DequeueAsync_ + commentId: Overload:Advanced.Algorithms.Distributed.AsyncQueue`1.DequeueAsync + isSpec: "True" + fullName: Advanced.Algorithms.Distributed.AsyncQueue.DequeueAsync + fullName.vb: Advanced.Algorithms.Distributed.AsyncQueue(Of T).DequeueAsync + nameWithType: AsyncQueue.DequeueAsync + nameWithType.vb: AsyncQueue(Of T).DequeueAsync +- uid: Advanced.Algorithms.Distributed.AsyncQueue`1.EnqueueAsync(`0,System.Threading.CancellationToken) + name: EnqueueAsync(T, CancellationToken) + href: api/Advanced.Algorithms.Distributed.AsyncQueue-1.html#Advanced_Algorithms_Distributed_AsyncQueue_1_EnqueueAsync__0_System_Threading_CancellationToken_ + commentId: M:Advanced.Algorithms.Distributed.AsyncQueue`1.EnqueueAsync(`0,System.Threading.CancellationToken) + fullName: Advanced.Algorithms.Distributed.AsyncQueue.EnqueueAsync(T, System.Threading.CancellationToken) + fullName.vb: Advanced.Algorithms.Distributed.AsyncQueue(Of T).EnqueueAsync(T, System.Threading.CancellationToken) + nameWithType: AsyncQueue.EnqueueAsync(T, CancellationToken) + nameWithType.vb: AsyncQueue(Of T).EnqueueAsync(T, CancellationToken) +- uid: Advanced.Algorithms.Distributed.AsyncQueue`1.EnqueueAsync* + name: EnqueueAsync + href: api/Advanced.Algorithms.Distributed.AsyncQueue-1.html#Advanced_Algorithms_Distributed_AsyncQueue_1_EnqueueAsync_ + commentId: Overload:Advanced.Algorithms.Distributed.AsyncQueue`1.EnqueueAsync + isSpec: "True" + fullName: Advanced.Algorithms.Distributed.AsyncQueue.EnqueueAsync + fullName.vb: Advanced.Algorithms.Distributed.AsyncQueue(Of T).EnqueueAsync + nameWithType: AsyncQueue.EnqueueAsync + nameWithType.vb: AsyncQueue(Of T).EnqueueAsync - uid: Advanced.Algorithms.Distributed.CircularQueue`1 name: CircularQueue href: api/Advanced.Algorithms.Distributed.CircularQueue-1.html