Added flush

This commit is contained in:
Paul Masurel
2019-04-04 09:36:06 +09:00
parent 95db5d9999
commit fac0013454
2 changed files with 11 additions and 1 deletions

View File

@@ -205,6 +205,14 @@ pub trait Directory: DirectoryClone + fmt::Debug + Send + Sync + 'static {
/// `OnCommit` `ReloadPolicy`. Not implementing watch in a `Directory` only prevents the
/// `OnCommit` `ReloadPolicy` to work properly.
fn watch(&self, watch_callback: WatchCallback) -> WatchHandle;
/// Ensure that all volatile files reach are persisted (in directory where that makes sense.)
///
/// In order to make Near Real Time efficient, tantivy introduced the notion of soft_commit vs
/// commit. Commit will call `.flush()`, while softcommit won't.
fn flush(&self) -> io::Result<()> {
Ok(())
}
}
/// DirectoryClone

View File

@@ -296,14 +296,16 @@ impl SegmentUpdater {
// segment. However, we do not want to mark them as committed, and we want
// to keep the current set of committed segment.
segment_updater.0.segment_manager.soft_commit(opstamp, segment_entries);
// ... obviously we do not save the meta file.
// ... We do not save the meta file.
} else {
// Hard_commit. We register the new segment entries as committed.
segment_updater
.0
.segment_manager
.commit(opstamp, segment_entries);
// TODO error handling.
segment_updater.save_metas(opstamp, payload);
segment_updater.0.index.directory().flush().unwrap();
}
segment_updater.garbage_collect_files_exec();
segment_updater.consider_merge_options();