2 个版本

使用旧的 Rust 2015

0.1.1 2020年3月12日
0.1.0 2020年3月11日

#2238数据库接口

Download history 57/week @ 2024-03-14 51/week @ 2024-03-21 100/week @ 2024-03-28 64/week @ 2024-04-04 66/week @ 2024-04-11 65/week @ 2024-04-18 39/week @ 2024-04-25 83/week @ 2024-05-02 50/week @ 2024-05-09 147/week @ 2024-05-16 131/week @ 2024-05-23 212/week @ 2024-05-30 121/week @ 2024-06-06 181/week @ 2024-06-13 147/week @ 2024-06-20 87/week @ 2024-06-27

567 每月下载量

Sleepycat

45KB
855

状态

CI crates.io badge docs.rs badge

libdb-rs

静态链接的 Berkeley DB Rust 绑定。

这是从 jesterpm 的 libdb-rs 中谨慎分叉的。

特性

v4_8 使用 Berkeley DB 4.8.x 的绑定。

v5_3 使用 Berkeley DB 5.3.x 的绑定。

默认情况下,使用 Berkeley DB 5.3.x。

示例

extern crate libdb;

let env = libdb::EnvironmentBuilder::new()
    .flags(libdb::DB_CREATE | libdb::DB_RECOVER | libdb::DB_INIT_TXN | libdb::DB_INIT_MPOOL)
    .open()
    .unwrap();

let txn = env.txn(None, libdb::DB_NONE).unwrap();

let db = libdb::DatabaseBuilder::new()
    .environment(&env)
    .transaction(&txn)
    .db_type(libdb::DbType::BTree)
    .flags(libdb::DB_CREATE)
    .open()
    .unwrap();

txn.commit(libdb::CommitType::Inherit).expect("Commit failed!");

let mut key   = String::from("key").into_bytes();
let mut value = String::from("value").into_bytes();
db.put(None, key.as_mut_slice(), value.as_mut_slice(), libdb::DB_NONE).expect("Put failed!");

let result = db.get(None, key.as_mut_slice(), libdb::DB_NONE).unwrap();
println!("{:?}", result);

crev

此crate有作者自己的crev评审

建议始终使用 cargo-crev 来验证每个依赖项的可信度,包括此依赖项。

Berkeley DB 许可证声明

网站: http://www.oracle.com/database/berkeley-db/

许可证:Sleepycat

描述

The Berkeley Database (Berkeley DB) is a programmatic toolkit that
provides embedded database support for both traditional and
client/server applications. The Berkeley DB includes B+tree, Extended
Linear Hashing, Fixed and Variable-length record access methods,
transactions, locking, logging, shared memory caching, and database
recovery. The Berkeley DB supports C, C++, Java, and Perl APIs. It is
used by many applications, including Python and Perl, so this should
be installed on all systems.

依赖项

~31MB
~700K SLoC