A Rust port of BuntDB

Overview

This is a Rust port of fantasitc BuntDB project by Josh Baker.

Big parts of this project are taken directly from BuntDB including API surface and API documentation.

Contributions are welcome and enouraged! Please see "Issues" for ideas for contributions.

Comments
  • Research BTree implementation

    Research BTree implementation

    I did search for crates implementing BTree but found only one crate maintained: https://github.com/nimrodshn/btree

    However it's disk-backed and has completely different API than: https://github.com/tidwall/btree

    I tried going with BTreeSet and implementing wrapper structs like: OrdByKeyItem and OrdByExpItem but I'm not sure this is a viable path.

    opened by bartlomieju 10
  • Tx::commit() doesn't properly write to disk

    Tx::commit() doesn't properly write to disk

    Currently Tx::commit() has a very naive implementation of writing to disk:

    https://github.com/bartlomieju/rusty_buntdb/blob/29ef544b91d08ca36d0313893c7cf7f807e91cf2/src/lib.rs#L1344-L1352

    It should be updated to handle partial writes like Go version does:

    https://github.com/tidwall/buntdb/blob/89544ad8fc446ae7c798e487951dc06739092b6b/buntdb.go#L1188-L1211

    opened by bartlomieju 1
  • Consider splitting codebase into more modules

    Consider splitting codebase into more modules

    Currently all of the code is in src/lib.rs. I did that in an effort to port the Go version as closely as possible. Given that Rust code is a bit more verbose in some situations the file is already at over 2,5k lines.

    I believe in the long run it will be beneficial to split the library into multiple modules, it should help spot "non-rusty" code that could be made better after initial port.

    Proposed modules:

    • src/db.rs - Db struct
    • src/tx.rs - Tx struct
    • src/index.rs - Index struct
    • src/error.rs - DbError struct
    • src/tree_utils.rs - helper functions for traversing BTreeC
    opened by bartlomieju 0
  • Tx::lock and Tx::unlock don't work

    Tx::lock and Tx::unlock don't work

    Currently Tx::lock and Tx::unlock are stubbed out:

    https://github.com/bartlomieju/rusty_buntdb/blob/29ef544b91d08ca36d0313893c7cf7f807e91cf2/src/lib.rs#L1246-L1264

    This is fine for now as DB runs on single thread but needs to be fixed prior to making DB multithreaded (#7). Since Rust RwLock return a "guards" that unlock when they are dropped, those guards need to be stored on the Tx struct.

    opened by bartlomieju 0
  • Make Db multithreaded and add background sync

    Make Db multithreaded and add background sync

    Currently Db is not thread-safe, but we need to make it so to enable background sync (Db::background_manager is currently stubbed out).

    Need to be especially careful when interacting with BTreeC which is using C-based data structure.

    opened by bartlomieju 0
  • chore: add CI script

    chore: add CI script

    CI will verify that the crate builds, is formatted and clippy doesn't complain. However tests are currently disabled because there's only a single one and it panics.

    Closes #4

    opened by bartlomieju 0
  • Docstrings need to updated

    Docstrings need to updated

    I copy-pasted most of the docs from the Go implementation. These docstrings need to be reviewed and fixed to properly reference methods/structs in Rust implementation (including proper linking in docs.rs).

    opened by bartlomieju 0
  • String type is used too liberally

    String type is used too liberally

    Currently most of the methods use String type. This is needlessly expensive and causes a lot of clones or .to_string() calls throughout the codebase.

    Most of the occurences should be changed to &str or something along the lines impl String.

    I will look into this once most of the tests are passing.

    opened by bartlomieju 0
  • Add remaining index comparison functions

    Add remaining index comparison functions

    • [x] index_int
    • [x] index_string
    • [x] index_binary index_string_case_sensitive
    • [x] index_float
    • [ ] index_json
    • [ ] index_json_case_sensitive

    Reference: https://github.com/tidwall/buntdb/blob/89544ad8fc446ae7c798e487951dc06739092b6b/buntdb.go#L2197-L2245

    Special care needs to be taken when considering JSON methods; I believe https://crates.io/crates/gjson doesn't have case-insensitive comparison as of now.

    opened by bartlomieju 1
  • Port

    Port "match" package

    match is used when matching indexes and should be ported as a utility module matcher.rs (match is a keyword in Rust so it would require prefixing each occurrence with r#).

    opened by bartlomieju 4
Owner
Bartek Iwańczuk
Bartek Iwańczuk
A Rust port of Pimoroni's uc8151 driver

uc8151-rs - a no-std Rust library for the UC8151(IL0373) e-ink display This is a Rust port of the Pimoroni UC8151 library. UC8151 is also sometimes re

null 6 Dec 15, 2022
A port of `java.util.*SummaryStatistics` as a Redis Module

RedisNumbersStats RedisNumbersStats is a Redis module that implements a Redis version of the Java Util *SummaryStatistics classes, such as DoubleSumma

Brian Sam-Bodden 4 Oct 4, 2022
🧰 The Rust SQL Toolkit. An async, pure Rust SQL crate featuring compile-time checked queries without a DSL. Supports PostgreSQL, MySQL, SQLite, and MSSQL.

SQLx ?? The Rust SQL Toolkit Install | Usage | Docs Built with ❤️ by The LaunchBadge team SQLx is an async, pure Rust† SQL crate featuring compile-tim

launchbadge 7.6k Dec 31, 2022
Redis re-implemented in Rust.

rsedis Redis re-implemented in Rust. Why? To learn Rust. Use Cases rsedis does not rely on UNIX-specific features. Windows users can run it as a repla

Sebastian Waisbrot 1.6k Jan 6, 2023
A generic connection pool for Rust

r2d2 A generic connection pool for Rust. Documentation Opening a new database connection every time one is needed is both inefficient and can lead to

Steven Fackler 1.2k Jan 8, 2023
An ArangoDB driver for Rust

Rincon Rincon is an ArangoDB driver for Rust. It enables low level access to ArangoDB in a typesafe and Rust idiomatic manner. The name Rincon is deri

Innoave 35 Mar 21, 2021
Cassandra DB native client written in Rust language. Find 1.x versions on https://github.com/AlexPikalov/cdrs/tree/v.1.x Looking for an async version? - Check WIP https://github.com/AlexPikalov/cdrs-async

CDRS CDRS is looking for maintainers CDRS is Apache Cassandra driver written in pure Rust. ?? Looking for an async version? async-std https://github.c

Alex Pikalov 338 Jan 1, 2023
Cassandra (CQL) driver for Rust, using the DataStax C/C++ driver under the covers.

cassandra-cpp This is a maintained Rust project that exposes the DataStax cpp driver at https://github.com/datastax/cpp-driver/ in a somewhat-sane cra

null 93 Jan 7, 2023
CouchDB client-side library for the Rust programming language

Chill Chill is a client-side CouchDB library for the Rust programming language, available on crates.io. It targets Rust Stable. Chill's three chief de

null 35 Jun 26, 2022
Sofa - CouchDB for Rust

Sofa - CouchDB for Rust Documentation Here: http://docs.rs/sofa Installation [dependencies] sofa = "0.6" Description This crate is an interface to Cou

66 Origin 40 Feb 11, 2022
⚡🦀 🧨 make your rust types fit DynamoDB and visa versa

?? ?? dynomite dynomite makes DynamoDB fit your types (and visa versa) Overview Goals ⚡ make writing dynamodb applications in rust a productive experi

Doug Tangren 197 Dec 15, 2022
A Rust client for the ElasticSearch REST API

rs-es Introduction An ElasticSearch client for Rust via the REST API. Targetting ElasticSearch 2.0 and higher. Other clients For later versions of Ela

Ben Ashford 218 Dec 27, 2022
An Elasticsearch REST API client for Rust

elastic elastic is an efficient, modular API client for Elasticsearch written in Rust. The API is targeting the Elastic Stack 7.x. elastic provides st

null 249 Oct 18, 2022
An etcd client library for Rust.

etcd An etcd client library for Rust. etcd on crates.io Documentation for the latest crates.io release Running the tests Install Docker and Docker Com

Jimmy Cuadra 138 Dec 27, 2022
etcd for rust

etcd for Rust An etcd(API v3) client for Rust, and it provides async/await APIs backed by tokio and tonic. Documentation on the library can be found a

ccc 159 Dec 30, 2022
Rust bindings for LMDB

lmdb-rs Rust bindings for LMDB Documentation (master branch) Building LMDB is bundled as submodule so update submodules first: git submodule update --

Valerii Hiora 104 Dec 8, 2022
The official MongoDB Rust Driver

MongoDB Rust Driver This repository contains the officially supported MongoDB Rust driver, a client side library that can be used to interact with Mon

mongodb 1.1k Dec 30, 2022
Redis library for rust

redis-rs Redis-rs is a high level redis library for Rust. It provides convenient access to all Redis functionality through a very flexible but low-lev

Armin Ronacher 2.8k Jan 8, 2023
rust wrapper for rocksdb

rust-rocksdb Requirements Clang and LLVM Contributing Feedback and pull requests welcome! If a particular feature of RocksDB is important to you, plea

null 1.3k Dec 30, 2022