Exposes Sled flush operation

Required to materialize changes on some platforms (Android, Windows...)

Bug #99
pull/100/head
Tpt 3 years ago
parent b24bcf52ac
commit dbe0465cf1
  1. 22
      lib/src/store/sled.rs

@ -664,6 +664,28 @@ impl SledStore {
(&mut this).clear() (&mut this).clear()
} }
/// Flushes all buffers and ensures that all writes are saved on disk.
///
/// Flushes are automatically done for most platform using background threads.
/// However, calling this method explicitly is still required for Windows and Android.
///
/// An [async version](SledStore::flush_async) is also available.
pub fn flush(&self) -> Result<(), io::Error> {
self.default.flush()?;
Ok(())
}
/// Asynchronously flushes all buffers and ensures that all writes are saved on disk.
///
/// Flushes are automatically done for most platform using background threads.
/// However, calling this method explicitly is still required for Windows and Android.
///
/// A [sync version](SledStore::flush) is also available.
pub async fn flush_async(&self) -> Result<(), io::Error> {
self.default.flush_async().await?;
Ok(())
}
fn contains_encoded(&self, quad: &EncodedQuad) -> Result<bool, io::Error> { fn contains_encoded(&self, quad: &EncodedQuad) -> Result<bool, io::Error> {
let mut buffer = Vec::with_capacity(4 * WRITTEN_TERM_MAX_SIZE); let mut buffer = Vec::with_capacity(4 * WRITTEN_TERM_MAX_SIZE);
if quad.graph_name.is_default_graph() { if quad.graph_name.is_default_graph() {

Loading…
Cancel
Save