Giter Club home page Giter Club logo

lmdb-zig's Introduction

lmdb-zig

Lightweight, fully-featured, idiomatic cross-platform Zig bindings to Lightning Memory-Mapped Database (LMDB).

LMDB is a tiny, extraordinarily fast Btree-based embedded KV database with some excellent properties:

  • Zero-copy lookup and iteration: the entire database is memory-mapped.
  • Transactions may create, drop, and interact with multiple named databases at once.
  • Multiple readers, single writer. Writers don't block readers, readers don't block writers.
  • Keys are lexicographically sorted by default. A custom key ordering may be defined per named database.
  • Zero maintenance: does not require any compaction, external processes, or background threads running.
  • Entire database is exposed as a single file accompanied by a lockfile. A single database file may comprise of multiple named databases.
  • Fully exploits the operating system's buffer cache given its memory mapping and compact size being a mere 32KB worth of object code.

Refer to the 12 extensive unit tests provided here for usage instructions and guidelines.

Built and tested against Zig's master branch over all possible optimization modes.

Motivation

These bindings were built in mind for utilizing LMDB as the underlying backend of a database project.

As a result, extensive effort was put into exposing and testing as many different aspects of LMDB's functionality as possible with an emphasis on minimal overhead, such as fixed memory map addressing, in-place cursor updates, duplicate keys, on-the-fly backups, crash recovery, etc.

Setup

These bindings were built with first-class support for the zigmod package manager.

To incorporate these bindings into your project, include the following into your project's zig.mod:

- type: git
  path: https://github.com/lithdew/lmdb-zig

Afterwards, run:

zigmod fetch

Status

Presently, these bindings completely cover the entire API surface for LMDB except for the list of methods provided below that were deemed unnecessary. In the case you require any of these methods exported, please file an issue describing your use case.

lmdb-zig's People

Contributors

lithdew avatar leroycep avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.