Skip to main content

Module backend

Module backend 

Source
Expand description

All aggregate operations over the CorTeX PostgresQL store are accessed through the connection of a Backend object.

Structs§

Backend
Provides an interface to the Postgres task store
DatabaseUrl
The configured database URL, managed as Rocket state so background jobs open their own connection against the same database as the request pool (notably the test database in integration tests).
DatasetExportOutcome
The result of an export_html_dataset run — the archives written plus tallies, also the body of the *-manifest.json provenance file written alongside them.
MessageCounts
True per-severity message totals for a task (the real counts, before the DOCUMENT_MESSAGE_CAP sampling cap), so a forensic view can show “showing N of M”.
ReportSummaryRow
One report row at a given grain: a what (the drill-down report), a category-grain rollup (what = None, the “category” report), or the per-severity grand total (category = "", what = None). Distinct-task counts are computed by Postgres at each grain (they are not summable from a finer grain). Stored in report_grain_cache, populated per scope on demand.
RerunOptions
Options container for relevant fields in requesting a (corpus, service) rerun
SandboxOutcome
The result of carving a sandbox: the new corpus plus how many entries it captured.
SandboxSelection
The filter that defines a sandbox: a slice of the parent corpus addressed by independent, intersected task-status and message (severity/category/what) dimensions (Model C), plus optional entry/limit narrowing. Serialized verbatim into the sandbox corpus’s selection JSON.
TaskReportOptions
An options object describing a CorTeX report request

Enums§

GroupBy
How the per-paper HTML files are bucketed into output archives — the sole difference between the two scripts this replaces.

Constants§

DOCUMENT_MESSAGE_CAP
Maximum messages loaded per severity for a single document’s forensic view. A hostile or pathological document can carry millions of messages of one severity (observed in production: a single arXiv task with 1.6M warnings); loading them all would allocate gigabytes and hang the request — an unbounded per-request resource acquisition the design principles forbid. The view is a sample bounded by this cap; the true per-severity totals are reported separately (MessageCounts) so the cap is transparent, never silent.

Functions§

build_pool
Builds a lazily-initialized connection pool: connections are established on first checkout, so this never blocks or fails at startup even if the database is momentarily unavailable.
connection_at
Constructs a new Task store representation from a Postgres DB address.
create_sandbox
Carves a sandbox corpus from parent using selection, entirely server-side: it inserts the sandbox corpora row, then a single INSERT INTO tasks (...) SELECT ... FROM tasks ... materializes a TODO task per matched parent entry without ever loading the entries into the application. A 100k-entry carve therefore costs no client RAM and no per-row bind parameters (it sidesteps the 65535-parameter cap a client-side batch insert would hit); the whole carve is one transaction, so it is atomic (no half-built sandbox). Because the matching SELECT over a large parent can take minutes to an hour, this is meant to run as a background job (corpus_sandbox).
default_db_address
The production database postgresql address, from the runtime crate::config configuration
export_html_dataset
Export a corpus/service’s converted HTML into ZIP archives bucketed by GroupBy.
from_address
Constructs a Backend at a given address
list_task_diffs
Prepares a template-friendly list of task differences
summary_task_diffs
Prepares a template-friendly summary of task differences
task_messages
Worker-log messages attached to a task — the forensic evidence behind that document’s conversion status — loaded through the Diesel-generated row structs (LogInfoLogInvalid) via their belongs_to(Task) association, so the column mapping is compiler-checked. Each is returned as a LogRecord trait object (which carries its own severity()/category()/what() /details()), in info → invalid order.
test_db_address
The test database postgresql address, from the runtime crate::config configuration
testdb
Constructs the default Backend struct for testing

Type Aliases§

DbPool
A pool of PostgreSQL connections (Diesel + r2d2).
PooledConn
A connection checked out from a DbPool; dereferences to a PgConnection.