pds.index_logging

pds.index_logging

Logging handlers for PDS index access timestamps and URL discoveries.

Classes

Name Description
AccessLog Handler for index log operations.

AccessLog

pds.index_logging.AccessLog(key)

[source]

Handler for index log operations.

Parameters

Name Type Description Default
key str Key identifying the index being logged, e.g. “mro.ctx.index”. required

Attributes

Name Description
available_url Get the URL of an available update, if any.
current_url Get the URL of the currently cached index.
should_check Determine if a check should be performed (if last check was over one day ago).
time_since_last_check Return time delta since last check, or None if never checked.
update_available Get whether an update is available for this key.

Methods

Name Description
log_available_url Log the URL of an available update.
log_current_url Log the URL of the currently cached/downloaded index.
log_remote_check Atomically record a successful HEAD check against the remote.
log_update_available Log whether an update is available for this key.
log_available_url
pds.index_logging.AccessLog.log_available_url(url)

Log the URL of an available update.

[source]

log_current_url
pds.index_logging.AccessLog.log_current_url(url)

Log the URL of the currently cached/downloaded index.

[source]

log_remote_check
pds.index_logging.AccessLog.log_remote_check(server_last_modified)

Atomically record a successful HEAD check against the remote.

Writes two correlated fields that together describe one logical event (“I asked the remote about its freshness, and here’s what I got back”):

  • remote_timestamp — the server’s Last-Modified value (server clock); compared to last_updated by :meth:StaticRemoteHandler.update_available.
  • last_checked — wall-clock-now at our end; consumed by :attr:should_check to rate-limit future polls.

Callers should NOT also call :meth:log_check_time — doing the HEAD is the check, the timestamp is the thing it returned, and this method records both as one unit.

[source]

log_update_available
pds.index_logging.AccessLog.log_update_available(available)

Log whether an update is available for this key.

[source]