Azure / Azure/azure-functions-durable-python
Proposal: Support Entity Locking
- 主要语言
- Python
- 星标
- 157
- 派生
- 70
- 平均合并
- 2 天 10 小时
- 30 天内合并 PR
- 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
- 预计耗时
- 一周以上
- 活跃度
- 冷清
- 描述清晰度
- 需要澄清
- 新手友好度
- 35/100