arxiv.canonical.register.api module

Provides the main public API for the canonical register.

See RegisterAPI.

class arxiv.canonical.register.api.Register(name, domain, record, integrity, members=None)[source]

Bases: arxiv.canonical.register.core.Base

add_events(s, sources, *events)[source]

Add events to this register.

Return type

None

domain_type

alias of arxiv.canonical.domain.Canon

integrity_type

alias of arxiv.canonical.integrity.Integrity

member_type = typing.Union[arxiv.canonical.register.listing.RegisterListings, arxiv.canonical.register.eprint.RegisterEPrints]
record_type

alias of arxiv.canonical.record.Record

class arxiv.canonical.register.api.RegisterAPI(storage, sources, name='all')[source]

Bases: arxiv.canonical.core.IRegisterAPI

The main public API for the register.

add_events(*events)[source]

Add new events to the register.

Return type

None

load_eprint(identifier)[source]

Load an EPrint from the record.

Return type

EPrint

load_event(identifier)[source]

Load an Event by identifier.

Return type

Event

load_events(selector)[source]

Load all :class:`.Event`s for a day, month, or year.

Returns an Event generator that loads event data lazily from the underlying storage, so that in general we are loading only the data that we are actually consuming. Events are generated in order.

But be warned! Evaluating the entire generator all at once (e.g. by coercing it to a list) may load a considerable amount of data into memory (and use a lot of i/o), especially if events for an entire year are loaded.

Parameters

selector (int, tuple, or datetime.date) – Indicates the year (int), month (Tuple[int, int]), or day for which events should be loaded.

Returns

  • generator – Yields Event instances in chronological order.

  • int – An estimate of the number of events that will be generated. Note that the actual number may change (especially for large selections) because the record may be updated while the generator is being consumed.

Return type

Tuple[Iterable[Event], int]

load_history(identifier)[source]

Load the event history of an EPrint.

Return type

Iterable[EventSummary]

load_listing(date, shard='listing')[source]

Load a Listing for a particulate date.

Return type

Listing

load_render(identifier)[source]
Return type

Tuple[CanonicalFile, IO[bytes]]

load_source(identifier)[source]
Return type

Tuple[CanonicalFile, IO[bytes]]

load_version(identifier)[source]

Load an e-print Version from the record.

Return type

Version