Mercurial > lbo > hg > leveldb-rs
changeset 369:ccc31e0b4c50
db_impl: Simplify DB::delete()
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Sun, 08 Oct 2017 13:51:34 +0200 |
parents | 1dc6ed532dae |
children | ffd09df174ba |
files | src/db_impl.rs src/db_iter.rs |
diffstat | 2 files changed, 7 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/db_impl.rs Sun Oct 08 13:07:14 2017 +0200 +++ b/src/db_impl.rs Sun Oct 08 13:51:34 2017 +0200 @@ -354,10 +354,10 @@ } /// delete deletes a single entry. - pub fn delete(&mut self, k: &[u8], sync: bool) -> Result<()> { + pub fn delete(&mut self, k: &[u8]) -> Result<()> { let mut wb = WriteBatch::new(); wb.delete(k); - self.write(wb, sync) + self.write(wb, false) } /// write writes an entire WriteBatch. sync determines whether the write should be flushed to @@ -1271,8 +1271,8 @@ assert!(db.get(b"gaa").is_some()); // Delete one memtable entry and one table entry. - db.delete(b"xyy", true).unwrap(); - db.delete(b"gaa", true).unwrap(); + db.delete(b"xyy").unwrap(); + db.delete(b"gaa").unwrap(); assert!(db.get(b"xyy").is_none()); assert!(db.get(b"gaa").is_none()); @@ -1418,7 +1418,7 @@ db.put(b"xx2", b"112").unwrap(); db.put(b"xx3", b"113").unwrap(); db.put(b"xx4", b"114").unwrap(); - db.delete(b"xx2", false).unwrap(); + db.delete(b"xx2").unwrap(); } {
--- a/src/db_iter.rs Sun Oct 08 13:07:14 2017 +0200 +++ b/src/db_iter.rs Sun Oct 08 13:51:34 2017 +0200 @@ -400,7 +400,7 @@ let mut db = build_db().0; db.put(b"xyz", b"123").unwrap(); - db.delete(b"xyz", true).unwrap(); + db.delete(b"xyz").unwrap(); let mut iter = db.new_iter().unwrap(); let must_not_appear = b"xyz"; @@ -421,7 +421,7 @@ db.put(b"xx2", b"112").unwrap(); db.put(b"xx3", b"113").unwrap(); db.put(b"xx4", b"114").unwrap(); - db.delete(b"xx2", false).unwrap(); + db.delete(b"xx2").unwrap(); } {