add some more ffi support, update README

master
Tyler Neely 10 years ago
parent 14a68671e7
commit 2eb2710d9b
  1. 7
      README.md
  2. 33
      src/ffi.rs

@ -116,13 +116,12 @@ fn tuned_for_somebody_elses_disk() -> RocksDB {
- [x] compaction filter, style - [x] compaction filter, style
- [x] LRU cache - [x] LRU cache
- [x] destroy/repair - [x] destroy/repair
- [ ] batch
- [ ] iterator
- [ ] range
- [ ] create/release snapshot - [ ] create/release snapshot
- [ ] iterator
- [ ] column family operations - [ ] column family operations
- [ ] write batch
- [ ] comparator - [ ] comparator
- [ ] slicetransform - [ ] slicetransform
- [ ] windows support - [ ] windows support
Feedback and pull requests welcome! Feedback and pull requests welcome! If a particular feature of RocksDB is important to you, please let me know by opening an issue, and I'll prioritize it.

@ -35,6 +35,10 @@ pub struct RocksDBCache(pub *const c_void);
pub struct RocksDBFilterPolicy(pub *const c_void); pub struct RocksDBFilterPolicy(pub *const c_void);
#[repr(C)] #[repr(C)]
pub struct RocksDBSnapshot(pub *const c_void); pub struct RocksDBSnapshot(pub *const c_void);
#[repr(C)]
pub struct RocksDBIterator(pub *const c_void);
#[repr(C)]
pub struct RocksDBCFHandle(pub *const c_void);
impl Copy for RocksDBOptions {} impl Copy for RocksDBOptions {}
impl Copy for RocksDBInstance {} impl Copy for RocksDBInstance {}
@ -48,6 +52,8 @@ impl Copy for RocksDBCompactionStyle {}
impl Copy for RocksDBCompressionType {} impl Copy for RocksDBCompressionType {}
impl Copy for RocksDBUniversalCompactionStyle {} impl Copy for RocksDBUniversalCompactionStyle {}
impl Copy for RocksDBSnapshot {} impl Copy for RocksDBSnapshot {}
impl Copy for RocksDBIterator {}
impl Copy for RocksDBCFHandle {}
pub fn new_bloom_filter(bits: c_int) -> RocksDBFilterPolicy { pub fn new_bloom_filter(bits: c_int) -> RocksDBFilterPolicy {
unsafe { unsafe {
@ -181,12 +187,32 @@ extern {
v: *const u8, vLen: size_t, v: *const u8, vLen: size_t,
err: *mut i8); err: *mut i8);
pub fn rocksdb_readoptions_create() -> RocksDBReadOptions; pub fn rocksdb_readoptions_create() -> RocksDBReadOptions;
pub fn rocksdb_readoptions_set_snapshot(read_opts: RocksDBReadOptions,
snapshot: RocksDBSnapshot);
pub fn rocksdb_get(db: RocksDBInstance, pub fn rocksdb_get(db: RocksDBInstance,
readopts: RocksDBReadOptions, readopts: RocksDBReadOptions,
k: *const u8, kLen: size_t, k: *const u8, kLen: size_t,
valLen: *const size_t, valLen: *const size_t,
err: *mut i8 err: *mut i8
) -> *mut c_void; ) -> *mut c_void;
pub fn rocksdb_get_cf(db: RocksDBInstance,
readopts: RocksDBReadOptions,
cf_handle: RocksDBCFHandle,
k: *const u8, kLen: size_t,
valLen: *const size_t,
err: *mut i8
) -> *mut c_void;
pub fn rocksdb_create_iterator(db: RocksDBInstance,
readopts: RocksDBReadOptions
) -> RocksDBIterator;
pub fn rocksdb_create_iterator_cf(db: RocksDBInstance,
readopts: RocksDBReadOptions,
cf_handle: RocksDBCFHandle
) -> RocksDBIterator;
pub fn rocksdb_create_snapshot(db: RocksDBInstance) -> RocksDBSnapshot;
pub fn rocksdb_release_snapshot(db: RocksDBInstance,
snapshot: RocksDBSnapshot);
pub fn rocksdb_delete(db: RocksDBInstance, pub fn rocksdb_delete(db: RocksDBInstance,
writeopts: RocksDBWriteOptions, writeopts: RocksDBWriteOptions,
k: *const u8, kLen: size_t, k: *const u8, kLen: size_t,
@ -231,13 +257,6 @@ extern {
pub fn rocksdb_mergeoperator_destroy(mo: RocksDBMergeOperator); pub fn rocksdb_mergeoperator_destroy(mo: RocksDBMergeOperator);
pub fn rocksdb_options_set_merge_operator(options: RocksDBOptions, pub fn rocksdb_options_set_merge_operator(options: RocksDBOptions,
mo: RocksDBMergeOperator); mo: RocksDBMergeOperator);
// Snapshot
pub fn rocksdb_create_snapshot(db: RocksDBInstance) -> RocksDBSnapshot;
pub fn rocksdb_readoptions_set_snapshot(read_opts: RocksDBReadOptions,
snapshot: RocksDBSnapshot);
pub fn rocksdb_release_snapshot(db: RocksDBInstance,
snapshot: RocksDBSnapshot);
} }
#[allow(dead_code)] #[allow(dead_code)]

Loading…
Cancel
Save