mirror of
https://github.com/quickwit-oss/tantivy.git
synced 2026-01-06 01:02:55 +00:00
Added flush
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user