Spark DSL extension defining the structure for Durable Objects.
This extension provides three sections:
state- Define state fieldshandlers- Define RPC handlersoptions- Configure lifecycle options
state
Define the state fields for this Durable Object
Nested DSLs
state.field
field name, typeA field in the Durable Object's state
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | atom | The name of the field | |
type | atom | The type of the field (for documentation) |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
default | any | The default value for the field |
Introspection
Target: DurableObject.Dsl.Field
handlers
Define the handlers (RPC methods) for this Durable Object
Nested DSLs
handlers.handler
handler nameAn RPC handler for the Durable Object
Arguments
| Name | Type | Default | Docs |
|---|---|---|---|
name | atom | The name of the handler |
Options
| Name | Type | Default | Docs |
|---|---|---|---|
args | list(atom) | [] | List of argument names for the handler |
Introspection
Target: DurableObject.Dsl.Handler
options
Configure lifecycle options
Options
| Name | Type | Default | Docs |
|---|---|---|---|
hibernate_after | pos_integer | :infinity | 300000 | Hibernate process after this many ms of inactivity (default: 5 minutes) |
shutdown_after | pos_integer | :infinity | nil | Stop process after this many ms of inactivity (nil = never) | |
object_keys | :strings | :atoms! | :atoms | How to convert string keys within field values when loading from JSON. :strings (default, no conversion), :atoms! (existing atoms only, raises otherwise), :atoms (creates atoms if needed). |