cowbird.database.stores

Stores to read/write data to from/to MongoDB using pymongo.

Attributes

LOGGER

Classes

StoreInterface

Check that the store implementation defines its type and index_fields.

MongodbStore

Base class extended by all concrete store implementations.

MonitoringStore

Registry for monitoring instances.

Module Contents

cowbird.database.stores.LOGGER[source]
class cowbird.database.stores.StoreInterface[source]

Bases: object

Check that the store implementation defines its type and index_fields.

type: str = None[source]
index_fields: List[str] = [][source]
class cowbird.database.stores.MongodbStore(collection: pymongo.collection.Collection, *_: Any, **__: Any)[source]

Base class extended by all concrete store implementations.

Validate and hold the collection for all the implementation.

classmethod get_args_kwargs(*args: Any, **kwargs: Any) Tuple[Tuple[Any, Ellipsis], Dict[str, Any]][source]

Filters MongodbStore-specific arguments to safely pass them down its __init__.

class cowbird.database.stores.MonitoringStore(*args: Any, **kwargs: Any)[source]

Bases: StoreInterface, MongodbStore

Registry for monitoring instances.

Uses MongoDB to store what is monitored and by whom.

Init the store used to save monitors.

type = 'monitors'[source]
index_fields = ['callback', 'path'][source]
save_monitor(monitor: cowbird.monitoring.monitor.Monitor) None[source]

Stores Monitor in MongoDB storage.

delete_monitor(monitor: cowbird.monitoring.monitor.Monitor) None[source]

Removes Monitor from MongoDB storage.

list_monitors() List[cowbird.monitoring.monitor.Monitor][source]

Lists all Monitor in MongoDB storage.

clear_services(drop: bool = True) None[source]

Removes all Monitor from MongoDB storage.