Skip to content

Beta #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 8, 2018
Merged

Beta #20

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Advanced.Algorithms/Distributed/AsyncQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Advanced.Algorithms.Distributed
/// <summary>
/// A simple asynchronous multi-thread supporting producer/consumer FIFO queue with minimal locking.
/// </summary>
internal class AsyncQueue<T>
public class AsyncQueue<T>
{
//data queue.
private readonly Queue<T> queue = new Queue<T>();
Expand All @@ -20,7 +20,7 @@ internal class AsyncQueue<T>
/// Supports multi-threaded producers.
/// Time complexity: O(1).
/// </summary>
internal async Task EnqueueAsync(T value, CancellationToken taskCancellationToken = default(CancellationToken))
public async Task EnqueueAsync(T value, CancellationToken taskCancellationToken = default(CancellationToken))
{
await consumerQueueLock.WaitAsync(taskCancellationToken);

Expand All @@ -41,7 +41,7 @@ internal class AsyncQueue<T>
/// Supports multi-threaded consumers.
/// Time complexity: O(1).
/// </summary>
internal async Task<T> DequeueAsync(CancellationToken taskCancellationToken = default(CancellationToken))
public async Task<T> DequeueAsync(CancellationToken taskCancellationToken = default(CancellationToken))
{
await consumerQueueLock.WaitAsync(taskCancellationToken);

Expand Down
269 changes: 269 additions & 0 deletions docs/api/Advanced.Algorithms.Distributed.AsyncQueue-1.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
<!DOCTYPE html>
<!--[if IE]><![endif]-->
<html>

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Class AsyncQueue&lt;T&gt;
| Advanced Algorithms </title>
<meta name="viewport" content="width=device-width">
<meta name="title" content="Class AsyncQueue&lt;T&gt;
| Advanced Algorithms ">
<meta name="generator" content="docfx 2.37.2.0">

<link rel="shortcut icon" href="../favicon.ico">
<link rel="stylesheet" href="../styles/docfx.vendor.css">
<link rel="stylesheet" href="../styles/docfx.css">
<link rel="stylesheet" href="../styles/main.css">
<meta property="docfx:navrel" content="">
<meta property="docfx:tocrel" content="toc.html">

<meta property="docfx:rel" content="../">

</head>
<body data-spy="scroll" data-target="#affix" data-offset="120">
<div id="wrapper">
<header>

<nav id="autocollapse" class="navbar navbar-inverse ng-scope" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>

<a class="navbar-brand" href="../index.html">
<img id="logo" class="svg" src="../logo.svg" alt="">
</a>
</div>
<div class="collapse navbar-collapse" id="navbar">
<form class="navbar-form navbar-right" role="search" id="search">
<div class="form-group">
<input type="text" class="form-control" id="search-query" placeholder="Search" autocomplete="off">
</div>
</form>
</div>
</div>
</nav>

<div class="subnav navbar navbar-default">
<div class="container hide-when-search" id="breadcrumb">
<ul class="breadcrumb">
<li></li>
</ul>
</div>
</div>
</header>
<div class="container body-content">

<div id="search-results">
<div class="search-list"></div>
<div class="sr-items">
<p><i class="glyphicon glyphicon-refresh index-loading"></i></p>
</div>
<ul id="pagination"></ul>
</div>
</div>
<div role="main" class="container body-content hide-when-search">

<div class="sidenav hide-when-search">
<a class="btn toc-toggle collapse" data-toggle="collapse" href="#sidetoggle" aria-expanded="false" aria-controls="sidetoggle">Show / Hide Table of Contents</a>
<div class="sidetoggle collapse" id="sidetoggle">
<div id="sidetoc"></div>
</div>
</div>
<div class="article row grid-right">
<div class="col-md-10">
<article class="content wrap" id="_content" data-uid="Advanced.Algorithms.Distributed.AsyncQueue`1">


<h1 id="Advanced_Algorithms_Distributed_AsyncQueue_1" data-uid="Advanced.Algorithms.Distributed.AsyncQueue`1" class="text-break">Class AsyncQueue&lt;T&gt;
</h1>
<div class="markdown level0 summary"><p>A simple asynchronous multi-thread supporting producer/consumer FIFO queue with minimal locking.</p>
</div>
<div class="markdown level0 conceptual"></div>
<div class="inheritance">
<h5>Inheritance</h5>
<div class="level0"><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object">Object</a></div>
<div class="level1"><span class="xref">AsyncQueue&lt;T&gt;</span></div>
</div>
<div class="inheritedMembers">
<h5>Inherited Members</h5>
<div>
<a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object.tostring#System_Object_ToString">Object.ToString()</a>
</div>
<div>
<a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object.equals#System_Object_Equals_System_Object_">Object.Equals(Object)</a>
</div>
<div>
<a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object.equals#System_Object_Equals_System_Object_System_Object_">Object.Equals(Object, Object)</a>
</div>
<div>
<a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object.referenceequals#System_Object_ReferenceEquals_System_Object_System_Object_">Object.ReferenceEquals(Object, Object)</a>
</div>
<div>
<a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object.gethashcode#System_Object_GetHashCode">Object.GetHashCode()</a>
</div>
<div>
<a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object.gettype#System_Object_GetType">Object.GetType()</a>
</div>
<div>
<a class="xref" href="https://docs.microsoft.com/dotnet/api/system.object.memberwiseclone#System_Object_MemberwiseClone">Object.MemberwiseClone()</a>
</div>
</div>
<h6><strong>Namespace</strong>: <a class="xref" href="Advanced.Algorithms.Distributed.html">Advanced.Algorithms.Distributed</a></h6>
<h6><strong>Assembly</strong>: Advanced.Algorithms.dll</h6>
<h5 id="Advanced_Algorithms_Distributed_AsyncQueue_1_syntax">Syntax</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public class AsyncQueue&lt;T&gt;</code></pre>
</div>
<h5 class="typeParameters">Type Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="parametername">T</span></td>
<td></td>
</tr>
</tbody>
</table>
<h3 id="methods">Methods
</h3>


<a id="Advanced_Algorithms_Distributed_AsyncQueue_1_DequeueAsync_" data-uid="Advanced.Algorithms.Distributed.AsyncQueue`1.DequeueAsync*"></a>
<h4 id="Advanced_Algorithms_Distributed_AsyncQueue_1_DequeueAsync_System_Threading_CancellationToken_" data-uid="Advanced.Algorithms.Distributed.AsyncQueue`1.DequeueAsync(System.Threading.CancellationToken)">DequeueAsync(CancellationToken)</h4>
<div class="markdown level1 summary"><p>Supports multi-threaded consumers.
Time complexity: O(1).</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public Task&lt;T&gt; DequeueAsync(CancellationToken taskCancellationToken = default(CancellationToken))</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></td>
<td><span class="parametername">taskCancellationToken</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.threading.tasks.task-1">Task</a>&lt;T&gt;</td>
<td></td>
</tr>
</tbody>
</table>


<a id="Advanced_Algorithms_Distributed_AsyncQueue_1_EnqueueAsync_" data-uid="Advanced.Algorithms.Distributed.AsyncQueue`1.EnqueueAsync*"></a>
<h4 id="Advanced_Algorithms_Distributed_AsyncQueue_1_EnqueueAsync__0_System_Threading_CancellationToken_" data-uid="Advanced.Algorithms.Distributed.AsyncQueue`1.EnqueueAsync(`0,System.Threading.CancellationToken)">EnqueueAsync(T, CancellationToken)</h4>
<div class="markdown level1 summary"><p>Supports multi-threaded producers.
Time complexity: O(1).</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="decalaration">Declaration</h5>
<div class="codewrapper">
<pre><code class="lang-csharp hljs">public Task EnqueueAsync(T value, CancellationToken taskCancellationToken = default(CancellationToken))</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><span class="xref">T</span></td>
<td><span class="parametername">value</span></td>
<td></td>
</tr>
<tr>
<td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.threading.cancellationtoken">CancellationToken</a></td>
<td><span class="parametername">taskCancellationToken</span></td>
<td></td>
</tr>
</tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-striped table-condensed">
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td><a class="xref" href="https://docs.microsoft.com/dotnet/api/system.threading.tasks.task">Task</a></td>
<td></td>
</tr>
</tbody>
</table>
</article>
</div>

<div class="hidden-sm col-md-2" role="complementary">
<div class="sideaffix">
<div class="contribution">
<ul class="nav">
</ul>
</div>
<nav class="bs-docs-sidebar hidden-print hidden-xs hidden-sm affix" id="affix">
<!-- <p><a class="back-to-top" href="#top">Back to top</a><p> -->
</nav>
</div>
</div>
</div>
</div>

<footer>
<div class="grad-bottom"></div>
<div class="footer">
<div class="container">
<span class="pull-right">
<a href="#top">Back to top</a>
</span>

<span>Generated by <strong>DocFX</strong></span>
</div>
</div>
</footer>
</div>

<script type="text/javascript" src="../styles/docfx.vendor.js"></script>
<script type="text/javascript" src="../styles/docfx.js"></script>
<script type="text/javascript" src="../styles/main.js"></script>
</body>
</html>
3 changes: 3 additions & 0 deletions docs/api/Advanced.Algorithms.Distributed.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ <h1 id="Advanced_Algorithms_Distributed" data-uid="Advanced.Algorithms.Distribut
<div class="markdown level0 remarks"></div>
<h3 id="classes">Classes
</h3>
<h4><a class="xref" href="Advanced.Algorithms.Distributed.AsyncQueue-1.html">AsyncQueue&lt;T&gt;</a></h4>
<section><p>A simple asynchronous multi-thread supporting producer/consumer FIFO queue with minimal locking.</p>
</section>
<h4><a class="xref" href="Advanced.Algorithms.Distributed.CircularQueue-1.html">CircularQueue&lt;T&gt;</a></h4>
<section><p>Cicular queue aka Ring Buffer using fixed size array.</p>
</section>
Expand Down
3 changes: 3 additions & 0 deletions docs/api/toc.html
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,9 @@
<a href="Advanced.Algorithms.Distributed.html" name="" title="Advanced.Algorithms.Distributed">Advanced.Algorithms.Distributed</a>

<ul class="nav level2">
<li>
<a href="Advanced.Algorithms.Distributed.AsyncQueue-1.html" name="" title="AsyncQueue&lt;T&gt;">AsyncQueue&lt;T&gt;</a>
</li>
<li>
<a href="Advanced.Algorithms.Distributed.CircularQueue-1.html" name="" title="CircularQueue&lt;T&gt;">CircularQueue&lt;T&gt;</a>
</li>
Expand Down
7 changes: 6 additions & 1 deletion docs/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,11 @@
"title": "Class Trie<T> | Advanced Algorithms",
"keywords": "Class Trie<T> A trie (prefix tree) implementation. Inheritance Object Trie<T> Implements IEnumerable <T[]> 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<T> : IEnumerable<T[]>, 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<T[]> GetEnumerator() Returns Type Description IEnumerator <T[]> 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<T[]> StartsWith(T[] prefix) Parameters Type Name Description T[] prefix Returns Type Description List <T[]> Explicit Interface Implementations IEnumerable.GetEnumerator() Declaration IEnumerator IEnumerable.GetEnumerator() Returns Type Description IEnumerator Implements System.Collections.Generic.IEnumerable<T> System.Collections.IEnumerable"
},
"api/Advanced.Algorithms.Distributed.AsyncQueue-1.html": {
"href": "api/Advanced.Algorithms.Distributed.AsyncQueue-1.html",
"title": "Class AsyncQueue<T> | Advanced Algorithms",
"keywords": "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 Name Description T Methods DequeueAsync(CancellationToken) Supports multi-threaded consumers. Time complexity: O(1). Declaration public Task<T> DequeueAsync(CancellationToken taskCancellationToken = default(CancellationToken)) Parameters Type Name Description CancellationToken taskCancellationToken Returns Type Description Task <T> 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<T> | Advanced Algorithms",
Expand All @@ -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<T> Cicular queue aka Ring Buffer using fixed size array. ConsistentHash<T> A consistant hash implementation with murmur hash. LRUCache<K, V> A least recently used cache implemetation."
"keywords": "Namespace Advanced.Algorithms.Distributed 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. ConsistentHash<T> A consistant hash implementation with murmur hash. LRUCache<K, V> A least recently used cache implemetation."
},
"api/Advanced.Algorithms.Distributed.LRUCache-2.html": {
"href": "api/Advanced.Algorithms.Distributed.LRUCache-2.html",
Expand Down
Loading