EventfulRanges 0.1.0

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

EventfulRanges

CI NuGet License: MPL-2.0

A CRDT for real-valued ranges, in C# on .NET 10. Any number of replicas add and remove ranges on their own; every replica that has seen the same operations ends up with the same set — no coordinator, no consensus, any arrival order.

A port of eventfulranges: the same model, the same quality bar, an API that reads like C# rather than like Go.

Status: 0.1.0 is the n-dimensional parity release. The whole library is here: intervals, operations, clocks, the four range strategies, the log engines with their memory, JSON Lines and KurrentDB stores, the RangeSet replica, and then the n-dimensional half — boxes, the box algebra, retraction, the five box strategies, layered views, line queries, an R-tree and BoxSet. 0.1.0 is the first version worth pinning; 0.0.3 carried the range half alone.

Install

dotnet add package EventfulRanges

What the library gives you

Piece Types
Interval algebra Interval, Intervals, Intervals.Sweep, Cover
Operations Op, OpKind, OpError, InvalidOpException
Clocks IClock, HybridClock, LamportClock
Conflict resolution StrategyKind, Strategies, Segment, Winner
Log engine Engine, EngineOptions
Stores IEventLog, MemoryLog, JsonlLog
Replica facade RangeSet
Boxes Box, Boxes, Meta, Canonicalizers
Box operations BoxOp, BoxOpKind, BoxOpError, InvalidBoxOpException
Box strategies BoxStrategies, BoxSegment, BoxWinner, Layer
Box engine and stores BoxEngine, BoxEngineOptions, IBoxLog, BoxMemoryLog, BoxJsonlLog
Region queries Line, LineSpan, LineSegment, RTree
Box replica facade BoxSet

Two replicas holding the same operations converge whatever order they arrive in:

var addition = Op.Add(1, 10) with { Id = "a", Timestamp = 1 };
var removal = Op.Remove(3, 5) with { Id = "b", Timestamp = 2 };
var ops = new[] { addition, removal };

Strategies.Materialize(StrategyKind.Lww, ops);   // [1,3) and (5,10]
Strategies.Materialize(StrategyKind.Fww, ops);   // [1,10]

Start here

You want to Read
get a program running in five minutes Quickstart
solve a concrete task Model a calendar of busy days
look up a signature, default or exception API reference
understand why it works this way Range algebra
work on the library Local development · AGENTS.md
cut a release Cut a release
know what the gate measures Why the gate looks like this

All of these live in the repository; llms.txt there is the same map in the form an agent routes from.

At a glance

var busy = new Interval(1, 10).Subtract(new Interval(3, 5));                  // [1,3) and (5,10]
var shared = Interval.Intersection(new Interval(1, 10), new Interval(8, 20)); // [8,10]

Endpoints are double, compared and never combined, so no rounding error accumulates. Inclusivity is per side: [a,b], [a,b), (a,b], (a,b). A malformed interval is a value, not an exception: Validate() names the problem, EnsureValid() throws where a well-formed one is required.

Sweeping is what conflict resolution stands on: Intervals.Sweep partitions the union of a set into maximal pieces, each labelled with the index of the winner under a caller-supplied priority.

A replica is the whole loop — append to a log, stamp with a clock, keep the view the strategy materializes:

using var calendar = await RangeSet.OpenAsync("./calendar", StrategyKind.Lww);
await calendar.AddAsync(1, 10);
await calendar.RemoveAsync(3, 5);
calendar.Ranges;                                                  // [1,3) and (5,10]

MemoryLog keeps the log in memory, JsonlLog writes it to ranges.stream.jsonl, EventfulRanges.Kurrent keeps it in KurrentDB, and any IEventLog implementation swaps in instead. Two replicas that applied the same operations answer the same set, whatever order they arrived in.

Roadmap

Version Contents
0.0.1 Interval, Intervals, Sweep — the interval algebra
0.0.2 Op, clocks, Strategies — operations and conflict resolution
0.0.3 Engine, MemoryLog, JsonlLog, RangeSet — a working replica
0.0.x n-dimensional boxes, canonicalization, region queries, R-tree, BoxSet, retractions
0.1.0 n-dimensional parity — the whole library surface, the KurrentDB store, and the first version worth pinning

Quality

One command, ./scripts/quality-gate.sh: formatting, a warnings-as-errors build, every test with coverage, and a CRAP budget of 10 per method. Two further scripts are deliberately outside it: ./scripts/mutation.sh (Stryker.NET, because a surviving mutant is a question, not a failure) and ./scripts/bench.sh (BenchmarkDotNet, which is where the adjacent merge's threshold comes from). ./scripts/itest-kurrent.sh needs a server — ./scripts/kurrent-up.sh starts one and the KurrentDB tests skip without it. The laws are checked against an independent brute-force oracle, not against the implementation. Why the gate looks like this explains the numbers and what is deliberately not measured yet.

Install and release mechanics:

  • dotnet add package EventfulRanges from nuget.org, and dotnet add package EventfulRanges.Kurrent for the KurrentDB store. Every tagged version is also mirrored to GitHub Packages (https://nuget.pkg.github.com/d-led/index.json), which requires credentials even for a public package.
  • Publishing happens only from a version tag, through NuGet Trusted Publishing — no API key is stored or rotated.

License

Mozilla Public License 2.0. A derived work of eventfulranges; see NOTICE.

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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on EventfulRanges:

Package Downloads
EventfulRanges.Kurrent

A KurrentDB event log for EventfulRanges: the operations of a replica as a stream, and its snapshots as another.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 57 11/23/2026
0.0.3 60 11/23/2026
0.0.2 52 11/23/2026
0.0.1 61 11/23/2026