Skip to content

Commit 5ec448a

Browse files
authored
feat: include old roots in pubsub info (#533)
1 parent 78154b2 commit 5ec448a

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

pychunkedgraph/app/segmentation/common.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ def publish_edit(
334334
"operation_id": int(result.operation_id),
335335
"new_lvl2_ids": result.new_lvl2_ids.tolist(),
336336
"new_root_ids": result.new_root_ids.tolist(),
337+
"old_root_ids": result.old_root_ids.tolist(),
337338
}
338339

339340
exchange = os.getenv("PYCHUNKEDGRAPH_EDITS_EXCHANGE", "pychunkedgraph")

pychunkedgraph/graph/operation.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ class GraphEditOperation(ABC):
4545
"parent_ts",
4646
"privileged_mode",
4747
]
48-
Result = namedtuple("Result", ["operation_id", "new_root_ids", "new_lvl2_ids"])
48+
Result = namedtuple(
49+
"Result", ["operation_id", "new_root_ids", "new_lvl2_ids", "old_root_ids"]
50+
)
4951

5052
def __init__(
5153
self,
@@ -478,10 +480,19 @@ def execute(
478480
new_root_ids,
479481
new_lvl2_ids,
480482
affected_records,
483+
root_ids,
481484
)
482485
return result
483486

484-
def _write(self, lock, timestamp, new_root_ids, new_lvl2_ids, affected_records):
487+
def _write(
488+
self,
489+
lock: locks.RootLock,
490+
timestamp: datetime,
491+
new_root_ids: np.ndarray,
492+
new_lvl2_ids: np.ndarray,
493+
affected_records: list,
494+
old_root_ids: np.ndarray,
495+
):
485496
"""Helper to persist changes after an edit."""
486497
new_root_ids = np.array(new_root_ids, dtype=basetypes.NODE_ID)
487498
new_lvl2_ids = np.array(new_lvl2_ids, dtype=basetypes.NODE_ID)
@@ -522,6 +533,7 @@ def _write(self, lock, timestamp, new_root_ids, new_lvl2_ids, affected_records):
522533
operation_id=lock.operation_id,
523534
new_root_ids=new_root_ids,
524535
new_lvl2_ids=new_lvl2_ids,
536+
old_root_ids=old_root_ids,
525537
)
526538

527539

0 commit comments

Comments
 (0)