Skip to main content

Crate aspero_engine

Crate aspero_engine 

Source
Expand description

Routing, caching, merging and resilience over registered providers.

The engine owns what providers deliberately don’t: retries and backoff (retry), request pacing and the real HTTP client (transport), and choosing which provider answers what.

  • Lookup is interchangeable across providers: each ID goes to the providers that accept its kind, in priority order, until one finds it. A provider that doesn’t know an ID or fails falls through to the next; every attempt is reported.

  • Search is not interchangeable (rankings differ), so it runs against one provider: the one named, or the first capable one. Filters that provider doesn’t declare are stripped and reported as ignored, never silently dropped.

  • Resolve / verify turn a citation claim into scored candidates and a verdict (see resolve).

  • Caching: provider answers (records, “not found”, search pages) are cached with per-kind TTLs (CachePolicy) and served stale if a provider fails; every answer says how it was Served.

  • Sharing: one engine serves many callers at once. Lookups already in flight are joined rather than repeated, and each caller sets its own patience with CallOptions. Providers that can’t answer (a spent quota, a rejected key, repeated failures) are skipped until they can (Engine::unavailable).

Not yet: fan-out search.

Modules§

retry
Retrying one provider operation under its ResiliencePolicy.
transport
The engine’s side of the HttpClient seam: a real client, and pacing.

Structs§

Abstract
An abstract and the provider it came from.
AbstractsReport
Attempt
Budget
What a provider last said was left of its budget.
CachePolicy
How long cached answers are trusted (DESIGN §5). Past these, a provider is asked again; if it then fails, the old answer is served as stale.
CacheStats
CallOptions
How patient a caller is. The default is a batch caller’s: providers’ own policies, retries and all. Set on an engine view with Engine::with_options; views share the cache, pacing and requests in flight.
Candidate
Checked
One checked claim.
CrossrefConfig
DataciteConfig
Difference
A cited field the work disagrees with, and the work’s value if it’s worth showing.
Disagreement
One field on which a record and the registry’s record of the same DOI disagree.
DoiConfig
Engine
Cheap to clone: clones, and views made with with_options, share the cache, providers’ pacing and requests in flight. Hold one per process.
EngineBuilder
EuropePmcConfig
Extras
What to add to each record found.
InputsReport
Looked
LookupReport
LookupResult
OpenAlexConfig
OpenLibraryConfig
ResolveReport
SearchReport
Sighting
One provider surfacing a candidate.
SqliteCache
StandardConfig
Settings for the compiled-in providers. None disables a provider.
Verification
VersionsReport

Enums§

CitedField
EngineError
Finding
Something to fix or know about one entry.
InputLookup
One input’s lookup.
Outcome
The outcome of one provider’s attempt at one ID.
Reason
Why a verdict was reached. “The work” is the verdict’s candidate (Verification::best); “the identifiers” are those the claim gave.
Served
Where an answer came from.
Severity
StoreError
Verdict
Via
How a candidate was found.

Traits§

Cache
What the engine needs from a cache; it depends on this, not on SQLite.
Pacing
Request slots shared between processes, so parallel agents (and any other process using the same file) keep to one rate limit per provider.

Functions§

describe_update
“RETRACTED (2010-02-06, notice doi:…, via retraction-watch)”.
disagreements
Where record contradicts registry’s record of the same DOI. Dates compare by year, any of either record’s years counting (online-first and print years differ legitimately); pages by first page.
duplicates
For each match, the earliest other match that is the same work (shares an identifier).
findings
Findings for one claim from its verification (not duplicates, which need the whole set).
standard
Builds an engine with each enabled provider behind its own paced reqwest client.

Type Aliases§

Clock
A clock, injectable so cache expiry is testable.
SecretString
Re-exported for credentials in provider configs. Secret string type.