Skip to content

attachment_store

diapason.connectors.attachment_store

AttachmentStore — content-addressed blob storage for Deep Research attachments.

Stores binary attachments at {base_dir}/{sha256[:2]}/{sha256} and tracks metadata in a SQLite database at {base_dir}/attachments.db.

Deduplication is automatic: re-storing the same bytes accumulates source_doc_ids but does not write a second copy of the file.

Pure Python sqlite3 (no Rust extension required).

AttachmentStore

Content-addressed blob store with SQLite metadata index.

Files are written to {base_dir}/{sha256[:2]}/{sha256} so that the directory fan-out stays bounded even for millions of blobs. The SQLite metadata table tracks filename, MIME type, size, and the list of source document IDs that reference each blob.

close()

Close the underlying SQLite connection.

get_content(sha)

Return the raw bytes for sha, or None if the blob is missing.

get_metadata(sha)

Return the metadata dict for sha, or None if not found.

Returned keys: sha256, filename, mime_type, size_bytes, source_doc_ids (list), created_at.

store(content, *, filename, mime_type='', source_doc_id='')

Store content and return its SHA-256 hex digest.

The call is idempotent with respect to the blob file — if the same bytes are stored again only the metadata (source_doc_ids) is updated.