Skip to content

zig-bitcoin/rocksdb-zig

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build and use RocksDB in zig.

Build Dependencies

rocksdb-zig is pinned to Zig 0.13, so you will need to have it installed.

Usage

Supported use cases:

  • ⬇️ Build a RocksDB static library using the zig build system.
  • ⬇️ Use the RocksDB C API through auto-generated Zig bindings.
  • ⬇️ Import an idiomatic zig library of bindings that wrap the RocksDB library with hand-written zig code.

Build RocksDB

Clone this repository, then run zig build.

You will find a statically linked rocksdb archive in zig-out/lib/librocksdb.a.

You can use this with any language or build system.

Import RocksDB C API in the Zig Build System.

Fetch rocksdb and save it to your build.zig.zon:

$ zig fetch --save=rocksdb https://github.com/Syndica/rocksdb-zig/archive/<COMMIT_HASH>.tar.gz

Add the import to a module:

const rocksdb = b.dependency("rocksdb", .{}).module("rocksdb");
exe.root_module.addImport("rocksdb", rocksdb);

Import the rocksdb module.

const rocksdb = @import("rocksdb");

Import the Zig bindings library using the Zig Build System.

Fetch rocksdb and save it to your build.zig.zon:

$ zig fetch --save=rocksdb https://github.com/Syndica/rocksdb-zig/archive/<COMMIT_HASH>.tar.gz

Add the import to a module:

const rocksdb_bindings = b.dependency("rocksdb", .{}).module("rocksdb-bindings");
exe.root_module.addImport("rocksdb-bindings", rocksdb_bindings);

Import the rocksdb-bindings module.

const rocksdb = @import("rocksdb-bindings");

About

RocksDB Zig thing wrapper.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Zig 100.0%