CSharpDB.Storage
1.7.0
Prefix Reserved
dotnet add package CSharpDB.Storage --version 1.7.0
NuGet\Install-Package CSharpDB.Storage -Version 1.7.0
<PackageReference Include="CSharpDB.Storage" Version="1.7.0" />
<PackageVersion Include="CSharpDB.Storage" Version="1.7.0" />
<PackageReference Include="CSharpDB.Storage" />
paket add CSharpDB.Storage --version 1.7.0
#r "nuget: CSharpDB.Storage, 1.7.0"
#:package CSharpDB.Storage@1.7.0
#addin nuget:?package=CSharpDB.Storage&version=1.7.0
#tool nuget:?package=CSharpDB.Storage&version=1.7.0
CSharpDB.Storage
CSharpDB.Storage is the page-oriented durability layer used by the CSharpDB embedded database engine. It owns:
- physical file I/O through
IStorageDevice - page caching and dirty tracking through
Pager - write-ahead logging and crash recovery through
WriteAheadLog - row-id keyed B+trees for table and index storage
- schema metadata persistence through
SchemaCatalog
This package is usually consumed indirectly through CSharpDB.Engine, but it also supports direct low-level use for tooling, diagnostics, and storage experiments.
Most users: configure storage through Database
If you are using SQL or the engine layer, customize storage like this:
using CSharpDB.Engine;
using CSharpDB.Storage.Checkpointing;
using CSharpDB.Storage.Paging;
var options = new DatabaseOptions()
.ConfigureStorageEngine(builder =>
{
builder.UsePagerOptions(new PagerOptions
{
MaxCachedPages = 2048,
CheckpointPolicy = new FrameCountCheckpointPolicy(500),
});
builder.UseCachingBTreeIndexes(findCacheCapacity: 4096);
});
await using var db = await Database.OpenAsync("app.cdb", options);
Low-level use: open the storage graph directly
If you need direct access to Pager, SchemaCatalog, or BTree, use the default storage engine factory:
using CSharpDB.Storage.BTrees;
using CSharpDB.Storage.Paging;
using CSharpDB.Storage.StorageEngine;
var storageOptions = new StorageEngineOptionsBuilder()
.UsePagerOptions(new PagerOptions { MaxCachedPages = 1024 })
.UseBTreeIndexes()
.Build();
var factory = new DefaultStorageEngineFactory();
var context = await factory.OpenAsync("lowlevel.cdb", storageOptions);
await using var pager = context.Pager;
await pager.BeginTransactionAsync();
try
{
uint rootPageId = await BTree.CreateNewAsync(pager);
var tree = new BTree(pager, rootPageId);
await tree.InsertAsync(1, new byte[] { 1, 2, 3, 4 });
byte[]? payload = await tree.FindAsync(1);
await pager.CommitAsync();
}
catch
{
await pager.RollbackAsync();
throw;
}
Key extension points
IStorageDevicefor alternate storage backendsIPageCachethroughPagerOptions.PageCacheFactoryICheckpointPolicyfor auto-checkpoint decisionsIPageOperationInterceptorfor diagnostics and fault injectionIPageChecksumProviderfor WAL checksum behaviorIIndexProviderfor index-store compositionISerializerProviderfor record and schema serializationICatalogStorefor catalog payload encodingIStorageEngineFactoryfor replacing the default storage composition root
Related docs
Related packages
| Package | Description |
|---|---|
| CSharpDB.Engine | SQL/engine layer built on this storage package |
| CSharpDB.Storage.Diagnostics | Read-only inspection and integrity tooling |
| CSharpDB.Execution | Query execution layer that reads/writes through storage |
Installation
dotnet add package CSharpDB.Storage
For the all-in-one package:
dotnet add package CSharpDB
| Product | Versions 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. |
-
net10.0
- CSharpDB.Primitives (>= 1.7.0)
NuGet packages (4)
Showing the top 4 NuGet packages that depend on CSharpDB.Storage:
| Package | Downloads |
|---|---|
|
CSharpDB.Engine
Lightweight embedded SQL database engine for .NET. Single-file storage, WAL durability, concurrent readers, and a typed Collection<T> NoSQL API. |
|
|
CSharpDB.Execution
Query planner, operator tree, and expression evaluator for the CSharpDB embedded database. |
|
|
CSharpDB.Storage.Diagnostics
Read-only storage diagnostics toolkit for CSharpDB database and WAL files. |
|
|
CSharpDB
All-in-one package for CSharpDB application development. Includes the unified client, engine, ADO.NET provider, service layer, and diagnostics. |
GitHub repositories
This package is not used by any popular GitHub repositories.