cut version 0.6.0

master
Tyler Neely 8 years ago
parent 253ce55b47
commit 2a29b0ae5f
  1. 13
      CHANGELOG.txt
  2. 4
      Cargo.toml
  3. 2
      README.md
  4. 2
      librocksdb-sys/Cargo.toml
  5. 45
      src/compaction_filter.rs
  6. 8
      src/db.rs
  7. 7
      src/db_options.rs
  8. 2
      src/ffi_util.rs

@ -1,16 +1,23 @@
Changelog
=========
0.6 (in development)
0.7 (in development)
~~~~~~~~~~~~~~~~~~~~
**Breaking changes**
0.6 (2016-12-18)
~~~~~~~~~~~~~~~~~~~~
**Breaking changes**
* Comparator function now returns an Ordering (alexreg)
**New features**
* Compaction filter (tmccombs)
* Support for backups (alexreg)
0.5 (2016-11-20)
~~~~~~~~~~~~~~~~
**Breaking changes**
**Breaking changes**
* No more Writable trait, as WriteBatch is not thread-safe as a DB (spacejam)
* All imports of `rocksdb::rocksdb::*` should now be simply `rocksdb::*` (alexreg)

@ -1,7 +1,7 @@
[package]
name = "rocksdb"
description = "Rust wrapper for Facebook's RocksDB embeddable database"
version = "0.5.0"
version = "0.6.0"
authors = ["Tyler Neely <t@jujit.su>", "David Greenberg <dsg123456789@gmail.com>"]
license = "Apache-2.0"
keywords = ["database", "embedded", "LSM-tree", "persistence"]
@ -23,4 +23,4 @@ path = "test/test.rs"
[dependencies]
libc = "0.2"
librocksdb-sys = { path = "librocksdb-sys", version = "0.4.0" }
librocksdb-sys = { path = "librocksdb-sys", version = "0.4.1" }

@ -9,5 +9,5 @@ Feedback and pull requests welcome! If a particular feature of RocksDB is impor
```rust
[dependencies]
rocksdb = "0.5.0"
rocksdb = "0.6.0"
```

@ -1,6 +1,6 @@
[package]
name = "librocksdb-sys"
version = "0.4.0"
version = "0.4.1"
authors = ["Karl Hobley <karlhobley10@gmail.com>", "Arkadiy Paronyan <arkadiy@ethcore.io>"]
license = "MIT/Apache-2.0/BSD-3-Clause"
description = "Native bindings to librocksdb"

@ -29,7 +29,7 @@ pub enum Decision {
/// Remove the object from the database
Remove,
/// Change the value for the key
Change(&'static [u8])
Change(&'static [u8]),
}
@ -42,31 +42,44 @@ pub enum Decision {
///
/// [set_compaction_filter]: ../struct.Options.html#method.set_compaction_filter
pub trait CompactionFilterFn: FnMut(u32, &[u8], &[u8]) -> Decision {}
impl<F> CompactionFilterFn for F where F: FnMut(u32, &[u8], &[u8]) -> Decision, F: Send + 'static {}
impl<F> CompactionFilterFn for F
where F: FnMut(u32, &[u8], &[u8]) -> Decision,
F: Send + 'static
{
}
pub struct CompactionFilterCallback<F> where F: CompactionFilterFn {
pub struct CompactionFilterCallback<F>
where F: CompactionFilterFn
{
pub name: CString,
pub filter_fn: F
pub filter_fn: F,
}
pub unsafe extern "C" fn destructor_callback<F>(raw_cb: *mut c_void) where F: CompactionFilterFn {
pub unsafe extern "C" fn destructor_callback<F>(raw_cb: *mut c_void)
where F: CompactionFilterFn
{
let _: Box<CompactionFilterCallback<F>> = mem::transmute(raw_cb);
}
pub unsafe extern "C" fn name_callback<F>(raw_cb: *mut c_void) -> *const c_char where F: CompactionFilterFn {
pub unsafe extern "C" fn name_callback<F>(raw_cb: *mut c_void) -> *const c_char
where F: CompactionFilterFn
{
let cb = &*(raw_cb as *mut CompactionFilterCallback<F>);
cb.name.as_ptr()
}
pub unsafe extern "C" fn filter_callback<F>(raw_cb: *mut c_void,
level: c_int,
raw_key: *const c_char,
key_length: size_t,
existing_value: *const c_char,
value_length: size_t,
new_value: *mut *mut c_char,
new_value_length: *mut size_t,
value_changed: *mut c_uchar) -> c_uchar where F: CompactionFilterFn {
level: c_int,
raw_key: *const c_char,
key_length: size_t,
existing_value: *const c_char,
value_length: size_t,
new_value: *mut *mut c_char,
new_value_length: *mut size_t,
value_changed: *mut c_uchar)
-> c_uchar
where F: CompactionFilterFn
{
use self::Decision::*;
let cb = &mut *(raw_cb as *mut CompactionFilterCallback<F>);
@ -92,7 +105,7 @@ fn test_filter(level: u32, key: &[u8], value: &[u8]) -> Decision {
match key.first() {
Some(&b'_') => Remove,
Some(&b'%') => Change(b"secret"),
_ => Keep
_ => Keep,
}
}
@ -116,5 +129,3 @@ fn compaction_filter_test() {
}
}

@ -676,16 +676,14 @@ impl DB {
self.delete_cf_opt(cf, key, &WriteOptions::default())
}
pub fn compact_range(&self,
start: Option<&[u8]>,
end: Option<&[u8]>) {
pub fn compact_range(&self, start: Option<&[u8]>, end: Option<&[u8]>) {
unsafe {
ffi::rocksdb_compact_range(self.inner,
opt_bytes_to_ptr(start),
start.map_or(0, |s| s.len()) as size_t,
opt_bytes_to_ptr(end),
end.map_or(0, |e| e.len()) as size_t);
}
}
}
pub fn compact_range_cf(&self,
@ -699,7 +697,7 @@ impl DB {
start.map_or(0, |s| s.len()) as size_t,
opt_bytes_to_ptr(end),
end.map_or(0, |e| e.len()) as size_t);
}
}
}
}

@ -22,8 +22,7 @@ use ffi;
use libc::{self, c_int, c_uchar, c_uint, c_void, size_t, uint64_t};
use merge_operator::{self, MergeFn, MergeOperatorCallback, full_merge_callback,
partial_merge_callback};
use compaction_filter::{self, CompactionFilterFn, CompactionFilterCallback,
filter_callback};
use compaction_filter::{self, CompactionFilterCallback, CompactionFilterFn, filter_callback};
use std::ffi::{CStr, CString};
use std::mem;
@ -230,7 +229,9 @@ impl Options {
///
/// If multi-threaded compaction is used, `filter_fn` may be called multiple times
/// simultaneously.
pub fn set_compaction_filter<F>(&mut self, name: &str, filter_fn: F) where F: CompactionFilterFn + Send + 'static {
pub fn set_compaction_filter<F>(&mut self, name: &str, filter_fn: F)
where F: CompactionFilterFn + Send + 'static
{
let cb = Box::new(CompactionFilterCallback {
name: CString::new(name.as_bytes()).unwrap(),
filter_fn: filter_fn,

@ -29,7 +29,7 @@ pub fn error_message(ptr: *const c_char) -> String {
pub fn opt_bytes_to_ptr(opt: Option<&[u8]>) -> *const c_char {
match opt {
Some(v) => v.as_ptr() as *const c_char,
None => ptr::null()
None => ptr::null(),
}
}

Loading…
Cancel
Save