Polar.DB 2.1.1

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

Polar.DB

Polar.DB is a .NET library for schema-defined structured data and append-oriented persistent sequences. It is designed for practical storage and retrieval flows where records are represented as Polar values and written to binary streams.

The current main-branch library provides low-level and high-level access patterns. You can work directly in an object-like style (object[] values aligned with PTypeRecord fields), or use RecordAccessor for named field access over the same record layout.

The repository also includes index/search samples around the current public APIs (USequence, SVectorIndex, UVectorIndex, UVecIndex, UIndex) and tests that protect documented behavior.

Supported Frameworks

  • netstandard2.0
  • netstandard2.1
  • netstandard3.1
  • net5.0
  • net6.0
  • net7.0
  • net8.0
  • net9.0
  • net10.0

Quick Start

Both examples below use the same schema and produce the same logical result (id=1, name=Alice, age=30).

Object-like quick start

using Polar.DB;

var personType = new PTypeRecord(
    new NamedType("id", new PType(PTypeEnumeration.integer)),
    new NamedType("name", new PType(PTypeEnumeration.sstring)),
    new NamedType("age", new PType(PTypeEnumeration.integer)));

using var stream = new MemoryStream();
var sequence = new UniversalSequenceBase(personType, stream);
sequence.Clear();
sequence.AppendElement(new object[] { 1, "Alice", 30 });
sequence.Flush();

var person = (object[])sequence.GetElement(8L);
Console.WriteLine($"{person[0]} {person[1]} {person[2]}");

RecordAccessor-like quick start

using Polar.DB;

var personType = new PTypeRecord(
    new NamedType("id", new PType(PTypeEnumeration.integer)),
    new NamedType("name", new PType(PTypeEnumeration.sstring)),
    new NamedType("age", new PType(PTypeEnumeration.integer)));

var accessor = new RecordAccessor(personType);
using var stream = new MemoryStream();
var sequence = new UniversalSequenceBase(personType, stream);
sequence.Clear();
sequence.AppendElement(accessor.CreateRecord(1, "Alice", 30));
sequence.Flush();

var person = (object[])sequence.GetElement(8L);
Console.WriteLine($"{accessor.Get<int>(person, "id")} {accessor.Get<string>(person, "name")} {accessor.Get<int>(person, "age")}");

Canonical Scenarios

  • Defining schemas with PType, PTypeRecord, PTypeSequence, and NamedType.
  • Writing records/data through append-oriented flows (AppendElement, Flush, Load, Build where applicable).
  • Reading records/data through sequence scans (ElementValues, GetElement, GetByKey, index lookups).
  • Named access through RecordAccessor for field-by-name get/set and shape validation.
  • Using object-like (object[]) record values as the lower-level baseline representation.
  • Building and using indexes with currently supported APIs (SVectorIndex, UVectorIndex, UVecIndex, UIndex) in USequence scenarios.

Storage Model Constraints

  • The logical end of valid data is the primary boundary, not incidental Stream.Position cursor movement.
  • AppendOffset is treated as the logical end-of-valid-data marker for append operations.
  • Physical stream length is not automatically the authoritative logical end in all cases (especially during recovery/normalization paths).
  • Recovery/refresh normalize state from readable data and logical boundaries before continuing writes.
  • Data must be stabilized (written and normalized) before indexes/state are treated as finalized.

Overwrite Safety

  • Do not assume arbitrary variable-size in-place overwrite is safe by default.
  • Prefer documented append-oriented and canonical scenarios.
  • Only rely on overwrite behaviors that are explicitly demonstrated by current tests/samples.
  • A narrow supported overwrite case exists for fixed-size records written at known valid offsets.

Build and Test

dotnet build Polar.DB.sln
dotnet test tests/Polar.DB.Tests/Polar.DB.Tests.csproj

Naming

  • Canonical public name: Polar.DB.
  • Legacy PolarDB naming may appear only in preserved historical/external references.
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.  net9.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen 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.
  • .NETStandard 2.1

    • No dependencies.

NuGet packages (6)

Showing the top 5 NuGet packages that depend on Polar.DB:

Package Downloads
Polar.CellIndexes

Package Description

PolarDB

Package Description

Polar.Cells

Package Description

Polar.TripleStore

Package Description

Polar.PagedStreams

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.1.1 270 4/13/2026
2.1.0 227 4/7/2026
1.2.0 485 11/19/2023
1.1.0 339 6/2/2023
1.0.8 302 5/26/2023
1.0.6 1,093 6/14/2019
1.0.5 981 6/3/2019
1.0.4 1,159 6/1/2019
1.0.3 1,293 1/29/2019
1.0.2 1,396 11/5/2018
1.0.1 2,529 1/16/2018
1.0.0 2,485 1/14/2018