GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - monoclex/StringDB: StringDB is a modular, key/value pair archival DB designed to consume *tiny* amounts of ram & produce *tiny* databases.

BranchesTags
Open more actions menu

Latest commit

 

History

395 Commits
395 Commits

Folders and files

NameName
Last commit message
Last commit date
addons
addons
 
 
examples/01_GettingStarted
examples/01_GettingStarted
 
 
icons
icons
 
 
src
src
 
 
tests/StringDB.Tests
tests/StringDB.Tests
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
StringDB.sln
StringDB.sln
 
 
appveyor.yml
appveyor.yml
 
 

Repository files navigation

StringDB

StringDB

Build Status Test Status Nuget Version Nuget Downloads

Install-Package StringDB

Introduction

StringDB is a key/value pair store with a friendly API to use as little RAM and space as possible.

Verify the claims for yourself:

  • Api
  • Tiny

Api

Enumerate over a database and it's values, the fastest, by enumerating over it optimally

using var db = new DatabaseBuilder()
	.UseIODatabase(StringDBVersion.Latest, "database.db", out var optimalTokenSource)
	.WithBuffer(1000)
	.WithTranform(StringTransformation.Default, StringTransformation.Default);
	
foreach (var (key, value) in db.EnumerateOptimally(optimalTokenSource))
{
	// do something with the key and value
}

Use fluent extensions to create a database:

using IDatabase<string, string> db = new DatabaseBuilder()
    .UseIODatabase(StringDBVersion.Latest, "database.db")
    .WithBuffer(1000)
    .WithTransform(StringTransformation.Default, StringTransformation.Default);

using IDatabase<int, string> memDb = new DatabaseBuilder()
    .UseMemoryDatabase<int, string>();

Use the IDatabase interface to interface with databases

void InsertGreeting(IDatabase<string, string> database, string user)
{
    database.Insert(user, $"Greetings, {user}!");
}

And inherit BaseDatabase to create your own IDatabases with minimal effort

public class TestDatabase : BaseDatabase<int, string>
{
    private class LazyValue : ILazyLoader<string>
    {
        private readonly string _value;
        public LazyValue(int value) => _value = value.ToString();
        public string Load() => _value;
        public void Dispose() {}
    }
	
	public override void Dispose() {}

    protected override void InsertRange(KeyValuePair<int, string>[] items)
    {
        foreach(var item in items)
        {
            Console.WriteLine($"{item.Key}: {item.Value}");
        }
    }

    protected override IEnumerable<KeyValuePair<int, ILazyLoader<string>>> Evaluate()
    {
        for(var i = 0; i < int.MaxValue)
        {
            yield return KeyValuePair.Create(i, new LazyValue(i));
        }
    }
}

Tiny icon_tiny

StringDB is tiny. Use tiny amounts of RAM, and tiny amounts of space.

StringDB 10.0.0 file size: single inserts, 128 byte keys, 1024 byte values

Chart

Inserts Size (in KB, 1000 bytes) Absolute Minimum Size Possible StringDB Overhead Percentage
1 1.172 KB 1.152 KB 1.706485%
50 58.208 KB 57.6 KB 1.04453%
100 116.408 KB 115.2 KB 1.037729%

This chart shows the size of a StringDB file after multiple single inserts. Every key is 128 bytes long, and every value is 1024 bytes long. By doing single inserts, file size is dramatically affected due to the additional overhead for the index chain.

StringDB 10.0.0 file size: insert range, 128 byte keys, 1024 byte values

Chart

Elements in Insert Range Size (in KB, 1000 bytes) Absolute Minimum Size Possible StringDB Overhead Percentage
1 1.172 KB 1.152 KB 1.706485%
50 57.963 KB 57.6 KB 0.626262%
100 115.913 KB 115.2 KB 0.615117%

This chart shows the size of a StringDB file after a single insert range with the amount of items specified.

Addons

Official addon support will be maintained for these libraries.

Issues welcomed!

Don't be afraid to make an issue about anything and everything!

  • Is there something weird with how databases are created? Submit an issue!
  • Is there something that you wish you could do but can't? Submit an issue!
  • Is this library not suitable for your purposes? Submit an isssue!
  • Want it to do something? Submit an issue!

It's an honour to have you use this library, and feedback is needed to make this the greatest it can be.

Need immediate assistence? Join the discord!

About

StringDB is a modular, key/value pair archival DB designed to consume *tiny* amounts of ram & produce *tiny* databases.

Topics

databaseeasy-to-uselightweightsmallstringdb

Resources

Readme
MIT license
Activity

Stars

70 stars

Watchers

7 watching

Forks

12 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.