Azure / Azure/azure-functions-durable-python

Proposal: Support Entity Locking

オープン
#277 コメント 4 件 リアクション 0 件 担当者 0 名 GitHub で見る
Enhancement fixed-in-v2
主要言語
Python
スター
157
フォーク
70
平均マージ
2日 10時間
マージ済み PR(30日)
2

説明

We need to support the Durable Functions `lock` API that allows users to establish a critical section for serial Entity updates. I believe this would be the first OOProc PL to support this feature, so I want to make sure we're in the same page about how we plan to implement it.

I imagine the API would be `yield`able, giving us an opportunity to pause the orchestrator execution if the lock cannot be readily acquired, and that it would take as argument a list of EntityIds.

In other words, I expect its interface to be as follows:

```Python
def lock(entityIds: List[string]):
```

### Proposed syntax and usage patterns

The first, and recommended, usage pattern would be one where the lock disposal is automatically managed by some context manager, so as follows:

```Python
entityIds: List[string] = ["myEntity1", "myEntity2", ... ]
with (yield context.lock(entityIds)):
# entity ops ... the lock is released at the end of this segment
```

The second usage pattern is one where entities are locked and released _manually_ by separate APIs
```Python
entityIds: List[string] = ["myEntity1", "myEntity2", ... ]
yield context.lock(entityIds)
yield context.release(entityIds)
```

I expect we'll want to support this second option because not all OOProc PLs with necessarily have a convenient lock-disposal syntax such as Python's "with" statement.

Please let me know if y'all have any thoughts. Otherwise, I'll proceed to prioritize this for an upcoming release. Thanks!

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Start with the proposed context.lock and context.release entry points, and compare their intended behavior with the Durable Functions lock API. Done means the project has an agreed design for pausing acquisition, automatic context-manager disposal, and manual release, with both proposed usage patterns covered by implementation and tests.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
backend-api-design, distributed-systems
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
静か
明瞭さ
説明が足りない
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。