The future returned by `IndexWriter::merge` does not borrow `&mut self`
This commit is contained in:
Paul Masurel
2019-12-18 21:48:51 +09:00
parent 2b3fe3a2b5
commit f6000aece7
3 changed files with 11 additions and 3 deletions

View File

@@ -1,3 +1,7 @@
Tantivy 0.11.2
=======================
- The future returned by `IndexWriter::merge` does not borrow `self` mutably anymore (#732)
Tantivy 0.11.1
=====================
- Bug fix #729

View File

@@ -1,6 +1,6 @@
[package]
name = "tantivy"
version = "0.11.1"
version = "0.11.2"
authors = ["Paul Masurel <paul.masurel@gmail.com>"]
license = "MIT"
categories = ["database-implementations", "data-structures"]

View File

@@ -514,9 +514,13 @@ impl IndexWriter {
/// Merges a given list of segments
///
/// `segment_ids` is required to be non-empty.
pub async fn merge(&mut self, segment_ids: &[SegmentId]) -> crate::Result<SegmentMeta> {
pub fn merge(
&mut self,
segment_ids: &[SegmentId],
) -> impl Future<Output = crate::Result<SegmentMeta>> {
let merge_operation = self.segment_updater.make_merge_operation(segment_ids);
self.segment_updater.start_merge(merge_operation)?.await
let segment_updater = self.segment_updater.clone();
async move { segment_updater.start_merge(merge_operation)?.await }
}
/// Closes the current document channel send.