Make Executor public so Searcher::search_in_executor method now can be used (#769)

* Make Executor public so Searcher::search_in_executor method now can be used

* Fixed cargo fmt
This commit is contained in:
Alexander
2020-01-31 08:50:26 +02:00
committed by GitHub
parent 3ae6363462
commit 55f5658d40
2 changed files with 8 additions and 6 deletions

View File

@@ -10,7 +10,9 @@ use rayon::{ThreadPool, ThreadPoolBuilder};
/// API of a dependency, knowing it might conflict with a different version
/// used by the client. Second, we may stop using rayon in the future.
pub enum Executor {
/// Single thread variant of an Executor
SingleThread,
/// Thread pool variant of an Executor
ThreadPool(ThreadPool),
}
@@ -20,7 +22,7 @@ impl Executor {
Executor::SingleThread
}
// Creates an Executor that dispatches the tasks in a thread pool.
/// Creates an Executor that dispatches the tasks in a thread pool.
pub fn multi_thread(num_threads: usize, prefix: &'static str) -> Result<Executor> {
let pool = ThreadPoolBuilder::new()
.num_threads(num_threads)
@@ -29,10 +31,10 @@ impl Executor {
Ok(Executor::ThreadPool(pool))
}
// Perform a map in the thread pool.
//
// Regardless of the executor (`SingleThread` or `ThreadPool`), panics in the task
// will propagate to the caller.
/// Perform a map in the thread pool.
///
/// Regardless of the executor (`SingleThread` or `ThreadPool`), panics in the task
/// will propagate to the caller.
pub fn map<
A: Send,
R: Send,

View File

@@ -161,7 +161,7 @@ pub use self::snippet::{Snippet, SnippetGenerator};
mod docset;
pub use self::docset::{DocSet, SkipResult};
pub use crate::common::{f64_to_u64, i64_to_u64, u64_to_f64, u64_to_i64};
pub use crate::core::SegmentComponent;
pub use crate::core::{Executor, SegmentComponent};
pub use crate::core::{Index, IndexMeta, Searcher, Segment, SegmentId, SegmentMeta};
pub use crate::core::{InvertedIndexReader, SegmentReader};
pub use crate::directory::Directory;