harp.models.transactions¶
- class Transaction[source]¶
Bases:
EntityTransaction(*, id: str = None, type: str, endpoint: str = None, started_at: datetime.datetime, finished_at: datetime.datetime = None, elapsed: float = None, tpdex: int = None, messages: List[harp.models.messages.Message] = None, tags: dict = <factory>, extras: dict = <factory>, markers: set = <factory>)
- __init__(*, id=None, type, endpoint=None, started_at, finished_at=None, elapsed=None, tpdex=None, messages=None, tags=<factory>, extras=<factory>, markers=<factory>)¶
- as_storable_dict(*, with_messages=False, with_tags=False)[source]¶
Create a dict that can be passed to a storage creation method.
- encode_cache_flag(cached)[source]¶
Encode a transaction cache-hit flag for the
x_cachedstorage column.A truthy flag is stored as the string
"true"; anything else asNone.The flag comes from the cache itself, through the
hishel_from_cacheresponse extension, not from theX-Cacheheader. HARP emits that header for clients, but an upstream may emit one of its own, so it cannot be read back as evidence of a HARP cache hit.- Return type:
str | None