Commit 6ed627f2 authored by Cholerae Hu's avatar Cholerae Hu Committed by GitHub

ingestoption: fix (#98)

parent e28c5fe9
...@@ -985,41 +985,37 @@ impl IngestExternalFileOptions { ...@@ -985,41 +985,37 @@ impl IngestExternalFileOptions {
/// If set to false, an ingested file keys could appear in existing snapshots /// If set to false, an ingested file keys could appear in existing snapshots
/// that where created before the file was ingested. /// that where created before the file was ingested.
pub fn snapshot_consistent(self, whether_consistent: bool) -> IngestExternalFileOptions { pub fn snapshot_consistent(&mut self, whether_consistent: bool) {
unsafe { unsafe {
crocksdb_ffi::crocksdb_ingestexternalfileoptions_set_snapshot_consistency( crocksdb_ffi::crocksdb_ingestexternalfileoptions_set_snapshot_consistency(
self.inner, whether_consistent); self.inner, whether_consistent);
} }
self
} }
/// If set to false, DB::ingest_external_file() will fail if the file key range /// If set to false, DB::ingest_external_file() will fail if the file key range
/// overlaps with existing keys or tombstones in the DB. /// overlaps with existing keys or tombstones in the DB.
pub fn allow_global_seqno(self, whether_allow: bool) -> IngestExternalFileOptions { pub fn allow_global_seqno(&mut self, whether_allow: bool) {
unsafe { unsafe {
crocksdb_ffi::crocksdb_ingestexternalfileoptions_set_allow_global_seqno(self.inner, crocksdb_ffi::crocksdb_ingestexternalfileoptions_set_allow_global_seqno(self.inner,
whether_allow); whether_allow);
} }
self
} }
/// If set to false and the file key range overlaps with the memtable key range /// If set to false and the file key range overlaps with the memtable key range
/// (memtable flush required), DB::ingest_external_file will fail. /// (memtable flush required), DB::ingest_external_file will fail.
pub fn allow_blocking_flush(self, whether_allow: bool) -> IngestExternalFileOptions { pub fn allow_blocking_flush(&mut self, whether_allow: bool) {
unsafe { unsafe {
crocksdb_ffi::crocksdb_ingestexternalfileoptions_set_allow_blocking_flush(self.inner, crocksdb_ffi::crocksdb_ingestexternalfileoptions_set_allow_blocking_flush(self.inner,
whether_allow); whether_allow);
} }
self
} }
/// Set to true to move the files instead of copying them. /// Set to true to move the files instead of copying them.
pub fn move_files(self, whether_move: bool) -> IngestExternalFileOptions { pub fn move_files(&mut self, whether_move: bool) {
unsafe { unsafe {
crocksdb_ffi::crocksdb_ingestexternalfileoptions_set_move_files(self.inner, crocksdb_ffi::crocksdb_ingestexternalfileoptions_set_move_files(self.inner,
whether_move); whether_move);
} }
self
} }
} }
......
...@@ -76,7 +76,7 @@ fn test_ingest_external_file() { ...@@ -76,7 +76,7 @@ fn test_ingest_external_file() {
None, None,
test_sstfile_str, test_sstfile_str,
&[(b"k2", b"v5"), (b"k3", b"v6")]); &[(b"k2", b"v5"), (b"k3", b"v6")]);
ingest_opt = ingest_opt.move_files(true); ingest_opt.move_files(true);
db.ingest_external_file_cf(handle, &ingest_opt, &[test_sstfile_str]) db.ingest_external_file_cf(handle, &ingest_opt, &[test_sstfile_str])
.unwrap(); .unwrap();
......
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