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 – sha1 hash of the blob

async exists(blob_id)[source]

Check if a blob exists in the database.

Parameters:

blob_id (str) – sha1 hash of the blob

Returns:

True if the blob exists, False otherwise

Return type:

bool

async force_put(blob)[source]
Parameters:

blob (Blob)

Return type:

Blob

async get(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 put(blob)[source]

Store a blob in the database.

Parameters:
  • blob_id – sha1 hash of the blob

  • data – blob data

  • blob (Blob)

Return type:

Blob

type: str = 'sql'