7272 _worker_roster ,
7373)
7474from iris .cluster .controller .schema import EndpointRow
75+ from iris .cluster .controller .stores import ControllerStore
7576from iris .cluster .controller .transitions import (
7677 Assignment ,
7778 ControllerTransitions ,
@@ -252,7 +253,8 @@ def benchmark_scheduling(db: ControllerDB) -> None:
252253
253254 # --- Write-path benchmarks (use a lightweight clone) ---
254255 write_db = clone_db (db )
255- write_txns = ControllerTransitions (write_db )
256+ write_store = ControllerStore (write_db )
257+ write_txns = ControllerTransitions (store = write_store )
256258
257259 try :
258260 # queue_assignments: the main write-lock holder in scheduling.
@@ -542,7 +544,7 @@ def _all_workers_running_tasks():
542544
543545 bench ("running_tasks_by_worker" , lambda : running_tasks_by_worker (db , worker_ids ))
544546
545- transitions = ControllerTransitions (db )
547+ transitions = ControllerTransitions (store = ControllerStore ( db ) )
546548 bench (
547549 f"get_running_tasks_for_poll ({ len (workers )} workers)" ,
548550 lambda : transitions .get_running_tasks_for_poll (),
@@ -594,7 +596,7 @@ def _all_workers_running_tasks():
594596 )
595597
596598 hb_db = clone_db (db )
597- hb_transitions = ControllerTransitions (hb_db )
599+ hb_transitions = ControllerTransitions (store = ControllerStore ( hb_db ) )
598600
599601 try :
600602 bench (
@@ -739,14 +741,16 @@ def benchmark_endpoints(db: ControllerDB) -> None:
739741 contention (matches the production Register p95 of 3-4s)
740742 """
741743 # Read-path queries run against the source DB (cheap, no clone needed).
742- bench ("endpoint_registry.query (all)" , lambda : db .endpoints .query ())
744+ read_store = ControllerStore (db )
745+ bench ("endpoint_store.query (all)" , lambda : read_store .endpoints .query ())
743746 bench (
744- "endpoint_registry .query (prefix)" ,
745- lambda : db .endpoints .query (EndpointQuery (name_prefix = "test" )),
747+ "endpoint_store .query (prefix)" ,
748+ lambda : read_store .endpoints .query (EndpointQuery (name_prefix = "test" )),
746749 )
747750
748751 write_db = clone_db (db )
749- write_txns = ControllerTransitions (write_db )
752+ write_store = ControllerStore (write_db )
753+ write_txns = ControllerTransitions (store = write_store )
750754
751755 try :
752756 sample = _active_task_sample (write_db , limit = 300 )
@@ -762,7 +766,7 @@ def _do_single():
762766
763767 def _reset_single ():
764768 write_db .execute ("DELETE FROM endpoints WHERE name LIKE '/bench/endpoint/%'" )
765- write_db .endpoints ._load_all ()
769+ write_store .endpoints ._load_all ()
766770
767771 bench ("add_endpoint (1 write)" , _do_single , reset = _reset_single )
768772
@@ -793,7 +797,7 @@ def _do_burst_per_txn(tasks=tasks_for_burst):
793797 def _do_burst_one_txn (tasks = tasks_for_burst ):
794798 with write_db .transaction () as cur :
795799 for t in tasks :
796- write_db .endpoints .add (cur , _make_endpoint (t ))
800+ write_store .endpoints .add (cur , _make_endpoint (t ))
797801
798802 bench (
799803 f"add_endpoint burst x{ burst_n } (1 txn)" ,
@@ -1365,7 +1369,7 @@ def benchmark_apply_contention(db: ControllerDB) -> None:
13651369 ]
13661370
13671371 write_db = clone_db (db )
1368- write_txns = ControllerTransitions (write_db )
1372+ write_txns = ControllerTransitions (store = ControllerStore ( write_db ) )
13691373 try :
13701374 for scenario in scenarios :
13711375 _run_apply_under_contention (
0 commit comments