comicbox.formats.base.online.session_state

source module comicbox.formats.base.online.session_state

One owner for the online session’s mutable lookup policy.

Two settings change mid-run when a selector answers set_policy or set_prompts: match and prompts. Everything else in OnlineSettings is resolved once at config time and never moves.

This module owns that pair for the whole run. Readers take a snapshot() (both fields under one lock acquisition, so a concurrent writer can’t hand out a mixed pair) or an overlay() of an otherwise static OnlineSettings. A box takes exactly one overlay per lookup and threads that frozen view down its call chain, so a file resolves under a single consistent policy generation even while a sibling -j N worker is changing it; the change lands on the next file.

Deliberately a dumb holder: payload validation and the operator-facing logging live in ComicboxOnlineLookup._apply_session_action, which has the source name for its messages.

Classes

  • LookupPolicy — A consistent read of the session’s mutable lookup policy.

  • OnlineSessionState — Thread-safe owner of the two session-mutable lookup settings.

source dataclass LookupPolicy(match: MatchMode, prompts: Prompts)

A consistent read of the session’s mutable lookup policy.

source class OnlineSessionState(match: MatchMode, prompts: Prompts)

Thread-safe owner of the two session-mutable lookup settings.

Seed the policy from resolved config values.

Methods

  • from_lookup — Seed from a resolved lookup settings block.

  • snapshot — Read both fields as one consistent pair.

  • set_match — Change the match mode for the rest of the run.

  • set_prompts — Change the prompting policy for the rest of the run.

  • overlay — Project the live policy onto otherwise static online settings.

source classmethod OnlineSessionState.from_lookup(lookup: OnlineLookupSettings) → Self

Seed from a resolved lookup settings block.

source method OnlineSessionState.snapshot() → LookupPolicy

Read both fields as one consistent pair.

source method OnlineSessionState.set_match(match: MatchMode) → None

Change the match mode for the rest of the run.

source method OnlineSessionState.set_prompts(prompts: Prompts) → None

Change the prompting policy for the rest of the run.

source method OnlineSessionState.overlay(online: OnlineSettings) → OnlineSettings

Project the live policy onto otherwise static online settings.