Module markov.common.markov_queue.queue_wrapper
Classes
class QueueWrapper
-
Interface around operations for a queue like put, get, get_batch etc.
Ancestors
- abc.ABC
Subclasses
Methods
def delete(self) ‑> None
-
Delete any intermediary files/folders/databases to implement the queue
Note: Keep this No-op if intermediate file/folder/database was created
def get(self) ‑> Any
-
Returns
Returns first element from the front of the queue
def get_all(self) ‑> List[Any]
-
Gets all the elements from the queue.
Returns
A list of all elements in the queue
def get_batch(self, batch_size: int) ‑> List[Any]
-
Returns a list of size batch_size from the front of the queue. If number of elements in queue is less than batch_size, then it will return all elements
Args
batch_size
- number of elements to be retrieved
Returns
A list of atmost size batch_size from the front of the queue
def put(self, item: Any) ‑> None
-
Inserts the given element to the rear of the queue.
Args
item
- Any element that needs to be inserted into the queue.