Attention

This is the documentation for HARP Proxy, actually published as an early preview. Both the software and documentation are a work in progress, and although we already use it on various production servers, they may contain inaccuracies, typographical errors, huge mistakes and empty pages. We work hard to eradicate all mistakes and implement stuff, but it is a long and tedious process. We appreciate your patience and understanding. Of course, any help will be greatly appreciated.

harp_apps.janitor.worker

class JanitorWorker[source]

Bases: object

__init__(storage)[source]
Parameters:

storage (Storage)

async compute_and_store_metrics(*, session)[source]

Compute counts of objects in storage, and store them as metrics.

async compute_metrics(session)[source]
async delete_old_transactions(*, session)[source]

Remove transactions older than OLD_AFTER days. On correct database implementations (postgresql for example), it will cascade to related objects. On sqlite, there will be garbage left, but it’s not a big deal.

async delete_orphan_blobs(*, session)[source]

Find and remove blobs that are not referenced anymore by any transaction.

async do_count(session, name, /, *, method='count')[source]

Helper to count objects in storage, from different repositories and using different methods for building the actual query.

Parameters:
  • session – sqlalchemy async session

  • name (str) – repository name (should be available from storage)

  • method – method name to call on the repository to get the actual sqlalchemy query, default as “count”

Returns:

integer

async loop()[source]

One iteration of the janitor loop.

async run()[source]

Once dependencies are ready, start the main loop (basically, run the loop() every PERIOD seconds), until stop() is called.

stop()[source]

Mark the loop for termination.