harp_apps.storage.services.blob_storages.sql

Inheritance diagram of harp_apps.storage.services.blob_storages.sql

class LRUSet[source]

Bases: object

__init__(capacity)[source]
add(item)[source]
exists(item)[source]
get_lru()[source]
remove(item)[source]
class SqlBlobStorage[source]

Bases: IBlobStorage

__init__(engine)[source]
Parameters:

engine (AsyncEngine)

async delete(blob_id)[source]

Delete a blob from the database.

Parameters:

blob_id – content hash identifying the blob (sha1 for message blobs, sha256 for cache entries)

async exists(blob_id)[source]

Check if a blob exists in the database.

Parameters:

blob_id (str) – content hash identifying the blob (sha1 for message blobs, sha256 for cache entries)

Returns:

True if the blob exists, False otherwise

Return type:

bool

async force_put(blob)[source]
Parameters:

blob (Blob)

Return type:

Blob

forget(blob_ids)[source]

Drop the seen entries for blobs deleted without going through delete.

Both put() and exists() answer from seen, so both are wrong about a swept blob until this is called.

Parameters:

blob_ids (Iterable[str])

Return type:

None

async get(blob_id)[source]

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

Parameters:

blob_id – content hash identifying the blob (sha1 for message blobs, sha256 for cache entries)

Returns:

Blob or None

async put(blob)[source]

Store a blob in the database.

Parameters:
  • blob_id – content hash identifying the blob (sha1 for message blobs, sha256 for cache entries)

  • data – blob data

  • blob (Blob)

Return type:

Blob

type: str = 'sql'