Skip to main content

Module helpers

Module helpers 

Source
Expand description

Helper structures and methods for Task

Structs§

TaskProgress
In-progress task, with dispatch metadata
TaskReport
Completed task, with its processing status and report messages

Enums§

NewTaskMessage
Enum for all types of reported messages for a given Task, as per the LaTeXML convention One of “invalid”, “fatal”, “error”, “warning” or “info”
TaskMessage
Enum for all types of reported messages for a given Task, as per the LaTeXML convention One of “invalid”, “fatal”, “error”, “warning” or “info”
TaskStatus
An enumeration of the expected task statuses. A small value type (every variant is a unit or a single i32) that round-trips through i32 via TaskStatus::raw/TaskStatus::from_raw, so it is Copy.

Statics§

LOADING_LINE_REGEX
“(Loading… file” message regex

Functions§

entry_document_name
The short document name shown in reports and used for download filenames — an entry path’s basename without its directory or extension (e.g. /data/…/0811.0417/0811.0417.zip0811.0417). Falls back to the trimmed entry when the path doesn’t match the …/name.ext shape.
generate_report
Generates a TaskReport from a result archive (.zip) of a CorTeX processing job, following the LaTeXML messaging conventions in its cortex.log. Returns None when the archive is unreadable or empty (0-byte, truncated, non-zip, or no cortex.log entry): that is an infrastructure failure — the worker returned nothing usable — not a conversion verdict, so we do not fabricate a terminal Fatal. The caller (sink) skips finalizing it, leaving the task in-flight for the lease reaper, which retries it and only dead-letters it (with a cortex/never_completed_with_retries message) after MAX_DISPATCH_RETRIES — never a silent, unretried Fatal (KNOWN_ISSUES D-18). A readable cortex.log always yields Some — a genuine verdict, even when it parses to Fatal.
parse_log
Parses a log string which follows the LaTeXML convention (described at the Manual)
prepare_input_stream
Returns an open file handle to the task’s entry
rand_in_range
Helper for generating a random i32 in a range, to avoid loading the rng crate + boilerplate
random_mark
Generate a random integer useful for temporary DB marks
rerun_mark
Random temporary task status sentinel for the mark_rerun two-phase reset.
result_archive_path
The single source of truth for where a service’s result archive lives, given a task’s source entry. The sink writes it here and the frontend reads it back from here — previously three call sites re-derived the same <entry-dir>/<service>.zip three different ways (a Path::parent and two subtly-different regexes), so this collapses them into one.
utf_truncate
Utility functions, until they find a better place