swh.counters.interface module#

class swh.counters.interface.CountersInterface(*args, **kwargs)[source]#

Bases: Protocol


Dedicated method to execute some specific check per implementation.

add(collection: str, keys: Iterable[Any]) None[source]#

Add the provided keys to the collection Only count new keys.

get_count(collection: str) int[source]#

Return the number of keys for the provided collection

get_counts(collections: List[str]) Dict[str, int][source]#

Return the number of keys for the provided collection

get_counters() Iterable[str][source]#

Return the list of managed counters

class swh.counters.interface.HistoryInterface(*args, **kwargs)[source]#

Bases: Protocol

get_history(cache_file: str)[source]#

Return the content of an history file previously created by the refresh_counters method

refresh_history(cache_file: str)[source]#

Refresh the cache file containing the counters historical data. It can be an aggregate of live data and static data stored on a separate file