system.queues.external_queues module

Disk-backed external queue implementation.

class system.queues.external_queues.ExternalQueue(memory_limit: int = 10000)[source]

Bases: ReadWriteQueue, Generic

ExternalQueue is a disk-backed read-write queue that buffers elements in memory and spills to a temporary file once the buffer is full.

reset() → None[source]

Resets the queue to the initial state.

pop() → ObjectType[source]

Not supported by this disk-backed queue: always raises NotImplementedError.

insert(entry: ObjectType) → None[source]

Inserts an entry into the queue

Parameters:

entry – The entry to insert into the queue.

flush() → int[source]

Flushes the buffer to the file, i.e. writes the contents of the buffer to the file and empty the buffer.

close() → None[source]

Closes the temporary file backing the queue. This will also delete that file.

size() → int[source]

Returns the number of elements inserted into this queue so far