src.registry module

The Registry class is used to keep track of the entities processed by the Crawler’s producers and consumers.

class src.registry.Registry(event_bus: EventBus, max: int = 100)

Bases: object

exception RegistryFullException

Bases: Exception

Indicates that the registry is full. Better to have this in registry.exceptions, but for simplicity’s sake…

add(item: Any) bool

Adds an item to the underlying registry container.

Parameters:

item (Any) – Element to add to underlying registry container.

Returns:

Returns a boolean indicating whether the registry still has space, or if more items than self.max have been processed.

Return type:

bool

property contents

Return contents of the registry, i.e., the underlying list itself.

property full

Indicates whether the length of the underlying registry container equals self.max.

property head

Returns the first element of the underlying registry container.

property length

Returns the length of the underlying registry container.

property max

Returns the intended max length of the underlying registry container.

property tail

Returns the last element of the underlying registry container.