##// END OF EJS Templates
rust: use crossbeam-channel crate directly...
Simon Sapin -
r46669:fd47483f default
parent child Browse files
Show More
@@ -101,19 +101,6 b' dependencies = ['
101 ]
101 ]
102
102
103 [[package]]
103 [[package]]
104 name = "crossbeam"
105 version = "0.7.3"
106 source = "registry+https://github.com/rust-lang/crates.io-index"
107 dependencies = [
108 "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
109 "crossbeam-channel 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
110 "crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
111 "crossbeam-epoch 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)",
112 "crossbeam-queue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)",
113 "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
114 ]
115
116 [[package]]
117 name = "crossbeam-channel"
104 name = "crossbeam-channel"
118 version = "0.4.4"
105 version = "0.4.4"
119 source = "registry+https://github.com/rust-lang/crates.io-index"
106 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -147,16 +134,6 b' dependencies = ['
147 ]
134 ]
148
135
149 [[package]]
136 [[package]]
150 name = "crossbeam-queue"
151 version = "0.2.3"
152 source = "registry+https://github.com/rust-lang/crates.io-index"
153 dependencies = [
154 "cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
155 "crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
156 "maybe-uninit 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
157 ]
158
159 [[package]]
160 name = "crossbeam-utils"
137 name = "crossbeam-utils"
161 version = "0.7.2"
138 version = "0.7.2"
162 source = "registry+https://github.com/rust-lang/crates.io-index"
139 source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -273,7 +250,7 b' version = "0.1.0"'
273 dependencies = [
250 dependencies = [
274 "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
251 "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
275 "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)",
252 "clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)",
276 "crossbeam 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)",
253 "crossbeam-channel 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)",
277 "flate2 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
254 "flate2 1.0.17 (registry+https://github.com/rust-lang/crates.io-index)",
278 "hex 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
255 "hex 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
279 "im-rc 15.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
256 "im-rc 15.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -902,11 +879,9 b' dependencies = ['
902 "checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
879 "checksum clap 2.33.3 (registry+https://github.com/rust-lang/crates.io-index)" = "37e58ac78573c40708d45522f0d80fa2f01cc4f9b4e2bf749807255454312002"
903 "checksum cpython 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bfaf3847ab963e40c4f6dd8d6be279bdf74007ae2413786a0dcbb28c52139a95"
880 "checksum cpython 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "bfaf3847ab963e40c4f6dd8d6be279bdf74007ae2413786a0dcbb28c52139a95"
904 "checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1"
881 "checksum crc32fast 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1"
905 "checksum crossbeam 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "69323bff1fb41c635347b8ead484a5ca6c3f11914d784170b158d8449ab07f8e"
906 "checksum crossbeam-channel 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87"
882 "checksum crossbeam-channel 0.4.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b153fe7cbef478c567df0f972e02e6d736db11affe43dfc9c56a9374d1adfb87"
907 "checksum crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285"
883 "checksum crossbeam-deque 0.7.3 (registry+https://github.com/rust-lang/crates.io-index)" = "9f02af974daeee82218205558e51ec8768b48cf524bd01d550abe5573a608285"
908 "checksum crossbeam-epoch 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace"
884 "checksum crossbeam-epoch 0.8.2 (registry+https://github.com/rust-lang/crates.io-index)" = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace"
909 "checksum crossbeam-queue 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570"
910 "checksum crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
885 "checksum crossbeam-utils 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8"
911 "checksum ctor 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "7fbaabec2c953050352311293be5c6aba8e141ba19d6811862b232d6fd020484"
886 "checksum ctor 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)" = "7fbaabec2c953050352311293be5c6aba8e141ba19d6811862b232d6fd020484"
912 "checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
887 "checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
@@ -21,7 +21,7 b' rayon = "1.3.0"'
21 regex = "1.3.9"
21 regex = "1.3.9"
22 twox-hash = "1.5.0"
22 twox-hash = "1.5.0"
23 same-file = "1.0.6"
23 same-file = "1.0.6"
24 crossbeam = "0.7.3"
24 crossbeam-channel = "0.4"
25 micro-timer = "0.3.0"
25 micro-timer = "0.3.0"
26 log = "0.4.8"
26 log = "0.4.8"
27 memmap = "0.7.0"
27 memmap = "0.7.0"
@@ -376,7 +376,7 b' where'
376 #[timed]
376 #[timed]
377 pub fn walk_explicit(
377 pub fn walk_explicit(
378 &self,
378 &self,
379 traversed_sender: crossbeam::Sender<HgPathBuf>,
379 traversed_sender: crossbeam_channel::Sender<HgPathBuf>,
380 ) -> (Vec<DispatchedPath<'a>>, Vec<DispatchedPath<'a>>) {
380 ) -> (Vec<DispatchedPath<'a>>, Vec<DispatchedPath<'a>>) {
381 self.matcher
381 self.matcher
382 .file_set()
382 .file_set()
@@ -474,13 +474,13 b' where'
474 path: impl AsRef<HgPath>,
474 path: impl AsRef<HgPath>,
475 old_results: &FastHashMap<HgPathCow<'a>, Dispatch>,
475 old_results: &FastHashMap<HgPathCow<'a>, Dispatch>,
476 results: &mut Vec<DispatchedPath<'a>>,
476 results: &mut Vec<DispatchedPath<'a>>,
477 traversed_sender: crossbeam::Sender<HgPathBuf>,
477 traversed_sender: crossbeam_channel::Sender<HgPathBuf>,
478 ) {
478 ) {
479 // The traversal is done in parallel, so use a channel to gather
479 // The traversal is done in parallel, so use a channel to gather
480 // entries. `crossbeam::Sender` is `Sync`, while `mpsc::Sender`
480 // entries. `crossbeam_channel::Sender` is `Sync`, while `mpsc::Sender`
481 // is not.
481 // is not.
482 let (files_transmitter, files_receiver) =
482 let (files_transmitter, files_receiver) =
483 crossbeam::channel::unbounded();
483 crossbeam_channel::unbounded();
484
484
485 self.traverse_dir(
485 self.traverse_dir(
486 &files_transmitter,
486 &files_transmitter,
@@ -506,11 +506,11 b' where'
506 fn handle_traversed_entry<'b>(
506 fn handle_traversed_entry<'b>(
507 &'a self,
507 &'a self,
508 scope: &rayon::Scope<'b>,
508 scope: &rayon::Scope<'b>,
509 files_sender: &'b crossbeam::Sender<(HgPathBuf, Dispatch)>,
509 files_sender: &'b crossbeam_channel::Sender<(HgPathBuf, Dispatch)>,
510 old_results: &'a FastHashMap<Cow<HgPath>, Dispatch>,
510 old_results: &'a FastHashMap<Cow<HgPath>, Dispatch>,
511 filename: HgPathBuf,
511 filename: HgPathBuf,
512 dir_entry: DirEntry,
512 dir_entry: DirEntry,
513 traversed_sender: crossbeam::Sender<HgPathBuf>,
513 traversed_sender: crossbeam_channel::Sender<HgPathBuf>,
514 ) -> IoResult<()>
514 ) -> IoResult<()>
515 where
515 where
516 'a: 'b,
516 'a: 'b,
@@ -592,11 +592,11 b' where'
592 fn handle_traversed_dir<'b>(
592 fn handle_traversed_dir<'b>(
593 &'a self,
593 &'a self,
594 scope: &rayon::Scope<'b>,
594 scope: &rayon::Scope<'b>,
595 files_sender: &'b crossbeam::Sender<(HgPathBuf, Dispatch)>,
595 files_sender: &'b crossbeam_channel::Sender<(HgPathBuf, Dispatch)>,
596 old_results: &'a FastHashMap<Cow<HgPath>, Dispatch>,
596 old_results: &'a FastHashMap<Cow<HgPath>, Dispatch>,
597 entry_option: Option<&'a DirstateEntry>,
597 entry_option: Option<&'a DirstateEntry>,
598 directory: HgPathBuf,
598 directory: HgPathBuf,
599 traversed_sender: crossbeam::Sender<HgPathBuf>,
599 traversed_sender: crossbeam_channel::Sender<HgPathBuf>,
600 ) where
600 ) where
601 'a: 'b,
601 'a: 'b,
602 {
602 {
@@ -631,10 +631,10 b' where'
631 /// entries in a separate thread.
631 /// entries in a separate thread.
632 fn traverse_dir(
632 fn traverse_dir(
633 &self,
633 &self,
634 files_sender: &crossbeam::Sender<(HgPathBuf, Dispatch)>,
634 files_sender: &crossbeam_channel::Sender<(HgPathBuf, Dispatch)>,
635 directory: impl AsRef<HgPath>,
635 directory: impl AsRef<HgPath>,
636 old_results: &FastHashMap<Cow<HgPath>, Dispatch>,
636 old_results: &FastHashMap<Cow<HgPath>, Dispatch>,
637 traversed_sender: crossbeam::Sender<HgPathBuf>,
637 traversed_sender: crossbeam_channel::Sender<HgPathBuf>,
638 ) {
638 ) {
639 let directory = directory.as_ref();
639 let directory = directory.as_ref();
640
640
@@ -18,7 +18,7 b" pub type LookupAndStatus<'a> = (Vec<HgPa"
18 impl<'a, M: Matcher + Sync> Status<'a, M> {
18 impl<'a, M: Matcher + Sync> Status<'a, M> {
19 pub(crate) fn run(&self) -> Result<LookupAndStatus<'a>, StatusError> {
19 pub(crate) fn run(&self) -> Result<LookupAndStatus<'a>, StatusError> {
20 let (traversed_sender, traversed_receiver) =
20 let (traversed_sender, traversed_receiver) =
21 crossbeam::channel::unbounded();
21 crossbeam_channel::unbounded();
22
22
23 // Step 1: check the files explicitly mentioned by the user
23 // Step 1: check the files explicitly mentioned by the user
24 let (work, mut results) = self.walk_explicit(traversed_sender.clone());
24 let (work, mut results) = self.walk_explicit(traversed_sender.clone());
@@ -77,7 +77,7 b" impl<'a, M: Matcher + Sync> Status<'a, M"
77 impl<'a, M: Matcher + Sync> Status<'a, M> {
77 impl<'a, M: Matcher + Sync> Status<'a, M> {
78 pub(crate) fn run(&self) -> Result<LookupAndStatus<'a>, StatusError> {
78 pub(crate) fn run(&self) -> Result<LookupAndStatus<'a>, StatusError> {
79 let (traversed_sender, traversed_receiver) =
79 let (traversed_sender, traversed_receiver) =
80 crossbeam::channel::unbounded();
80 crossbeam_channel::unbounded();
81
81
82 // Step 1: check the files explicitly mentioned by the user
82 // Step 1: check the files explicitly mentioned by the user
83 let (work, mut results) = self.walk_explicit(traversed_sender.clone());
83 let (work, mut results) = self.walk_explicit(traversed_sender.clone());
General Comments 0
You need to be logged in to leave comments. Login now