RaidStream 1.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package RaidStream --version 1.1.0
                    
NuGet\Install-Package RaidStream -Version 1.1.0
                    
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="RaidStream" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="RaidStream" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="RaidStream" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add RaidStream --version 1.1.0
                    
#r "nuget: RaidStream, 1.1.0"
                    
#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.
#:package RaidStream@1.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=RaidStream&version=1.1.0
                    
Install as a Cake Addin
#tool nuget:?package=RaidStream&version=1.1.0
                    
Install as a Cake Tool

RaidStream

A .NET implementation of a RAID 5 stream. This library allows you to combine multiple streams (representing physical disks) into a single fault-tolerant stream with RAID 5 parity. It supports reading, writing, seeking, disk failure simulation, and recovery.

Features

  • RAID 5 parity with N disks (minimum 3)
  • Read, write, and seek support
  • Simulate disk failure and recovery
  • Automatic data/parity reconstruction on read
  • .NET 9.0 compatible

Getting Started

Installation

Add the project to your solution or reference the NuGet package (if published).

Usage Example

using RaidStream;
using System.IO;

// Create 3 or more streams (e.g., MemoryStream, FileStream)
var disk1 = new MemoryStream(new byte[1024 * 1024]);
var disk2 = new MemoryStream(new byte[1024 * 1024]);
var disk3 = new MemoryStream(new byte[1024 * 1024]);
var disks = new List<Stream> { disk1, disk2, disk3 };

int stripeUnitSize = 4096; // 4KB per disk per stripe
using var raid5 = new Raid5Stream(disks, stripeUnitSize);

// Write data
byte[] data = new byte[10000];
new Random().NextBytes(data);
raid5.Write(data, 0, data.Length);
raid5.Seek(0, SeekOrigin.Begin);

// Read data
byte[] readBuffer = new byte[10000];
raid5.Read(readBuffer, 0, readBuffer.Length);

// Simulate disk failure
raid5.FailDisk(1);
raid5.Seek(0, SeekOrigin.Begin);
raid5.Read(readBuffer, 0, readBuffer.Length); // Data is reconstructed

// Recover disk
raid5.RecoverDisk(1);

API

  • Raid5Stream(IList<Stream> diskStreams, int stripeUnitSize)
  • void FailDisk(int diskIndex)
  • void RecoverDisk(int diskIndex)
  • Standard Stream methods: Read, Write, Seek, SetLength, etc.

License

MIT

Author

thnak

Repository

https://github.com/thnak/RaidStream

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0

    • No dependencies.

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
1.1.1 105 5/30/2025
1.1.0 118 5/30/2025
1.0.0 124 5/30/2025