@@ -513,13 +513,54 @@ def track_edit(
513
513
self .edits = self ._edits
514
514
515
515
def lock_edit (self , editor_id : Optional [str ] = None ):
516
- """Lock the data node modification.
516
+ """Lock the data node modification to prevent concurrent modifications of the data node.
517
+
518
+ If locked by an editor, the data node cannot be modified by another editor until
519
+ the lock is released or after 30 minutes (default timeout) from the last modification.
520
+ If the data node is already locked by another editor, an exception is raised.
521
+
522
+ If no editor is provided, the data node is locked for everyone until it is unlocked
523
+ with no expiration date. This is not recommended as it can lead to a deadlock.
524
+
525
+ It sets the editor identifier `editor_id`, the editor expiration date `editor_expiration_date`,
526
+ and the edit in progress flag `edit_in_progress`.
527
+
528
+ ??? example "Usage"
529
+
530
+ ``` python
531
+ # Locks the data node modification as a specific editor
532
+ data_node.lock_edit("editor_id")
533
+ ```
534
+
535
+ To check if the data node is locked, use the property `(DataNode.)edit_in_progress^`.
536
+ ``` python
537
+ # Returns True if the data node is locked for modification.
538
+ data_node.edit_in_progress
539
+ ```
540
+
541
+ To get the editor identifier, use the property `(DataNode.)editor_id^`.
542
+ ``` python
543
+ # Returns the editor identifier
544
+ data_node.editor_id
545
+ ```
546
+
547
+ To get the editor expiration date, use the property `(DataNode.)editor_expiration_date^`.
548
+ ``` python
549
+ # Returns the editor expiration date
550
+ data_node.editor_expiration_date
551
+ ```
517
552
518
- Note:
519
553
The data node can be unlocked with the method `(DataNode.)unlock_edit()^`.
554
+ ``` python
555
+ # Unlocks the data node modification as a specific editor
556
+ data_node.unlock_edit("editor_id")
557
+ ```
520
558
521
559
Arguments:
522
560
editor_id (Optional[str]): The editor's identifier.
561
+
562
+ Raises:
563
+ DataNodeIsBeingEdited: If the data node is already locked by another editor.
523
564
"""
524
565
if editor_id :
525
566
if (
0 commit comments