support parany parallel processing on zip files (#351)

This commit is contained in:
Rijnard van Tonder 2022-11-16 22:13:19 -08:00 committed by GitHub
parent 3e4dc0c960
commit 97034aaa4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,7 +11,7 @@ let process_interactive ~f paths number_of_workers =
let map path = path, f ~input:(Path path) ~path:(Some path) in
Parany.Parmap.parfold ~csize:16 number_of_workers map reduce init paths
let process ~f number_of_workers _bound_count sources =
let process ~f number_of_workers bound_count sources =
match sources with
| `Paths paths ->
Parany.Parmap.parfold
@ -21,4 +21,15 @@ let process ~f number_of_workers _bound_count sources =
( + )
0
paths
| `Zip _ -> failwith "Not supported"
| `Zip (zip_file, paths) ->
Parany.Parmap.parfold
~csize:16
number_of_workers
(fun path ->
Fold.with_zip zip_file ~f:(fun zip ->
Fold.zip_paths ~init:0 ~f zip [path] bound_count
)
)
( + )
0
paths