Module worker::durable[][src]

Expand description

Durable Objects provide low-latency coordination and consistent storage for the Workers platform. A given namespace can support essentially unlimited Durable Objects, with each Object having access to a transactional, key-value storage API.

Durable Objects consist of two components: a class that defines a template for creating Durable Objects and a Workers script that instantiates and uses those Durable Objects.

The class and the Workers script are linked together with a binding.

Learn more about using Durable Objects.

Structs

An ObjectId is used to identify, locate, and access a Durable Object via interaction with its Stub.

Use an ObjectNamespace to get access to Stubs for communication with a Durable Object instance. A given namespace can support essentially unlimited Durable Objects, with each Object having access to a transactional, key-value storage API.

Passed from the runtime to provide access to the Durable Object’s storage as well as various metadata about the Object.

Access a Durable Object’s Storage API. Each method is implicitly wrapped inside a transaction, such that its results are atomic and isolated from all other storage operations, even when accessing multiple key-value pairs.

A Durable Object stub is a client object used to send requests to a remote Durable Object.

Traits

Note: Implement this trait with a standard impl DurableObject for YourType block, but in order to integrate them with the Workers Runtime, you must also add the #[durable_object] attribute macro to both the impl block and the struct type definition.