diff --git a/src/db.rs b/src/db.rs index 6ec9f0c..b40140d 100644 --- a/src/db.rs +++ b/src/db.rs @@ -1167,12 +1167,38 @@ impl DB { } } + pub fn property_value_cf(&self, column_family: ColumnFamily, name: &str) -> Option { + let prop_name = CString::new(name).unwrap(); + unsafe { + let value = ffi::rocksdb_property_value_cf( + self.inner, + column_family.inner, + prop_name.as_ptr() + ); + + if value.is_null() { + return None; + } + + let s = CStr::from_ptr(value).to_str().unwrap().to_owned(); + libc::free(value as *mut c_void); + Some(s) + } + } + pub fn property_int_value(&self, name: &str) -> Option { match self.property_value(name) { Some(value) => value.parse::().ok(), None => None, } } + + pub fn property_int_value_cf(&self, column_family: ColumnFamily, name: &str) -> Option { + match self.property_value_cf(column_family, name) { + Some(value) => value.parse::().ok(), + None => None, + } + } } impl WriteBatch {