Commit 43393ed5 authored by zhangjinpeng1987's avatar zhangjinpeng1987 Committed by Huachao Huang

get env from DB (#252)

Signed-off-by: 's avatarzhangjinpeng1987 <zhangjinpeng@pingcap.com>
parent 6ec6c6db
...@@ -31,6 +31,7 @@ use std::io; ...@@ -31,6 +31,7 @@ use std::io;
use std::ops::Deref; use std::ops::Deref;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::str::from_utf8; use std::str::from_utf8;
use std::sync::Arc;
use std::{fs, ptr, slice}; use std::{fs, ptr, slice};
use table_properties::TablePropertiesCollection; use table_properties::TablePropertiesCollection;
...@@ -602,6 +603,10 @@ impl DB { ...@@ -602,6 +603,10 @@ impl DB {
Ok(cfs) Ok(cfs)
} }
pub fn env(&self) -> Option<Arc<Env>> {
self.opts.env()
}
pub fn pause_bg_work(&self) { pub fn pause_bg_work(&self) {
unsafe { unsafe {
crocksdb_ffi::crocksdb_pause_bg_work(self.inner); crocksdb_ffi::crocksdb_pause_bg_work(self.inner);
...@@ -2262,7 +2267,6 @@ mod test { ...@@ -2262,7 +2267,6 @@ mod test {
use std::path::Path; use std::path::Path;
use std::str; use std::str;
use std::string::String; use std::string::String;
use std::sync::*;
use std::thread; use std::thread;
use tempdir::TempDir; use tempdir::TempDir;
......
...@@ -589,6 +589,10 @@ impl DBOptions { ...@@ -589,6 +589,10 @@ impl DBOptions {
DBOptions::default() DBOptions::default()
} }
pub fn env(&self) -> Option<Arc<Env>> {
self.env.clone()
}
pub unsafe fn from_raw(inner: *mut Options) -> DBOptions { pub unsafe fn from_raw(inner: *mut Options) -> DBOptions {
DBOptions { DBOptions {
inner: inner, inner: inner,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment