Skip to main content

JobStore

Struct JobStore 

Source
pub struct JobStore { /* private fields */ }

Implementations§

Source§

impl JobStore

Source

pub fn open_default() -> Result<Self>

Source

pub fn open(path: impl Into<PathBuf>) -> Result<Self>

Source

pub fn path(&self) -> &Path

Source

pub fn create_job(&self, request: CreateJob<'_>) -> Result<JobRecord>

Source

pub fn update_job_config_snapshot( &self, job_id: &str, snapshot: &RunConfigSnapshot, ) -> Result<()>

Source

pub fn update_job_input_snapshot( &self, job_id: &str, snapshot_path: &Path, input_sha256: &str, ) -> Result<()>

Source

pub fn load_job_config_snapshot( &self, job_id: &str, ) -> Result<Option<RunConfigSnapshot>>

Source

pub fn update_job_event_path(&self, job_id: &str, path: &Path) -> Result<()>

Source

pub fn update_job_report_paths( &self, job_id: &str, json_path: &Path, markdown_path: &Path, ) -> Result<()>

Source

pub fn update_job_output_path(&self, job_id: &str, path: &Path) -> Result<()>

Source

pub fn insert_segments( &self, job_id: &str, segments: &[Segment], prompt_version: &str, provider: &str, model: &str, cache_namespace: &str, ) -> Result<()>

Source

pub fn save_translation(&self, request: SaveTranslation<'_>) -> Result<()>

Source

pub fn save_needs_review(&self, request: SaveNeedsReview<'_>) -> Result<()>

Source

pub fn save_cached_translation( &self, request: SaveCachedTranslation<'_>, ) -> Result<()>

Source

pub fn mark_job_complete(&self, job_id: &str) -> Result<()>

Source

pub fn mark_job_running(&self, job_id: &str) -> Result<()>

Source

pub fn mark_job_succeeded(&self, job_id: &str) -> Result<()>

Source

pub fn mark_job_needs_review(&self, job_id: &str) -> Result<()>

Source

pub fn mark_job_interrupted(&self, job_id: &str) -> Result<()>

Source

pub fn mark_job_failed(&self, job_id: &str) -> Result<()>

Source

pub fn mark_segment_failed( &self, job_id: &str, segment_id: &str, error: &str, ) -> Result<()>

Source

pub fn mark_segment_failed_if_unfinished( &self, job_id: &str, segment_id: &str, error: &str, ) -> Result<()>

Source

pub fn mark_unfinished_segments_failed( &self, job_id: &str, candidate_segment_ids: &[String], error: &str, ) -> Result<usize>

Source

pub fn get_job(&self, job_id: &str) -> Result<Option<JobRecord>>

Source

pub fn summary(&self, job_id: &str) -> Result<Option<JobSummary>>

Source

pub fn retry_segments(&self, job_id: &str, scope: RetryScope) -> Result<usize>

Source

pub fn insert_segment_flags( &self, flags: &[NewSegmentFlag<'_>], ) -> Result<usize>

Source

pub fn mark_segments_needs_review( &self, job_id: &str, segment_ids: &[String], reason: &str, ) -> Result<usize>

Source

pub fn segment_flag_count(&self, job_id: &str) -> Result<usize>

Source

pub fn upsert_glossary_terms(&self, terms: &[GlossaryTerm]) -> Result<usize>

Source

pub fn add_glossary_term(&self, term: &GlossaryTerm) -> Result<i64>

Source

pub fn upsert_glossary_candidates( &self, book_id: &str, source_language: &str, target_language: &str, candidates: &[NewGlossaryCandidate<'_>], ) -> Result<GlossaryCandidateUpsertResult>

Source

pub fn list_glossary_candidate_language_pairs( &self, book_id: &str, ) -> Result<Vec<(String, String)>>

Source

pub fn list_glossary_candidates( &self, book_id: &str, source_language: &str, target_language: &str, ) -> Result<Vec<StoredGlossaryCandidate>>

Source

pub fn accept_glossary_candidate( &self, id: i64, target_text: Option<&str>, ) -> Result<bool>

Source

pub fn reject_glossary_candidate(&self, id: i64) -> Result<bool>

Source

pub fn list_glossary_terms( &self, filter: GlossaryFilter<'_>, ) -> Result<Vec<GlossaryTerm>>

Source

pub fn load_active_glossary_terms( &self, source_language: &str, target_language: &str, book_id: Option<&str>, series_id: Option<&str>, ) -> Result<Vec<GlossaryTerm>>

Source

pub fn load_active_glossary_terms_for_target( &self, target_language: &str, book_id: Option<&str>, series_id: Option<&str>, ) -> Result<Vec<GlossaryTerm>>

Source

pub fn remove_glossary_term(&self, id: i64) -> Result<usize>

Source

pub fn clear_glossary_scope( &self, scope_kind: GlossaryScopeKind, scope_id: Option<&str>, ) -> Result<usize>

Source

pub fn upsert_style_sheet(&self, record: &NewStyleSheet<'_>) -> Result<i64>

Upsert a style sheet for a (scope, target_language) tuple. Returns the row id of the inserted/updated row.

Source

pub fn load_active_style_sheets( &self, target_language: &str, book_id: Option<&str>, series_id: Option<&str>, ) -> Result<Vec<StoredStyleSheet>>

Load all style sheets that apply for a given language pair and optional book/series scopes. Caller is responsible for merging via bookforge_core::style::merge_style_sheets.

Source

pub fn list_style_sheets( &self, target_language: Option<&str>, scope_kind: Option<GlossaryScopeKind>, scope_id: Option<&str>, ) -> Result<Vec<StoredStyleSheet>>

Source

pub fn clear_style_scope( &self, scope_kind: GlossaryScopeKind, scope_id: Option<&str>, ) -> Result<usize>

Source

pub fn upsert_entities(&self, entities: &[NewEntity<'_>]) -> Result<usize>

Source

pub fn load_active_entities( &self, source_language: &str, target_language: &str, book_id: Option<&str>, series_id: Option<&str>, ) -> Result<Vec<StoredEntity>>

Load all entities that apply for a language pair and optional book/series scopes. Caller is responsible for merging via bookforge_core::entity::merge_scope_entities.

Source

pub fn list_entities( &self, source_language: Option<&str>, target_language: Option<&str>, scope_kind: Option<GlossaryScopeKind>, scope_id: Option<&str>, ) -> Result<Vec<StoredEntity>>

Source

pub fn clear_entities_scope( &self, scope_kind: GlossaryScopeKind, scope_id: Option<&str>, ) -> Result<usize>

Source

pub fn pending_segment_ids(&self, job_id: &str) -> Result<Vec<String>>

Source

pub fn segment_records(&self, job_id: &str) -> Result<Vec<SegmentRecord>>

Source

pub fn load_block_translations( &self, job_id: &str, ) -> Result<Vec<StoredBlockTranslation>>

Source

pub fn load_terminal_segment_translations( &self, job_id: &str, ) -> Result<Vec<StoredSegmentTranslation>>

Source

pub fn resumable_segment_ids(&self, job_id: &str) -> Result<Vec<String>>

Source

pub fn find_cached_translation( &self, segment: &Segment, prompt_version: &str, provider: &str, model: &str, source_lang: Option<&str>, target_lang: &str, cache_namespace: &str, ) -> Result<Option<CachedTranslation>>

Source

pub fn find_cached_translations_batch( &self, segments: &[Segment], request: CacheLookupRequest<'_>, ) -> Result<HashMap<String, CachedTranslation>>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.