BTDB 32.13.0
See the version list below for details.
dotnet add package BTDB --version 32.13.0
NuGet\Install-Package BTDB -Version 32.13.0
<PackageReference Include="BTDB" Version="32.13.0" />
paket add BTDB --version 32.13.0
#r "nuget: BTDB, 32.13.0"
// Install BTDB as a Cake Addin #addin nuget:?package=BTDB&version=32.13.0 // Install BTDB as a Cake Tool #tool nuget:?package=BTDB&version=32.13.0
BTDB
Currently this project these parts:
- Key Value Database
- Wrapped Dynamic IL generation with debugging + extensions
- IOC Container (SourceGenerator based)
- Object Database with Relations
- Snappy Compression
- Event Storage
- Bon (Binary object notation)
- Incremental SourceGenerator for IOC Container factory generation
All code written in C# 11 and licensed under very permissive MIT license. Targeting .Net 8.0, main code has just 1 dependency (Microsoft.Extensions.Primitives). Code is tested using xUnit Framework. Used in production on Windows and Linux, on MacOS works as well. Please is you find it useful or have questions, write me e-mail boris.letocha@gmail.com so I know that it is used. It is available in Nuget http://www.nuget.org/packages/BTDB. Source code drops are Github releases.
Key Value Database
Features
- This is Key Value store written in C# with 2 implementation old on managed heap and new on native heap (has also prefix compression).
- It is easily embeddable.
- One storage is just one directory.
- It has ACID properties with MVCC.
- At one time there could be multiple read only transactions and one read/write transaction.
- Export/Import to stream - could be used for compaction, snapshotting
- Automatic compaction
- Customizable compression
- Relatively Fast DB Open due to key index file - though it still needs to load all keys to memory
- Inspired by Bitcask [https://github.com/basho/bitcask/blob/develop/doc/bitcask-intro.pdf]
Design limits
- All keys data needs to fit in RAM
- Maximum Key length is limited by 31bits (2GB).
- Maximum value length is limited by 31bits (2GB).
Sample code
using (var fileCollection = new InMemoryFileCollection())
using (IKeyValueDB db = new KeyValueDB(fileCollection))
{
using (var tr = db.StartTransaction())
{
tr.CreateOrUpdateKeyValue(new byte[] { 1 }, new byte[100000]);
tr.Commit();
}
}
Roadmap
- Everything is there just use it
Wrapped Dynamic IL generation with debugging + extensions
This help you to write fluent code which generates IL code in runtime. It is used in Object Database part.
Sample code
var method = ILBuilder.Instance.NewMethod<Func<Nested>>("SampleCall");
var il = method.Generator;
var local = il.DeclareLocal(typeof(Nested), "n");
il
.Newobj(() => new Nested())
.Dup()
.Stloc(local)
.Ldstr("Test")
.Call(() => ((Nested)null).Fun(""))
.Ldloc(local)
.Ret();
var action = method.Create();
Roadmap
- Add support for all IL instructions as needed
- Deprecate this by replacing its usages by Source Generator
Object Database
Features
- Builds on top of Key Value Database and Reflection.Emit extensions.
- It stores Plain .Net Objects and only their public properties with getters and setters.
- All ACID and MVCC properties are preserved of course.
- Automatic upgrading of model on read with dynamically generated optimal IL code.
- Automatic versioning of model changes.
- Enumeration of all objects
- Each object type could store its "singleton" - very useful for root objects
- Relations - Table with primary key and multiple secondary keys
- By default objects are stored inline in parent object, use IIndirect for objects with Oid which will load lazily
Documentation: [https://github.com/Bobris/BTDB/blob/master/Doc/ODBDictionary.md]
Relations doc: [https://github.com/Bobris/BTDB/blob/master/Doc/Relations.md]
Sample code
public class Person
{
public string Name { get; set; }
public uint Age { get; set; }
}
using (var tr = _db.StartTransaction())
{
tr.Store(new Person { Name = "Bobris", Age = 35 });
tr.Commit();
}
using (var tr = _db.StartTransaction())
{
var p = tr.Enumerate<Person>().First();
Assert.AreEqual("Bobris", p.Name);
Assert.AreEqual(35, p.Age);
}
Roadmap
- Support more types of properties
- Free text search (far future if ever)
Event storage
Features
- Optimal serialization with metadata
- Deserialization also to dynamic
- Storage is transactional
- As storage could be used Azure Page Blobs
- EventStorage2 is specialized to be used with Kafka, metadata are stored in separate topic
Bon
Bon
Binary object notation is allows creating and reading JavaScript/C# values with extensions like Dictionary/Map into binary notation. It is much faster to parse, write, skip, search by keys than JSON, size will be also smaller in most cases, in some cases much more smaller.
Snappy Compression
Features
- Ported and inspired mainly by Go version of Snappy Compression [http://code.google.com/p/snappy/]
- Fully compatible with original
- Fully managed and safe implementation
- Compression is aborted when target buffer size is not big enough
Roadmap
- Some speed optimizations around Spans would help
Product | Versions 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. |
-
net8.0
- Microsoft.Extensions.Primitives (>= 8.0.0)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on BTDB:
Package | Downloads |
---|---|
Bbcore.Lib
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
32.16.4 | 428 | 11/6/2024 | |
32.16.3 | 295 | 10/25/2024 | |
32.16.2 | 9,112 | 10/14/2024 | |
32.16.1 | 4,846 | 10/11/2024 | |
32.16.0 | 6,151 | 10/4/2024 | |
32.15.1 | 728 | 8/29/2024 | |
32.15.0 | 95 | 8/29/2024 | |
32.14.1 | 1,031 | 8/17/2024 | |
32.14.0 | 146 | 8/4/2024 | |
32.13.1 | 29,640 | 7/31/2024 | |
32.13.0 | 2,104 | 7/26/2024 | |
32.12.1 | 255 | 7/21/2024 | |
32.12.0 | 158 | 7/18/2024 | |
32.11.0 | 3,971 | 7/6/2024 | |
32.10.0 | 4,348 | 6/20/2024 | |
32.9.0 | 174 | 6/15/2024 | |
32.8.0 | 10,010 | 6/14/2024 | |
32.7.1 | 17,480 | 5/15/2024 | |
32.7.0 | 119 | 5/14/2024 | |
32.6.2 | 3,659 | 5/6/2024 | |
32.6.1 | 116 | 5/6/2024 | |
32.6.0 | 200 | 5/1/2024 | |
32.5.0 | 54,077 | 2/29/2024 | |
32.4.29 | 456 | 2/26/2024 | |
32.4.28 | 109 | 2/26/2024 | |
32.4.26 | 16,820 | 2/21/2024 | |
32.4.25 | 2,042 | 2/20/2024 | |
32.4.24 | 494 | 2/19/2024 | |
32.4.23 | 3,539 | 2/14/2024 | |
32.4.22 | 125 | 2/13/2024 | |
32.4.21 | 3,862 | 2/12/2024 | |
32.4.20 | 269 | 2/7/2024 | |
32.4.19 | 177 | 2/7/2024 | |
32.4.18 | 256 | 2/1/2024 | |
32.4.17 | 115 | 1/31/2024 | |
32.4.16 | 112 | 1/30/2024 | |
32.4.15 | 240 | 1/29/2024 | |
32.4.14 | 118 | 1/29/2024 | |
32.4.13 | 120 | 1/27/2024 | |
32.4.12 | 119 | 1/26/2024 | |
32.4.11 | 115 | 1/26/2024 | |
32.4.10 | 105 | 1/26/2024 | |
32.4.9 | 112 | 1/26/2024 | |
32.4.8 | 109 | 1/26/2024 | |
32.4.7 | 99 | 1/25/2024 | |
32.4.6 | 110 | 1/25/2024 | |
32.4.5 | 127 | 1/25/2024 | |
32.4.4 | 108 | 1/24/2024 | |
32.4.3 | 116 | 1/23/2024 | |
32.4.2 | 107 | 1/23/2024 | |
32.4.1 | 111 | 1/22/2024 | |
32.4.0 | 123 | 1/21/2024 | |
32.3.2 | 130 | 1/19/2024 | |
32.3.1 | 118 | 1/18/2024 | |
32.3.0 | 123 | 1/18/2024 | |
32.2.0 | 129 | 1/17/2024 | |
32.1.0 | 138 | 1/14/2024 | |
32.0.3 | 147 | 1/8/2024 | |
32.0.2 | 575 | 1/2/2024 | |
32.0.1 | 135 | 1/2/2024 | |
32.0.0 | 148 | 1/1/2024 | |
31.15.0 | 9,794 | 1/22/2024 | |
31.14.0 | 24,036 | 11/23/2023 | |
31.13.0 | 4,382 | 11/21/2023 | |
31.12.7 | 1,630 | 11/16/2023 | |
31.12.6 | 250 | 11/16/2023 | |
31.12.5 | 216 | 11/13/2023 | |
31.12.4 | 639 | 11/12/2023 | |
31.12.3 | 8,907 | 10/30/2023 | |
31.12.2 | 4,674 | 10/16/2023 | |
31.12.1 | 5,109 | 10/5/2023 | |
31.12.0 | 242 | 9/17/2023 | |
31.11.3 | 30,141 | 8/10/2023 | |
31.11.2 | 191 | 8/9/2023 | |
31.11.1 | 172 | 8/8/2023 | |
31.11.0 | 4,953 | 8/8/2023 | |
31.10.0 | 1,051 | 8/3/2023 | |
31.9.0 | 206 | 8/1/2023 | |
31.8.2 | 2,751 | 8/1/2023 | |
31.8.1 | 171 | 8/1/2023 | |
31.8.0 | 25,029 | 6/8/2023 | |
31.7.0 | 10,295 | 5/23/2023 | |
31.6.0 | 211 | 5/21/2023 | |
31.5.2 | 1,669 | 5/16/2023 | |
31.5.1 | 17,635 | 4/13/2023 | |
31.5.0 | 8,878 | 3/28/2023 | |
31.4.3 | 3,692 | 3/24/2023 | |
31.4.2 | 3,806 | 3/21/2023 | |
31.4.1 | 283 | 3/21/2023 | |
31.4.0 | 312 | 3/21/2023 | |
31.3.2 | 17,036 | 2/20/2023 | |
31.3.1 | 647 | 2/17/2023 | |
31.3.0 | 314 | 2/15/2023 | |
31.2.1 | 327 | 2/15/2023 | |
31.2.0 | 1,997 | 2/15/2023 | |
31.1.1 | 27,145 | 2/4/2023 | |
31.1.0 | 361 | 2/3/2023 | |
31.0.0 | 365 | 2/3/2023 | |
30.5.0 | 13,911 | 1/10/2023 | |
30.4.0 | 560 | 1/9/2023 | |
30.3.0 | 6,776 | 1/3/2023 | |
30.2.2 | 10,358 | 1/2/2023 | |
30.2.1 | 410 | 1/2/2023 | |
30.2.0 | 428 | 1/1/2023 | |
30.1.0 | 371 | 12/21/2022 | |
30.0.0 | 23,061 | 11/14/2022 | |
29.12.1 | 484 | 11/3/2022 | |
29.12.0 | 906 | 11/2/2022 | |
29.11.0 | 521 | 9/7/2022 | |
29.10.1 | 527 | 8/1/2022 | |
29.10.0 | 509 | 8/1/2022 | |
29.9.1 | 526 | 7/22/2022 | |
29.9.0 | 543 | 7/17/2022 | |
29.8.0 | 550 | 6/13/2022 | |
29.7.0 | 541 | 6/8/2022 | |
29.6.0 | 537 | 6/5/2022 | |
29.5.0 | 556 | 5/18/2022 | |
29.4.0 | 551 | 5/17/2022 | |
29.3.0 | 545 | 5/13/2022 | |
29.2.0 | 574 | 5/3/2022 | |
29.1.1 | 8,762 | 3/29/2022 | |
29.1.0 | 560 | 3/28/2022 | |
29.0.0 | 596 | 2/28/2022 | |
28.3.2 | 614 | 1/21/2022 | |
28.3.1 | 560 | 1/21/2022 | |
28.3.0 | 419 | 1/4/2022 | |
28.2.0 | 428 | 12/19/2021 | |
28.1.2 | 445 | 12/7/2021 | |
28.1.1 | 379 | 12/6/2021 | |
28.1.0 | 400 | 11/29/2021 | |
28.0.0 | 421 | 11/17/2021 | |
27.0.3 | 476 | 11/17/2021 | |
27.0.2 | 1,681 | 11/7/2021 | |
27.0.0 | 433 | 11/2/2021 | |
26.2.1 | 717 | 5/8/2021 | |
24.0.2 | 21,213 | 6/15/2020 | |
24.0.1 | 816 | 6/13/2020 | |
24.0.0 | 674 | 6/13/2020 | |
23.1.0 | 838 | 5/23/2020 | |
23.0.0 | 667 | 5/18/2020 | |
22.2.2 | 676 | 5/14/2020 | |
22.2.1 | 650 | 5/14/2020 | |
22.2.0 | 630 | 5/13/2020 | |
22.1.0 | 648 | 5/12/2020 | |
22.0.0 | 670 | 5/10/2020 | |
21.0.0 | 698 | 5/6/2020 | |
20.3.0 | 738 | 5/2/2020 | |
20.0.0 | 785 | 4/25/2020 | |
19.5.0 | 1,234 | 3/10/2020 | |
19.4.0 | 1,683 | 11/30/2019 | |
19.3.0 | 1,103 | 11/6/2019 | |
19.2.0 | 785 | 11/3/2019 | |
19.1.0 | 971 | 10/13/2019 | |
19.0.0 | 812 | 10/6/2019 | |
18.2.2 | 1,090 | 9/19/2019 | |
18.2.1 | 859 | 9/16/2019 | |
18.2.0 | 886 | 9/8/2019 | |
18.1.0 | 909 | 9/2/2019 | |
18.0.0 | 794 | 9/1/2019 | |
17.10.0 | 827 | 8/28/2019 | |
17.9.0 | 1,988 | 7/24/2019 | |
17.8.0 | 1,717 | 7/13/2019 | |
17.7.0 | 1,459 | 6/9/2019 | |
17.6.0 | 1,366 | 5/10/2019 | |
17.5.2 | 1,390 | 5/9/2019 | |
17.5.1 | 1,407 | 5/9/2019 | |
17.5.0 | 1,432 | 4/16/2019 | |
17.4.2 | 1,554 | 2/12/2019 | |
17.4.1 | 1,475 | 2/6/2019 | |
17.4.0 | 1,471 | 2/6/2019 | |
17.3.0 | 1,474 | 1/25/2019 | |
17.2.0 | 1,524 | 1/8/2019 | |
17.1.0 | 1,449 | 12/24/2018 | |
17.0.1 | 1,516 | 12/20/2018 | |
17.0.0 | 1,524 | 12/16/2018 | |
16.2.1 | 1,568 | 12/11/2018 | |
14.12.2 | 1,686 | 10/15/2018 | |
14.7.0 | 1,869 | 8/16/2018 | |
14.6.0 | 1,656 | 8/2/2018 | |
14.5.2 | 1,777 | 7/9/2018 | |
14.5.1 | 1,739 | 6/20/2018 | |
14.5.0 | 1,743 | 6/13/2018 | |
14.4.0 | 1,778 | 6/10/2018 | |
14.3.0 | 1,825 | 6/10/2018 | |
14.2.1 | 1,770 | 6/7/2018 | |
14.2.0 | 1,676 | 6/6/2018 | |
14.1.0 | 1,658 | 6/6/2018 | |
14.0.0 | 1,727 | 6/5/2018 | |
13.1.0 | 1,759 | 6/3/2018 | |
13.0.0 | 1,787 | 5/7/2018 | |
12.7.0 | 1,865 | 4/15/2018 | |
12.6.1 | 1,833 | 3/23/2018 | |
12.6.0 | 1,841 | 3/18/2018 | |
12.5.1 | 1,803 | 2/26/2018 | |
12.5.0 | 1,840 | 2/12/2018 | |
12.4.0 | 1,865 | 1/31/2018 | |
12.3.0 | 1,798 | 1/29/2018 | |
12.2.0 | 1,821 | 1/9/2018 | |
12.1.0 | 1,877 | 12/10/2017 | |
12.0.0 | 1,763 | 12/3/2017 | |
11.10.1 | 1,941 | 11/20/2017 | |
11.10.0 | 1,956 | 11/3/2017 | |
11.9.1 | 1,939 | 11/2/2017 | |
11.9.0 | 1,909 | 10/31/2017 | |
11.8.1 | 1,905 | 10/30/2017 | |
11.8.0 | 1,913 | 10/28/2017 | |
11.7.0 | 1,942 | 10/26/2017 | |
11.6.5 | 1,957 | 10/24/2017 | |
11.6.4 | 1,960 | 10/23/2017 | |
11.6.3 | 1,980 | 10/20/2017 | |
11.6.2 | 1,929 | 10/19/2017 | |
11.6.1 | 1,935 | 10/18/2017 | |
11.6.0 | 1,936 | 10/15/2017 | |
11.5.0 | 1,926 | 10/8/2017 | |
11.4.0 | 2,177 | 9/6/2017 | |
11.3.0 | 1,943 | 9/4/2017 | |
11.2.0 | 1,751 | 8/20/2017 | |
11.1.0 | 1,707 | 8/9/2017 | |
11.0.4 | 1,766 | 7/30/2017 | |
11.0.3 | 1,786 | 7/24/2017 | |
11.0.2 | 1,886 | 7/21/2017 | |
11.0.1 | 1,743 | 7/21/2017 | |
11.0.0 | 1,813 | 7/19/2017 | |
10.6.0 | 1,799 | 6/27/2017 | |
10.5.2 | 1,862 | 6/23/2017 | |
10.5.1 | 1,829 | 6/22/2017 | |
10.5.0 | 1,790 | 6/17/2017 | |
10.4.3 | 1,780 | 5/31/2017 | |
10.4.2 | 1,749 | 5/25/2017 | |
10.4.1 | 1,815 | 5/22/2017 | |
10.4.0 | 1,756 | 5/19/2017 | |
10.3.0 | 1,765 | 5/11/2017 | |
10.2.0 | 1,772 | 4/21/2017 | |
10.1.2 | 1,747 | 4/14/2017 | |
10.1.1 | 1,745 | 4/12/2017 | |
10.1.0 | 1,776 | 4/7/2017 | |
10.0.2 | 1,732 | 3/28/2017 | |
10.0.1 | 1,757 | 3/26/2017 | |
10.0.0 | 1,785 | 3/20/2017 | |
9.4.0 | 1,750 | 3/12/2017 | |
9.3.1 | 1,774 | 3/9/2017 | |
9.3.0 | 1,783 | 3/6/2017 | |
9.2.1 | 1,761 | 2/28/2017 | |
9.2.0 | 1,842 | 2/21/2017 | |
9.1.1 | 1,782 | 2/15/2017 | |
9.1.0 | 1,888 | 2/8/2017 | |
9.0.4 | 1,874 | 1/23/2017 | |
9.0.3 | 1,828 | 12/20/2016 | |
9.0.2 | 1,759 | 12/18/2016 | |
9.0.0 | 1,826 | 12/12/2016 | |
8.0.1 | 1,827 | 12/10/2016 | |
8.0.0 | 1,839 | 11/28/2016 | |
7.0.0 | 1,832 | 11/23/2016 | |
6.0.0 | 2,149 | 11/17/2016 | |
5.7.0 | 2,391 | 11/3/2016 | |
5.6.4 | 2,348 | 11/2/2016 | |
5.6.3 | 2,050 | 10/30/2016 | |
5.6.2 | 2,061 | 10/26/2016 | |
5.6.1 | 2,018 | 10/26/2016 | |
5.6.0 | 2,039 | 10/24/2016 | |
5.5.0 | 2,065 | 10/22/2016 | |
5.4.0 | 2,099 | 10/21/2016 | |
5.3.2 | 2,097 | 10/16/2016 | |
5.3.1 | 2,066 | 9/14/2016 | |
5.3.0 | 2,124 | 9/13/2016 | |
5.2.0 | 2,061 | 9/11/2016 | |
5.1.0 | 2,054 | 9/9/2016 | |
5.0.0 | 2,007 | 9/8/2016 | |
4.0.1 | 2,026 | 9/8/2016 | |
4.0.0 | 2,031 | 9/7/2016 | |
3.6.0 | 2,038 | 9/4/2016 | |
3.5.0 | 2,070 | 9/1/2016 | |
3.4.0 | 2,103 | 8/8/2016 | |
3.3.0 | 2,126 | 7/18/2016 | |
3.2.3 | 2,111 | 6/28/2016 | |
3.2.2 | 2,530 | 6/15/2016 | |
3.2.1 | 2,097 | 6/7/2016 | |
3.2.0 | 2,081 | 6/5/2016 | |
3.1.0 | 2,090 | 5/30/2016 | |
3.0.0 | 2,162 | 5/19/2016 | |
2.12.0 | 2,205 | 4/10/2016 | |
2.11.0 | 2,204 | 4/9/2016 | |
2.10.1 | 1,912 | 3/16/2016 | |
2.10.0 | 2,187 | 2/17/2016 | |
2.9.1 | 2,187 | 12/13/2015 | |
2.9.0 | 2,151 | 12/8/2015 | |
2.8.5 | 2,227 | 11/27/2015 | |
2.8.4 | 2,178 | 11/27/2015 | |
2.8.2 | 2,168 | 11/4/2015 | |
2.8.1 | 2,116 | 11/4/2015 | |
2.8.0 | 2,168 | 11/1/2015 | |
2.7.0 | 2,346 | 6/27/2015 | |
2.6.3 | 2,212 | 6/16/2015 | |
2.6.2 | 2,338 | 6/14/2015 | |
2.6.1 | 2,236 | 5/15/2015 | |
2.6.0 | 2,297 | 4/13/2015 | |
2.5.3 | 2,321 | 1/26/2015 | |
2.5.2 | 2,544 | 12/13/2014 | |
2.5.1 | 2,448 | 11/18/2014 | |
2.5.0 | 2,323 | 10/13/2014 | |
2.4.5 | 2,266 | 10/6/2014 | |
2.4.4 | 2,446 | 6/3/2014 | |
2.4.3 | 2,288 | 6/2/2014 | |
2.4.2 | 2,313 | 5/30/2014 | |
2.4.0 | 2,650 | 3/14/2014 | |
2.3.2 | 2,217 | 2/3/2014 | |
2.3.1 | 2,079 | 12/15/2013 | |
2.3.0 | 2,055 | 12/14/2013 | |
2.2.2 | 2,162 | 12/12/2013 | |
2.2.1 | 2,123 | 12/11/2013 | |
2.2.0 | 2,174 | 12/8/2013 | |
2.1.0 | 2,170 | 12/8/2013 | |
2.0.2 | 2,221 | 12/2/2013 | |
2.0.1 | 2,207 | 11/26/2013 | |
2.0.0 | 2,159 | 11/14/2013 | |
1.2.1 | 2,133 | 11/11/2013 | |
1.1.0 | 2,192 | 9/5/2013 | |
1.0.0 | 2,169 | 9/1/2013 |