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.sqlalchemy_storage.storage

class SqlAlchemyStorage[source]

Bases: Storage

Storage implementation using SQL Alchemy Core, with async drivers.

Currently supported/tested database drivers:

  • aiosqlite (sqlite+aiosqlite://…)

__init__(dispatcher, settings)[source]
Parameters:
begin()[source]
async create_users(users)[source]
Parameters:

users (Iterable[str])

async create_users_once_ready(users)[source]

Sets the list of users to be created once the database is ready.

Parameters:

users (Iterable[str])

async get_blob(blob_id)[source]

Retrieve a blob from the database, using its hash. Returns None if not found.

Parameters:

blob_id – sha1 hash of the blob

Returns:

Blob or None

async get_facet_meta(name)[source]

Retrieve a facet’s metadata, by name.

async get_transaction(id, /, *, username)[source]

Find a transaction, by id.

Parameters:
Return type:

Transaction | None

async get_transaction_list(*, username, with_messages=False, filters=None, page=1, cursor='', text_search='')[source]

Implements Storage.find_transactions.

Parameters:
async get_usage()[source]

Get storage usage.

async initialize()[source]

Initialize database.

install_debugging_instrumentation(*, echo=False)[source]
async ready()[source]
async set_user_flag(*, transaction_id, username, flag, value=True)[source]

Sets or unsets a user flag on a transaction.

Parameters:
  • transaction_id (str)

  • username (str)

  • flag (int)

async transactions_grouped_by_time_bucket(endpoint=None, time_bucket='day', start_datetime=None)[source]
Parameters:
  • endpoint (str | None)

  • time_bucket (str)

  • start_datetime (datetime | None)

Return type:

List[TransactionsGroupedByTimeBucket]

async wait_for_background_tasks_to_be_processed()[source]
engine: AsyncEngine

Reference to the sqlalchemy async engine, which is a gateway to the database connectivity, able to provide a connection used to execute queries.

property worker
class TransactionsGroupedByTimeBucket[source]

Bases: TypedDict

count: int
datetime: datetime | None
errors: int
meanDuration: float