Shiminey.Channels 0.0.1

dotnet add package Shiminey.Channels --version 0.0.1
NuGet\Install-Package Shiminey.Channels -Version 0.0.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Shiminey.Channels" Version="0.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Shiminey.Channels --version 0.0.1
#r "nuget: Shiminey.Channels, 0.0.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Shiminey.Channels as a Cake Addin
#addin nuget:?package=Shiminey.Channels&version=0.0.1

// Install Shiminey.Channels as a Cake Tool
#tool nuget:?package=Shiminey.Channels&version=0.0.1

Build status badge Test coverage badge Shiminey.Channels verion on NuGet.org Twitter icon

🧬 Shiminey.Channels

Shiminey.Channels is a lightweight set of classes designed to extend and complement the existing System.Threading.Channels library, with a focus on allowing greater control of ordering elements within a channel.

📝 Use Case

Imagine an application that allows users to download files concurrently; the application also allows users to define a degree of parallelism, i.e. 4 downloads can happen at the same time.

The application utilizes a single channel that contains pending downloads, however, what were to happen if the user wished to change the priority of these downloads, i.e. skip or "download now"? Using the default implementation of channels we aren't able to do anything, however with Shiminey, we can solve this problem.

🔀 How It Works

In addition to the standard TryWrite(T item) offered from channel writers, Shiminey exposes a new TryWriteOrderable(T item, out IChannelItemController controller) method. With this controller it becomes possible to re-position the data within the channel:

  • ⏭️ TryMoveFirst() - Attempts to move the item to the front.
  • TryMoveForward() - Attempts to increase the priority of the item by bring it forward one place.
  • ⏮️ TryMoveLast() - Attempts to move the item the end.
  • TryMoveBackward() - Attempts to decrease the priority of the item by moving it backwards one place.

🎉 Basic Usage

using Shiminey.Channels;

// Create a channel, and write two items to it.
var channel = Channel.CreateUnboundedOrderableChannel<string>();
channel.Writer.TryWrite("One");
channel.Writer.TryWriteOrderable("Two", out var twoController);

// The controller allows us to relocate the item within the channel.
twoController.TryMoveFirst();

string item;
item = await channel.Reader.ReadAsync(); // Two
item = await channel.Reader.ReadAsync(); // One
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.0.1 417 11/6/2021