From 3359a9640bff4fc5b11e8b93d136c1f88532fb95 Mon Sep 17 00:00:00 2001 From: Jylpah Date: Sun, 24 Mar 2024 18:59:03 +0200 Subject: [PATCH] Update README.md --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e4f424d..a4d2426 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Queutils *[Queue Utils]* is a package of handy Python queue classes: # AsyncQueue [`AsyncQueue`](docs/asyncqueue.md) is a async wrapper for non-async `queue.Queue`. It can be used to create -an `asyncio.Queue` compatible out of a (non-async) `multiprocessing.Queue`. This is handy to have `async` code running in `multiprocessing` processes and yet be able to communicate with the parent via (non-async) managed `multiprocessing.Queue` queue. +an `asyncio.Queue` compatible interface to a (non-async) managed `multiprocessing.Queue` and thus enable `async` code in parent/child processes to communicate over `multiprocessing.Queue` as it were an `asyncio.Queue`. ## Features @@ -25,6 +25,12 @@ an `asyncio.Queue` compatible out of a (non-async) `multiprocessing.Queue`. This [`IterableQueue`](docs/iterablequeue.md) is an `asyncio.Queue` subclass that is `AsyncIterable[T]` i.e. it can be iterated in `async for` loop. `IterableQueue` terminates automatically when the queue has been filled and emptied. + +The `IterableQueue` requires "producers" (functions addinng items to the queue) to register themselves and it +keeps count of registers who are "finished" adding items to the queue. Once all the registered producers are +"finished", the queue enters into "filled" state and no new items can be added anymore. Once an +"filled" queue is emptied, the queue becomes "done" and all new attempts to `get()` and item will +`raise QueueDone` exception. ## Features @@ -39,7 +45,9 @@ iterated in `async for` loop. `IterableQueue` terminates automatically when the # FileQueue -[`FileQueue`](docs/filequeue.md) builds a queue (`IterableQueue[pathlib.Path]`) of the matching files found based on search parameters given. It can search both list of files or directories or mixed. Async method `FileQueue.mk_queue()` searches subdirectories of given directories. +[`FileQueue`](docs/filequeue.md) builds a queue (`IterableQueue[pathlib.Path]`) of the matching +files found based on search parameters given. It can search both list of files or directories or +mixed. Async method `FileQueue.mk_queue()` searches subdirectories of given directories. ## Features