archivebox.core.list_results_util

ArchiveResult summaries for snapshot list pages.

The public index and the admin snapshot changelist show, per snapshot: progress counts, per-plugin sizes, one file icon per successful plugin (linking to that result’s embed path), a favicon and a thumbnail.

Loading every result as a model instance with its output_files manifest used to dominate these pages: model construction (field converters, signals, descriptors) for every row, plus decoding manifests nothing renders. Here:

  • every result is one plain value row, never a model instance;

  • single-result plugin sizes come from the materialized output_size column;

  • multi-hook plugin sizes deduplicate their shared manifest paths;

  • the same query ships output_files as text for links, thumbnail candidates and multi-hook groups. Other rows never transfer theirs. Manifests are decoded only when rendering needs a link or must deduplicate a plugin’s file sizes.

List pages must never read the archive filesystem; nothing here does.

Module Contents

Classes

ListResult

One ArchiveResult as list pages read it: a value row, not a model instance.

SnapshotListResults

Everything list pages display about one snapshot’s ArchiveResults.

Functions

load_snapshot_list_results

Load a page of snapshots’ results in one query, keyed by snapshot id.

_archive_result_from_row

Build the deferred ArchiveResult a .only() query would have loaded.

Data

_UNRESOLVED

API

archivebox.core.list_results_util._UNRESOLVED[source]

‘object(…)’

class archivebox.core.list_results_util.ListResult[source]

One ArchiveResult as list pages read it: a value row, not a model instance.

Duck-types the attributes and embed_path() that icon, favicon and thumbnail rendering read from ArchiveResult instances. Ids are hex strings, the way CompactUUIDs print.

id: str[source]

None

snapshot_id: str[source]

None

plugin: str[source]

None

status: str[source]

None

output_size: int[source]

None

output_str: str[source]

None

output_files_json: str | None[source]

None

_embed_path: Any[source]

None

_output_files: dict[str, dict[str, Any]] | None[source]

None

output_file_map() → dict[str, dict[str, Any]][source]
embed_path() → str | None[source]
class archivebox.core.list_results_util.SnapshotListResults[source]

Everything list pages display about one snapshot’s ArchiveResults.

results: list[archivebox.core.list_results_util.ListResult][source]

‘field(…)’

unnamed_status_counts: collections.Counter[str][source]

‘field(…)’

thumbnail_result: archivebox.core.models.ArchiveResult | None[source]

None

property status_counts: collections.Counter[str][source]
property output_sizes: dict[str, int][source]
first_succeeded_by_plugin(*, with_output: bool = False) → dict[str, archivebox.core.list_results_util.ListResult][source]

First successful result per plugin; optionally only results that saved bytes.

succeeded_paths(plugins: set[str]) → list[str][source]

Embed paths of every successful result of these plugins, in result order.

archivebox.core.list_results_util.load_snapshot_list_results(snapshots: collections.abc.Iterable[Any]) → dict[Any, archivebox.core.list_results_util.SnapshotListResults][source]

Load a page of snapshots’ results in one query, keyed by snapshot id.

Embed paths and each snapshot’s thumbnail card are resolved here, from the same rows, so rendering never queries per snapshot or per result.

archivebox.core.list_results_util._archive_result_from_row(row: archivebox.core.list_results_util.ListResult) → archivebox.core.models.ArchiveResult[source]

Build the deferred ArchiveResult a .only() query would have loaded.

Card rendering requires a real ArchiveResult; one per snapshot is cheap.