Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/jiacai2050/zig-rocksdb

RocksDB binding for Zig
https://github.com/jiacai2050/zig-rocksdb

rocksdb rocksdb-zig zig zig-lib zig-library zig-package

Last synced: 30 days ago
JSON representation

RocksDB binding for Zig

Awesome Lists containing this project

README

        

#+TITLE: Zig-rocksdb
#+DATE: 2024-04-27T11:27:04+0800
#+LASTMOD: 2024-10-27T14:34:21+0800
#+AUTHOR: Jiacai Liu

[[https://img.shields.io/badge/zig%20version-0.13.0-blue.svg]]
[[https://github.com/jiacai2050/zig-rocksdb/actions/workflows/CI.yml][https://github.com/jiacai2050/zig-rocksdb/actions/workflows/CI.yml/badge.svg]]

[[https://github.com/facebook/rocksdb/][RocksDB]] binding for Zig.

* Usage
See [[file:examples/basic.zig]], [[file:examples/cf.zig]] for details.
* Installation
#+begin_src bash
zig fetch --save=rocksdb https://github.com/jiacai2050/zig-rocksdb/archive/${COMMIT}.tar.gz
#+end_src

Replace ~${COMMIT}~ with a real one, then in your =build.zig=, import the module like this:
#+begin_src zig
const dep_rocksdb = b.dependency("rocksdb", .{});
exe.root_module.addImport("rocksdb", dep_rocksdb.module("rocksdb"));
exe.linkLibC();
#+end_src

This library will link to a vendored [[https://github.com/facebook/rocksdb/releases/tag/v9.0.0][librocksdb(v9.0.0)]] by default, you can disable it and link to system-wide with this
#+begin_src zig
const dep_rocksdb = b.dependency("rocksdb", .{ .link_vendor = false });
exe.linkSystemLibrary("rocksdb");
exe.linkLibC();
#+end_src
* Acknowledge
Thanks to [[https://github.com/rust-rocksdb/rust-rocksdb][rust-rocksdb]], I benefit a lot from it when build this building library.

* License
[[file:LICENSE][MIT]]