Mercurial > lbo > hg > leveldb-rs
changeset 356:7c04cea08ac9
db_impl: Export get and write methods
author | Lewin Bormann <lbo@spheniscida.de> |
---|---|
date | Thu, 05 Oct 2017 20:05:10 +0200 |
parents | e4e4662f047a |
children | 91efbe833512 |
files | src/db_impl.rs |
diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/src/db_impl.rs Thu Oct 05 20:02:49 2017 +0200 +++ b/src/db_impl.rs Thu Oct 05 20:05:10 2017 +0200 @@ -347,14 +347,14 @@ // WRITE // /// put adds a single entry. - fn put(&mut self, k: &[u8], v: &[u8]) -> Result<()> { + pub fn put(&mut self, k: &[u8], v: &[u8]) -> Result<()> { let mut wb = WriteBatch::new(); wb.put(k, v); self.write(wb, false) } /// delete deletes a single entry. - fn delete(&mut self, k: &[u8], sync: bool) -> Result<()> { + pub fn delete(&mut self, k: &[u8], sync: bool) -> Result<()> { let mut wb = WriteBatch::new(); wb.delete(k); self.write(wb, sync) @@ -362,7 +362,7 @@ /// write writes an entire WriteBatch. sync determines whether the write should be flushed to /// disk. - fn write(&mut self, batch: WriteBatch, sync: bool) -> Result<()> { + pub fn write(&mut self, batch: WriteBatch, sync: bool) -> Result<()> { assert!(self.log.is_some()); let entries = batch.count() as u64; let log = self.log.as_mut().unwrap(); @@ -378,7 +378,7 @@ } /// flush makes sure that all pending changes (e.g. from put()) are stored on disk. - fn flush(&mut self) -> Result<()> { + pub fn flush(&mut self) -> Result<()> { assert!(self.log.is_some()); self.log.as_mut().unwrap().flush() }