Sphere10.Framework.Windows.LevelDB 3.0.3

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

💾 Sphere10.Framework.Windows.LevelDB

LevelDB integration for Windows providing high-performance embedded key-value storage for blockchain data, indices, and persistent caches.

📦 Installation

dotnet add package Sphere10.Framework.Windows.LevelDB

📋 Overview

Sphere10.Framework.Windows.LevelDB integrates Google's LevelDB into Sphere10 Framework applications, providing high-performance key-value storage suitable for blockchain ledgers, indices, and persistent caches on Windows platforms.

🚀 Key Features

  • LevelDB Integration: Embedded key-value database
  • Fast Access: Optimized for read-heavy workloads
  • Compression: Snappy compression support for reduced storage
  • Batch Operations: Atomic batch writes
  • Iteration: Efficient key range iteration with LINQ support
  • Snapshots: Consistent point-in-time snapshots for concurrent reads
  • Repair & Destroy: Database maintenance utilities

🔧 Usage

Basic CRUD Operations

Store and retrieve key-value data:

using Sphere10.Framework.Windows.LevelDB;

// Create/open database
using (var db = new DB("mydb", new Options { CreateIfMissing = true })) {
	// Write data
	db.Put("Tampa", "green");
	db.Put("London", "red");
	db.Put("New York", "blue");
    
	// Read data
	var value = db.Get("Tampa"); // Returns "green"
    
	// Delete data
	db.Delete("New York");
    
	// Check if exists
	if (db.Get("New York") == null) {
		// Key was deleted
	}
}

Iterating Over Data

Iterate over all key-value pairs (automatically sorted by key):

using (var db = new DB("mydb", new Options { CreateIfMissing = true })) {
	// Populate data
	db.Put("Tampa", "green");
	db.Put("London", "red");
	db.Put("New York", "blue");
    
	// Iterate from first key
	using (var iterator = db.CreateIterator(new ReadOptions())) {
		iterator.SeekToFirst();
		while (iterator.IsValid()) {
			var key = iterator.GetStringKey();
			var value = iterator.GetStringValue();
			Console.WriteLine($"{key}: {value}");
			iterator.Next();
		}
	}
    
	// Or use LINQ enumerable (convenient but iterates all keys)
	var allKeys = (from kv in db as IEnumerable<KeyValuePair<string, string>>
				   select kv.Key).ToList();
}

Point-in-Time Snapshots

Create snapshots for consistent reads while data is being modified:

using (var db = new DB("mydb", new Options { CreateIfMissing = true })) {
	db.Put("Tampa", "green");
	db.Put("London", "red");
    
	// Create snapshot before making changes
	using (var snapshot = db.CreateSnapshot()) {
		var readOptions = new ReadOptions { Snapshot = snapshot };
        
		// Update data in main database
		db.Put("New York", "blue");
		db.Delete("London");
        
		// Snapshot still sees the old state
		ClassicAssert.AreEqual(db.Get("New York", readOptions), null); // Not yet in snapshot
		ClassicAssert.AreEqual(db.Get("London", readOptions), "red");   // Still visible in snapshot
	}
    
	// Outside snapshot scope, we see the updated data
	ClassicAssert.AreEqual(db.Get("Tampa"), "yellow");      // Visible now
	ClassicAssert.IsNull(db.Get("London"));                  // Deleted
}

Database Maintenance

Repair or destroy databases:

// Repair a potentially corrupted database
DB.Repair("mydb", new Options());

// Completely destroy/delete a database
DB.Destroy("mydb", new Options { CreateIfMissing = true });

📦 Dependencies

  • Sphere10 Framework: Core framework library
  • LevelDB: Native LevelDB database engine (BSD License)
  • Snappy: Compression library

📜 License Attribution

This package includes or uses the following third-party components:

LevelDB

  • License: BSD 3-Clause License
  • Source: https://github.com/google/leveldb
  • Notice: LevelDB is distributed under the BSD 3-Clause License. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met.

For complete license details, see: https://github.com/google/leveldb/blob/master/LICENSE

💡 Use Cases

  • Blockchain State: Store blockchain blocks, transactions, and account state
  • Indices: Create fast lookup indices for transaction history
  • Caching: Persistent cache layer for frequently accessed data
  • Logging: High-throughput event and transaction logging

⚠️ Important Notes

  • Keys are stored in sorted order (lexicographic by default)
  • Snapshots don't require locking - they're copy-on-write
  • Always use using statements to ensure proper database cleanup
  • Single writer - only one writer at a time, but multiple concurrent readers are supported
  • LevelDB License Compliance: This package embeds LevelDB native binaries. Redistribution complies with LevelDB's BSD 3-Clause License - see License Attribution section above
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
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
3.0.3 86 1/6/2026
3.0.2 88 1/2/2026
3.0.1 84 1/2/2026
3.0.0 88 1/2/2026