-
Notifications
You must be signed in to change notification settings - Fork 53
Description
Part of #19
Overview
To support Durable Entities, we will need to design an add SDK-level abstractions. These abstractions will be the types used to implement a durable entity and the context object used within a durable entity for performing work.
Requirements
- Can persist, modify, and delete entity state
- Operations are dispatched to entity
- Operations can include input
- Operations can signal other entities
- Can optionally provide signal time
- Operations can start new orchestrations
- Can optionally provide instance ID and start time
- Operations can return a result to calling orchestration
Non-Requirements
- Entities are aware of or can control operation batch information
- Can signal other via interfaces proxies
Design
Similar to how ITaskOrchestrator and ITaskActivity works, we will start with a barebones ITaskEntity which has a simple Run method on it which accepts information for the current operation to be ran. This method will return the result of the operation, if any.
Entity State
Instead of explicit state management as seen in durable entities in-proc, state management will now be implicit. The implemented ITaskEntity will be serialized and deserialized as the state.
Operation and Context types
These types will be separated into two. This is to better facilitate operation batching (behind the scenes) where the operation will change, but the context can be re-used.
TaskEntityOperation
Includes: input, operation name, context
TaskEntityContext
Includes: ID, state deletion, signal entity, start orchestration
Scenarios Comparisons
| Scenario | In Proc | Out of Proc |
|---|---|---|
| Entity Type | Can implement any type, invoked via DispatchAsync<T>() |
Must implement ITaskEntity. Dispatch behavior will be done via a base class provided later. |
| Entity State: persistence | Explicit management through context methods | Implicitly managed through serialization/deserialization of ITaskEntity |
| Entity State: initialization | Delegate provided to context state method | Use serialization concepts: constructor, System.Text.Json converter, or other existing concepts. |
| Entity State: deletion | method on context object | method on context object |
| Entity State: re-use POCO | use POCO directly | Include POCO as a property on derived ITaskEntity |
| Operation result | method on context | return value of running operation |