pub struct SqlitePaperRepository { /* private fields */ }Implementations§
Source§impl SqlitePaperRepository
impl SqlitePaperRepository
pub fn new(db: Database) -> Self
Sourcepub fn db(&self) -> &Database
pub fn db(&self) -> &Database
Borrow the underlying Database so callers (e.g. the bib-import
orchestrator in #157) can drive a multi-repo transaction over a
single pooled connection. Read-only access — repos remain the
canonical write surface.
Sourcepub fn taken_bibtex_keys(&self) -> Result<HashSet<String>, CoreError>
pub fn taken_bibtex_keys(&self) -> Result<HashSet<String>, CoreError>
Snapshot of every bibtex_key currently assigned in the DB —
used as the taken set when assigning keys to newly-imported
papers via scitadel_core::bibtex_key::assign_keys. Mirrors
the seed in Database::backfill_bibtex_keys.
Sourcepub fn taken_bibtex_keys_in_tx(
tx: &Transaction<'_>,
) -> Result<HashSet<String>, CoreError>
pub fn taken_bibtex_keys_in_tx( tx: &Transaction<'_>, ) -> Result<HashSet<String>, CoreError>
Transactional sibling of Self::taken_bibtex_keys (#157). Runs
the snapshot inside an in-flight transaction so the bib-import
orchestrator’s per-row tx sees its own pending writes.
Sourcepub fn save_in_tx(tx: &Transaction<'_>, paper: &Paper) -> Result<(), CoreError>
pub fn save_in_tx(tx: &Transaction<'_>, paper: &Paper) -> Result<(), CoreError>
Transactional sibling of PaperRepository::save (#157). Same
upsert + DOI-conflict-retry logic, but runs against the caller’s
transaction so a multi-step import operation can roll back as a
unit on partial failure.
Sourcepub fn update_bibtex_key_in_tx(
tx: &Transaction<'_>,
paper_id: &str,
key: &str,
) -> Result<(), CoreError>
pub fn update_bibtex_key_in_tx( tx: &Transaction<'_>, paper_id: &str, key: &str, ) -> Result<(), CoreError>
Transactional sibling of
PaperRepository::update_bibtex_key (#157).
Sourcepub fn find_id_by_arxiv_id(
&self,
arxiv_id: &str,
) -> Result<Option<String>, CoreError>
pub fn find_id_by_arxiv_id( &self, arxiv_id: &str, ) -> Result<Option<String>, CoreError>
Lookup-by-id helpers used by the bib-import matcher (#134).
Inherent (not on PaperRepository) so the port surface stays
minimal — these are only consumed by the import wiring layer.
pub fn find_id_by_pubmed_id( &self, pubmed_id: &str, ) -> Result<Option<String>, CoreError>
pub fn find_id_by_openalex_id( &self, openalex_id: &str, ) -> Result<Option<String>, CoreError>
pub fn find_id_by_bibtex_key( &self, key: &str, ) -> Result<Option<String>, CoreError>
Sourcepub fn find_id_by_title_and_year(
&self,
title: &str,
year: Option<i32>,
) -> Result<Option<String>, CoreError>
pub fn find_id_by_title_and_year( &self, title: &str, year: Option<i32>, ) -> Result<Option<String>, CoreError>
Case-insensitive title match, optionally constrained by year.
Year None means “any year”. Title comparison uses
unicode_lower() (a Rust-side to_lowercase registered as a
SQL scalar function in Database::open — see #159) so case
folds work for non-ASCII characters like Ü/ü. Whitespace
normalization is the caller’s responsibility (the matcher
passes title verbatim today — good enough for the issue’s
stated “exact match only” intent).
Trait Implementations§
Source§impl PaperRepository for SqlitePaperRepository
impl PaperRepository for SqlitePaperRepository
fn save(&self, paper: &Paper) -> Result<(), CoreError>
Source§fn save_many(
&self,
papers: &[Paper],
) -> Result<HashMap<PaperId, PaperId>, CoreError>
fn save_many( &self, papers: &[Paper], ) -> Result<HashMap<PaperId, PaperId>, CoreError>
fn get(&self, paper_id: &str) -> Result<Option<Paper>, CoreError>
fn find_by_doi(&self, doi: &str) -> Result<Option<Paper>, CoreError>
fn find_by_title(&self, title: &str) -> Result<Option<Paper>, CoreError>
fn list_all(&self, limit: i64, offset: i64) -> Result<Vec<Paper>, CoreError>
Source§fn update_full_text(&self, paper_id: &str, text: &str) -> Result<(), CoreError>
fn update_full_text(&self, paper_id: &str, text: &str) -> Result<(), CoreError>
read_paper_tool
after the first PDF/HTML extraction so subsequent reads (TUI
reader, MCP get_annotated_paper) hit the DB instead of
re-running pdf-extract. Idempotent — overwrites the existing
full_text column.Source§fn update_download_state(
&self,
paper_id: &str,
local_path: Option<&str>,
status: DownloadStatus,
) -> Result<(), CoreError>
fn update_download_state( &self, paper_id: &str, local_path: Option<&str>, status: DownloadStatus, ) -> Result<(), CoreError>
local_path is the
absolute path to the saved file on success (any non-Failed
status); pass None for Failed. last_attempt_at is set to
now() automatically. See #112.Source§fn update_bibtex_key(&self, paper_id: &str, key: &str) -> Result<(), CoreError>
fn update_bibtex_key(&self, paper_id: &str, key: &str) -> Result<(), CoreError>
scitadel-export::bibtex::assign_keys.