Skip to content

Commit d085f0c

Browse files
committed
Clarify stores.py module docstring and Tx alias semantics
1 parent d255f5b commit d085f0c

1 file changed

Lines changed: 16 additions & 14 deletions

File tree

  • lib/iris/src/iris/cluster/controller

lib/iris/src/iris/cluster/controller/stores.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,21 @@
99
store and forwards ``transaction()`` / ``read_snapshot()`` to the underlying
1010
:class:`ControllerDB`.
1111
12-
Dependency chain::
12+
Dependency chain (target state)::
1313
1414
db.py — connections, migrations, transaction context managers
1515
schema.py — table DDL, row dataclasses, projections
1616
stores.py — depends on { db, schema }; per-entity stores
17-
transitions.py — depends on stores; never calls db.py directly
18-
19-
Stores are the only place outside of ``db.py`` / ``schema.py`` that build
20-
SQL strings for the controller tables. ``transitions.py`` uses the store
21-
API; other callers (``service.py``, ``controller.py``) are migrated
22-
later as the pattern proves out.
23-
24-
The layer is introduced incrementally. Phase 1 (this module as it stands)
25-
adds the scaffolding and folds the previous ``EndpointRegistry`` in as
26-
:class:`EndpointStore`. Subsequent phases move per-entity SQL out of
27-
``transitions.py`` into the relevant store class.
17+
transitions.py — depends on stores; stores own the SQL
18+
19+
The layer is introduced incrementally. The current state is mid-migration:
20+
``EndpointStore`` and ``JobStore`` are populated, while ``TaskStore``,
21+
``TaskAttemptStore``, ``WorkerStore``, ``DispatchQueueStore`` and
22+
``ReservationStore`` are still empty skeletons. ``ControllerTransitions``
23+
keeps a temporary ``self._db`` backdoor for SQL that has not yet been
24+
moved (tasks, workers, dispatch queue, reservations, the ``meta`` table,
25+
worker-attribute cache). That backdoor is removed in a later phase once
26+
every entity has a store.
2827
"""
2928

3029
from __future__ import annotations
@@ -50,8 +49,11 @@
5049

5150

5251
# Store read methods accept either a write cursor or a read snapshot. Writes
53-
# require ``TransactionCursor`` explicitly so static typing prevents issuing
54-
# mutations through a read-only snapshot.
52+
# require ``TransactionCursor`` explicitly so a ``QuerySnapshot`` can't be
53+
# accidentally passed to a mutating API. (This alias does *not* prevent a store
54+
# read method from issuing writes internally — it just polices the caller-side
55+
# direction. A read-only ``Protocol`` would be stricter; not yet worth the
56+
# plumbing.)
5557
Tx = TransactionCursor | QuerySnapshot
5658

5759

0 commit comments

Comments
 (0)