Ama.CRDT.LargerThanMemory.Streams 5.1.261128

dotnet add package Ama.CRDT.LargerThanMemory.Streams --version 5.1.261128
                    
NuGet\Install-Package Ama.CRDT.LargerThanMemory.Streams -Version 5.1.261128
                    
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="Ama.CRDT.LargerThanMemory.Streams" Version="5.1.261128" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ama.CRDT.LargerThanMemory.Streams" Version="5.1.261128" />
                    
Directory.Packages.props
<PackageReference Include="Ama.CRDT.LargerThanMemory.Streams" />
                    
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 Ama.CRDT.LargerThanMemory.Streams --version 5.1.261128
                    
#r "nuget: Ama.CRDT.LargerThanMemory.Streams, 5.1.261128"
                    
#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 Ama.CRDT.LargerThanMemory.Streams@5.1.261128
                    
#: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=Ama.CRDT.LargerThanMemory.Streams&version=5.1.261128
                    
Install as a Cake Addin
#tool nuget:?package=Ama.CRDT.LargerThanMemory.Streams&version=5.1.261128
                    
Install as a Cake Tool

Ama.CRDT.LargerThanMemory.Streams

A .NET library for implementing Conflict-free Replicated Data Types (CRDTs) for larger-than-memory streams using B+ Trees. This package is an extension to the Ama.CRDT core library, decoupling the stream-based larger-than-memory logic into its own reusable module.

Features

  • B+ Tree Indexing: Efficiently indexes CRDT chunks to scale documents beyond system memory.
  • Stream-Based Storage: Supports persisting chunks using any stream provider (e.g., File streams, Azure Blob Storage, AWS S3).
  • Space Allocation: Includes an internal mechanism to reuse freed blocks and manage in-place stream updates.
  • Polymorphic Serialization: Leverages robust serialization mechanisms for dynamic CRDT payloads out of the box.

Installation

Install via NuGet:

dotnet add package Ama.CRDT.LargerThanMemory.Streams

Getting Started

To use stream-based larger-than-memory storage, you need to implement the IChunkStreamProvider interface to define where your data and index streams are stored.

1. Implement a Stream Provider

using Ama.CRDT.Services.LargerThanMemory.Streams;
using System;
using System.IO;
using System.Threading.Tasks;

public class FileSystemStreamProvider : IChunkStreamProvider
{
    public Task<Stream> GetPropertyIndexStreamAsync(string propertyName)
    {
        // Implement logic to return your stream (e.g., new FileStream(...))
        throw new NotImplementedException();
    }

    public Task<Stream> GetPropertyDataStreamAsync(IComparable logicalKey, string propertyName)
    {
        // Implement logic to return your stream
        throw new NotImplementedException();
    }

    public Task<Stream> GetHeaderIndexStreamAsync()
    {
        // Implement logic to return your stream
        throw new NotImplementedException();
    }

    public Task<Stream> GetHeaderDataStreamAsync(IComparable logicalKey)
    {
        // Implement logic to return your stream
        throw new NotImplementedException();
    }
}

2. Configure Dependency Injection

Register the stream larger-than-memory services in your DI container using the provided extension method. This should be chained after the core .AddCrdt() registration.

using Ama.CRDT.Extensions;
using Ama.CRDT.Models;
using Ama.CRDT.Services.Decorators;

var builder = WebApplication.CreateBuilder(args);

// Add core CRDT services and register the larger-than-memory decorator
builder.Services.AddCrdt()
    .AddCrdtApplicatorDecorator<LargerThanMemoryApplicatorDecorator>(DecoratorBehavior.Complex)
    // Add the stream larger-than-memory services with your custom provider
    .AddCrdtStreamLargerThanMemory<FileSystemStreamProvider>();

var app = builder.Build();

3. Usage

Once registered, the IChunkDocumentManager<T> (from the core Ama.CRDT library) will automatically resolve the IChunkStorageService provided by this package, allowing you to transparently manage large virtual documents.

4. Performance Counters

To see the performance counters when debugging you can use one of the following in a command prompt:

dotnet-counters monitor --name Ama.CRDT.ShowCase.LargerThanMemory --counters "Ama.CRDT.LargerThanMemory.Streams" --maxHistograms 30

Or use powershell if you prefer:

$p = Get-Process -Name "Ama.CRDT.ShowCase.LargerThanMemory" -ErrorAction SilentlyContinue; if ($p) { dotnet-counters monitor --process-id $p[0].Id --counters "Ama.CRDT.LargerThanMemory.Streams" --maxHistograms 30 } else { Write-Warning "Process not found" }

License

The code is licensed under MIT.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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.  net11.0 is compatible. 
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
5.1.261128 83 11/28/2026
5.0.261121 115 11/21/2026
5.0.0 108 11/11/2026