Skip to content

Releases: CoreyKaylor/Lightning.NET

v0.22.0

Choose a tag to compare

@CoreyKaylor CoreyKaylor released this 05 Jul 01:43

Native library updated to LMDB 0.9.35

The bundled native binaries for all platforms are updated from LMDB 0.9.33 to 0.9.35, picking up upstream fixes including a race condition on spilled pages during transaction commit (ITS#9564), a memory leak with nested transactions (ITS#10342), and mdb_env_copy2 failures with values over 2GB (ITS#10346).

Allocation-free cursor enumeration and reads

  • cursor.AsEnumerable() and cursor.AllValuesFor(key) now return struct enumerables (CursorEnumerable, CursorDuplicateValuesEnumerable). Iterating with foreach no longer allocates an iterator state machine or boxed enumerator. Both types still implement IEnumerable, so existing LINQ usage keeps working.
  • New non-throwing TryGet overloads copy values into caller-owned memory: TryGet(db, key, Span destination, out int valueLength) reports the required size instead of throwing when the buffer is too small, and a TryGet(db, key, IBufferWriter) overload supports growable buffers. Reading 1,000 Γ— 256-byte values via the span overload allocates 56 bytes total versus ~280 KB with the out byte[] overload, and is ~11% faster.
  • LightningEnvironment.Version no longer allocates on every access.

Fixes

  • size_t results are now marshalled as nuint instead of int, fixing truncation of values over 2GB (thanks @patrik-lindberg β€” Patrik Lindberg)
  • LightningCursor.Count now throws OverflowException on overflow instead of silently wrapping (Patrik Lindberg)

Breaking changes

  • Recompile required: the return types of AsEnumerable/AllValuesFor changed from IEnumerable to struct enumerables. Source-compatible for foreach and LINQ; binary compatibility is broken. AllValuesFor now takes ReadOnlySpan instead of Span (also source-compatible).
  • ios-arm runtime removed: the 32-bit armv7s iOS binary can no longer be built with any modern iOS SDK, and .NET 6+ supports only arm64 on iOS. All other iOS/simulator RIDs remain.

v0.21.0

Choose a tag to compare

@CoreyKaylor CoreyKaylor released this 24 Dec 13:28

Breaking Changes

API Signature Changes (nullable annotations and overload refactoring):

  • LightningEnvironment.BeginTransaction() - The parent parameter is no longer a nullable default. Use:
    • BeginTransaction() or BeginTransaction(TransactionBeginFlags) for top-level transactions
    • BeginTransaction(LightningTransaction parent, ...) for nested transactions
  • LightningTransaction.OpenDatabase() - Refactored from single method with nullable defaults to explicit overloads:
    • OpenDatabase() - default unnamed database
    • OpenDatabase(DatabaseConfiguration) - unnamed with config
    • OpenDatabase(string name) - named database
    • OpenDatabase(string name, DatabaseConfiguration) - named with config
  • LightningEnvironment constructor - Now requires explicit overload:
    • LightningEnvironment(string path) - default config
    • LightningEnvironment(string path, EnvironmentConfiguration) - custom config (no longer nullable)
  • ParentTransaction property is now explicitly nullable (LightningTransaction?)
  • TryGet extension now returns string? for the out parameter

MDBValue is now a readonly struct - This improves performance but may affect code that mutated the struct.

New Features

Built-in Comparers (LightningDB.Comparers namespace):

  • BitwiseComparer / ReverseBitwiseComparer - Lexicographic byte comparison
  • SignedIntegerComparer / ReverseSignedIntegerComparer - 4/8-byte signed integers
  • UnsignedIntegerComparer / ReverseUnsignedIntegerComparer - 4/8-byte unsigned integers
  • Utf8StringComparer / ReverseUtf8StringComparer - Ordinal UTF-8 strings
  • LengthComparer / ReverseLengthComparer - Sort by length first, then content
  • LengthOnlyComparer - Sort by length only
  • GuidComparer / ReverseGuidComparer - Optimized 16-byte GUID comparison
  • HashCodeComparer - Hash-based comparison for large values

MDBValue Enhancements (thanks @sebastienros ):

  • Read() - Read unmanaged type directly from buffer
  • Cast() - Cast buffer to ReadOnlySpan
  • CopyTo(Span) - Copy buffer contents
  • AsWritableSpan() - Get writable span

Performance Improvements

  • MDBValue optimized with [MethodImpl(MethodImplOptions.AggressiveInlining)]
  • [SkipLocalsInit] attribute on .NET 5+ for reduced initialization overhead
  • Optimized span creation using MemoryMarshal.CreateReadOnlySpan

Infrastructure

  • Added GitHub Actions benchmark workflows for performance regression tracking

v0.20.0

Choose a tag to compare

@CoreyKaylor CoreyKaylor released this 12 Nov 15:11

What's New

  • Added support for .NET 10.0, thx @sebastienros for the pointers as always
  • Migrated solution to modern .slnx format

v0.19.1

Choose a tag to compare

@CoreyKaylor CoreyKaylor released this 20 Oct 13:42

Bug Fixes

  • Fixed string marshalling issue in native LMDB path handling (#187)
    • Added proper null terminators to path strings in mdb_env_open, mdb_env_copy, and mdb_env_copy2 functions
    • Ensures correct interop with native LMDB library when passing file paths

v0.19.0

Choose a tag to compare

@CoreyKaylor CoreyKaylor released this 22 Sep 16:15

New Features

  • Windows ARM64 Support: Added native support for Windows on ARM64 architecture
    • Thanks to #186 and the inspiration from @bulpet
    • Includes native binaries and build script updates for win-arm64 platform

Other Changes

  • Added NuGet publish workflow for automated package publishing

v0.18.1

Choose a tag to compare

@CoreyKaylor CoreyKaylor released this 27 May 16:04

This release includes a minor improvement on the finalizer path for LightningDatabase that could cause a system crash even when close on dispose is set to false.

More native lib additions, better comments, more tests

Choose a tag to compare

@CoreyKaylor CoreyKaylor released this 03 Mar 18:30

This release largely ensured there is better coverage with the native methods available in the LMDB available in this library.

  • Added overloads for Copy that include FileStream (file descriptor in the native lib)
  • Ability to set environment flags and get existing flags
  • A LOT more test coverage providing much better examples of different use-cases
  • Improved many of the XML doc comments throughout

Minor binaries fixes and stats addition

Choose a tag to compare

@CoreyKaylor CoreyKaylor released this 15 Jan 19:03
  • Database stats addition from @DecoyFish
  • Recompile native binaries to fix duplicate binaries issue in linux/arm targets
  • Updating target framework versions to remove netcoreapp3.1

LMDB 0.9.33 and remove event delegates 😯

Choose a tag to compare

@CoreyKaylor CoreyKaylor released this 27 Nov 23:05
  • Remove some debug code from compiled native binaries
  • Update LMDB native binaries to 0.9.33
  • Return key/value pairs in several missing cursor methods (related to older design modifications)
  • No longer support Windows auto-resize DLL. You can compile it yourself or grab the older binaries, but has been unsupported for a long time in the native project
  • Updated to net9.0 and language v13
  • BREAKING: Sorry, but I have done away with the convoluted internals using .NET event delegates to handle event, tx, child tx scenarios for you. If you were relying previously for this library to handle those for you, it will not require you to manage the correct order of things

Mobile binaries and fixes

Choose a tag to compare

@CoreyKaylor CoreyKaylor released this 11 Oct 20:27

Adds native binaries for Android and iOS targets.
Adds mdb_cursor_count from @adamfur
Fixes CopyTo swallowed error from @DecoyFish
Fixes string marshalling for paths in .NET 6 from @Sonix