Storage

Storage implementations are in charge of persisting transactions and messages into a backend (database, memory, …) using eventual dependencies.

Each storages should implement the Storage protocol.

Model

../../_images/storage-model.excalidraw.png
  • a Transaction represents a transaction that went through the proxy. A set of request-response forms a transaction in the case of an HTTP transaction (although the response may not be present in case of an in progress transaction or a timed out transaction).

  • a Message represents an atomic message that went through the proxy. An http request or response is a message.

  • a Blob represents a binary content, for example the headers or the body of an http request or response.

Protocol

class IStorage[source]
__init__(*args, **kwargs)
async create_users_once_ready(users)[source]

Create users.

Parameters:

users (Iterable[str])

async finalize()[source]

Coroutine function to finalize the instance. Should release resources, close files etc… The caller should make sure to call finalize on all cases where the instance is not needed anymore to get a clean shutdown.

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:
async get_transaction_list(*, username, with_messages=False, filters=None, page=1, cursor='', text_search='')[source]

Find transactions, using optional filters, for example to be displayed in the dashboard.

Parameters:
async get_usage()[source]

Get storage usage.

async initialize()[source]

Coroutine function to initialize the instance.

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)