Skip to content

Commit 5178ca7

Browse files
committed
Adding new limits, renaming "Best practices" to
"features" to align with D1, and also paves the way for other logical IA changes.
1 parent 43ce948 commit 5178ca7

34 files changed

+117
-78
lines changed

public/_redirects

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -396,27 +396,32 @@
396396

397397
# Durable Objects
398398
/durable-objects/examples/durable-object-example/ /durable-objects/examples/durable-object-in-memory-state/ 301
399-
/durable-objects/api/hibernatable-websockets-api/ /durable-objects/best-practices/websockets/ 301
399+
/durable-objects/api/hibernatable-websockets-api/ /durable-objects/features/websockets/ 301
400400
/durable-objects/api/alarms-in-durable-objects/ /durable-objects/api/alarms/ 301
401-
/durable-objects/api/websockets/ /durable-objects/best-practices/websockets/ 301
401+
/durable-objects/api/websockets/ /durable-objects/features/websockets/ 301
402+
/durable-objects/best-practices/ /durable-objects/features/ 301
403+
/durable-objects/best-practices/create-durable-object-stubs-and-send-requests/ /durable-objects/features/create-durable-object-stubs-and-send-requests/ 301
404+
/durable-objects/best-practices/access-durable-objects-storage/ /durable-objects/features/access-durable-objects-storage/ 301
405+
/durable-objects/best-practices/error-handling/ /durable-objects/features/error-handling/ 301
406+
/durable-objects/best-practices/websockets/ /durable-objects/features/websockets/ 301
402407
/durable-objects/platform/data-location/ /durable-objects/reference/data-location/ 301
403408
/durable-objects/platform/environments/ /durable-objects/reference/environments/ 301
404409
/durable-objects/platform/graphql-analytics/ /durable-objects/observability/graphql-analytics/ 301
405410
/durable-objects/platform/troubleshooting/ /durable-objects/observability/troubleshooting/ 301
406411
/durable-objects/learning/ /durable-objects/reference/ 301
407412
/durable-objects/learning/in-memory-state/ /durable-objects/reference/in-memory-state/ 301
408413
/durable-objects/learning/durable-objects-migrations/ /durable-objects/reference/durable-objects-migrations/ 301
409-
/durable-objects/learning/websockets/ /durable-objects/best-practices/websockets/ 301
414+
/durable-objects/learning/websockets/ /durable-objects/features/websockets/ 301
410415
/durable-objects/examples/durable-object-location-example/ /durable-objects/examples/durable-object-in-memory-state/ 301
411-
/durable-objects/how-to/ /durable-objects/best-practices/ 301
412-
/durable-objects/how-to/access-durable-object-from-a-worker/ /durable-objects/best-practices/access-durable-objects-from-a-worker/ 301
413-
/durable-objects/how-to/create-durable-object-stubs/ /durable-objects/best-practices/create-durable-object-stubs-and-send-requests/ 301
414-
/durable-objects/configuration/access-durable-object-from-a-worker/ /durable-objects/best-practices/access-durable-objects-from-a-worker/ 301
415-
/durable-objects/configuration/create-durable-object-stubs/ /durable-objects/best-practices/create-durable-object-stubs-and-send-requests/ 301
416-
/durable-objects/reference/error-handling/ /durable-objects/best-practices/error-handling/ 301
416+
/durable-objects/how-to/ /durable-objects/features/ 301
417+
/durable-objects/how-to/access-durable-object-from-a-worker/ /durable-objects/features/access-durable-objects-from-a-worker/ 301
418+
/durable-objects/how-to/create-durable-object-stubs/ /durable-objects/features/create-durable-object-stubs-and-send-requests/ 301
419+
/durable-objects/configuration/access-durable-object-from-a-worker/ /durable-objects/features/access-durable-objects-from-a-worker/ 301
420+
/durable-objects/configuration/create-durable-object-stubs/ /durable-objects/features/create-durable-object-stubs-and-send-requests/ 301
421+
/durable-objects/reference/error-handling/ /durable-objects/features/error-handling/ 301
417422
/durable-objects/reference/troubleshooting/ /durable-objects/observability/troubleshooting/ 301
418423
/durable-objects/reference/graphql-analytics/ /durable-objects/observability/graphql-analytics/ 301
419-
/durable-objects/reference/websockets/ /durable-objects/best-practices/websockets/ 301
424+
/durable-objects/reference/websockets/ /durable-objects/features/websockets/ 301
420425
/durable-objects/api/transactional-storage-api/ /durable-objects/api/storage-api/ 301
421426
/durable-objects/platform/changelog/ /durable-objects/release-notes/ 301
422427
/durable-objects/changelog/ /durable-objects/release-notes/ 301

src/content/docs/durable-objects/api/base.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ sidebar:
77

88
import { Render, Tabs, TabItem, GlossaryTooltip, Type, MetaInfo, TypeScriptExample } from "~/components";
99

10-
The `DurableObject` base class is an abstract class which all Durable Objects inherit from. This base class provides a set of optional methods, frequently referred to as handler methods, which can respond to events, for example a webSocketMessage when using the [WebSocket Hibernation API](/durable-objects/best-practices/websockets/#websocket-hibernation-api). To provide a concrete example, here is a Durable Object `MyDurableObject` which extends `DurableObject` and implements the fetch handler to return "Hello, World!" to the calling Worker.
10+
The `DurableObject` base class is an abstract class which all Durable Objects inherit from. This base class provides a set of optional methods, frequently referred to as handler methods, which can respond to events, for example a webSocketMessage when using the [WebSocket Hibernation API](/durable-objects/features/websockets/#websocket-hibernation-api). To provide a concrete example, here is a Durable Object `MyDurableObject` which extends `DurableObject` and implements the fetch handler to return "Hello, World!" to the calling Worker.
1111

1212
<TypeScriptExample>
1313
```ts
@@ -87,4 +87,4 @@ A list of bindings which are available to the Durable Object.
8787

8888
## Related resources
8989

90-
- Refer to [Use WebSockets](/durable-objects/best-practices/websockets/) for more information on examples of WebSocket methods and best practices.
90+
- Refer to [Use WebSockets](/durable-objects/features/websockets/) for more information on examples of WebSocket methods and best practices.

src/content/docs/durable-objects/api/sql-storage.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ SQL API methods accessed with `ctx.storage.sql` are only allowed on [Durable Obj
3838
:::
3939

4040
:::note[Writing to indexes or virtual tables]
41-
When writing data, every index counts as an additional row. However, indexes may be beneficial for read-heavy use cases. Refer to [Index for SQLite Durable Objects](/durable-objects/best-practices/access-durable-objects-storage/#index-for-sqlite-durable-objects).
41+
When writing data, every index counts as an additional row. However, indexes may be beneficial for read-heavy use cases. Refer to [Index for SQLite Durable Objects](/durable-objects/features/access-durable-objects-storage/#index-for-sqlite-durable-objects).
4242

4343
Writing data to [SQLite virtual tables](https://www.sqlite.org/vtab.html) also counts towards rows written.
4444
:::

src/content/docs/durable-objects/api/state.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ export class MyDurableObject extends DurableObject {
106106

107107
### `acceptWebSocket`
108108

109-
`acceptWebSocket` is part of the [WebSocket Hibernation API](/durable-objects/best-practices/websockets/#websocket-hibernation-api), which allows a Durable Object to be removed from memory to save costs while keeping its WebSockets connected.
109+
`acceptWebSocket` is part of the [WebSocket Hibernation API](/durable-objects/features/websockets/#websocket-hibernation-api), which allows a Durable Object to be removed from memory to save costs while keeping its WebSockets connected.
110110

111111
`acceptWebSocket` adds a WebSocket to the set of WebSockets attached to the Durable Object. Once called, any incoming messages will be delivered by calling the Durable Object's `webSocketMessage` handler, and `webSocketClose` will be invoked upon disconnect. After calling `acceptWebSocket`, the WebSocket is accepted and its `send` and `close` methods can be used.
112112

113-
The [WebSocket Hibernation API](/durable-objects/best-practices/websockets/#websocket-hibernation-api) takes the place of the standard [WebSockets API](/workers/runtime-apis/websockets/). Therefore, `ws.accept` must not have been called separately and `ws.addEventListener` method will not receive events as they will instead be delivered to the Durable Object.
113+
The [WebSocket Hibernation API](/durable-objects/features/websockets/#websocket-hibernation-api) takes the place of the standard [WebSockets API](/workers/runtime-apis/websockets/). Therefore, `ws.accept` must not have been called separately and `ws.addEventListener` method will not receive events as they will instead be delivered to the Durable Object.
114114

115115
The WebSocket Hibernation API permits a maximum of 32,768 WebSocket connections per Durable Object, but the CPU and memory usage of a given workload may further limit the practical number of simultaneous connections.
116116

@@ -125,7 +125,7 @@ The WebSocket Hibernation API permits a maximum of 32,768 WebSocket connections
125125

126126
### `getWebSockets`
127127

128-
`getWebSockets` is part of the [WebSocket Hibernation API](/durable-objects/best-practices/websockets/#websocket-hibernation-api), which allows a Durable Object to be removed from memory to save costs while keeping its WebSockets connected.
128+
`getWebSockets` is part of the [WebSocket Hibernation API](/durable-objects/features/websockets/#websocket-hibernation-api), which allows a Durable Object to be removed from memory to save costs while keeping its WebSockets connected.
129129

130130
`getWebSockets` returns an `Array<WebSocket>` which is the set of WebSockets attached to the Durable Object. An optional tag argument can be used to filter the list according to tags supplied when calling [`DurableObjectState::acceptWebSocket`](/durable-objects/api/state/#acceptwebsocket).
131131

@@ -145,7 +145,7 @@ Disconnected WebSockets are not returned by this method, but `getWebSockets` may
145145

146146
### `setWebSocketAutoResponse`
147147

148-
`setWebSocketAutoResponse` is part of the [WebSocket Hibernation API](/durable-objects/best-practices/websockets/#websocket-hibernation-api), which allows a Durable Object to be removed from memory to save costs while keeping its WebSockets connected.
148+
`setWebSocketAutoResponse` is part of the [WebSocket Hibernation API](/durable-objects/features/websockets/#websocket-hibernation-api), which allows a Durable Object to be removed from memory to save costs while keeping its WebSockets connected.
149149

150150
`setWebSocketAutoResponse` sets an automatic response, auto-response, for the request provided for all WebSockets attached to the Durable Object. If a request is received matching the provided request then the auto-response will be returned without waking WebSockets in hibernation and incurring billable duration charges.
151151

@@ -179,7 +179,7 @@ Disconnected WebSockets are not returned by this method, but `getWebSockets` may
179179

180180
### `getWebSocketAutoResponseTimestamp`
181181

182-
`getWebSocketAutoResponseTimestamp` is part of the [WebSocket Hibernation API](/durable-objects/best-practices/websockets/#websocket-hibernation-api), which allows a Durable Object to be removed from memory to save costs while keeping its WebSockets connected.
182+
`getWebSocketAutoResponseTimestamp` is part of the [WebSocket Hibernation API](/durable-objects/features/websockets/#websocket-hibernation-api), which allows a Durable Object to be removed from memory to save costs while keeping its WebSockets connected.
183183

184184
`getWebSocketAutoResponseTimestamp` gets the most recent `Date` on which the given WebSocket sent an auto-response, or null if the given WebSocket never sent an auto-response.
185185

@@ -193,7 +193,7 @@ Disconnected WebSockets are not returned by this method, but `getWebSockets` may
193193

194194
### `setHibernatableWebSocketEventTimeout`
195195

196-
`setHibernatableWebSocketEventTimeout` is part of the [WebSocket Hibernation API](/durable-objects/best-practices/websockets/#websocket-hibernation-api), which allows a Durable Object to be removed from memory to save costs while keeping its WebSockets connected.
196+
`setHibernatableWebSocketEventTimeout` is part of the [WebSocket Hibernation API](/durable-objects/features/websockets/#websocket-hibernation-api), which allows a Durable Object to be removed from memory to save costs while keeping its WebSockets connected.
197197

198198
`setHibernatableWebSocketEventTimeout` sets the maximum amount of time in milliseconds that a WebSocket event can run for.
199199

@@ -209,7 +209,7 @@ If no parameter or a parameter of `0` is provided and a timeout has been previou
209209

210210
### `getHibernatableWebSocketEventTimeout`
211211

212-
`getHibernatableWebSocketEventTimeout` is part of the [WebSocket Hibernation API](/durable-objects/best-practices/websockets/#websocket-hibernation-api), which allows a Durable Object to be removed from memory to save costs while keeping its WebSockets connected.
212+
`getHibernatableWebSocketEventTimeout` is part of the [WebSocket Hibernation API](/durable-objects/features/websockets/#websocket-hibernation-api), which allows a Durable Object to be removed from memory to save costs while keeping its WebSockets connected.
213213

214214
`getHibernatableWebSocketEventTimeout` gets the currently set hibernatable WebSocket event timeout if one has been set via [`DurableObjectState::setHibernatableWebSocketEventTimeout`](/durable-objects/api/state/#sethibernatablewebsocketeventtimeout).
215215

@@ -223,7 +223,7 @@ If no parameter or a parameter of `0` is provided and a timeout has been previou
223223

224224
### `getTags`
225225

226-
`getTags` is part of the [WebSocket Hibernation API](/durable-objects/best-practices/websockets/#websocket-hibernation-api), which allows a Durable Object to be removed from memory to save costs while keeping its WebSockets connected.
226+
`getTags` is part of the [WebSocket Hibernation API](/durable-objects/features/websockets/#websocket-hibernation-api), which allows a Durable Object to be removed from memory to save costs while keeping its WebSockets connected.
227227

228228
`getTags` returns tags associated with a given WebSocket. This method throws an exception if the WebSocket has not been associated with the Durable Object via [`DurableObjectState::acceptWebSocket`](/durable-objects/api/state/#acceptwebsocket).
229229

src/content/docs/durable-objects/api/storage-api.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,15 @@ export class Counter extends DurableObject {
5252
## Methods
5353

5454
:::note[SQLite in Durable Objects]
55-
SQLite-backed Durable Objects can have a private, embedded SQLite database. When deploying a new Durable Object class, users can [use a SQLite storage backend](/durable-objects/best-practices/access-durable-objects-storage/#sqlite-storage-backend) to access the [SQL API](/durable-objects/api/sql-storage/#exec).
55+
SQLite-backed Durable Objects can have a private, embedded SQLite database. When deploying a new Durable Object class, users can [use a SQLite storage backend](/durable-objects/features/access-durable-objects-storage/#sqlite-storage-backend) to access the [SQL API](/durable-objects/api/sql-storage/#exec).
5656

5757
Otherwise, a Durable Object class has a key-value storage backend.
5858
:::
5959

6060
The Durable Object Storage API comes with several methods, including key-value (KV) API, SQL API, and point-in-time-recovery (PITR) API.
6161

6262
- Durable Object classes with the default, key-value storage backend can use KV API.
63-
- Durable Object classes with the [SQLite storage backend](/durable-objects/best-practices/access-durable-objects-storage/#sqlite-storage-backend) can use KV API, SQL API, and PITR API. KV API methods like `get()`, `put()`, `delete()`, or `list()` store data in a hidden SQLite table.
63+
- Durable Object classes with the [SQLite storage backend](/durable-objects/features/access-durable-objects-storage/#sqlite-storage-backend) can use KV API, SQL API, and PITR API. KV API methods like `get()`, `put()`, `delete()`, or `list()` store data in a hidden SQLite table.
6464

6565
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.
6666

@@ -110,7 +110,7 @@ Each method is implicitly wrapped inside a transaction, such that its results ar
110110

111111
- <code>deleteAll(options <Type text="Object" /> <MetaInfo text="optional" />)</code>: <Type text="Promise" />
112112

113-
- Deletes all stored data, effectively deallocating all storage used by the Durable Object. For Durable Objects with a key-value storage backend, `deleteAll()` removes all keys and associated values for an individual Durable Object. For Durable Objects with a [SQLite storage backend](/durable-objects/best-practices/access-durable-objects-storage/#sqlite-storage-backend), `deleteAll()` removes the entire contents of a Durable Object's private SQLite database, including both SQL data and key-value data.
113+
- Deletes all stored data, effectively deallocating all storage used by the Durable Object. For Durable Objects with a key-value storage backend, `deleteAll()` removes all keys and associated values for an individual Durable Object. For Durable Objects with a [SQLite storage backend](/durable-objects/features/access-durable-objects-storage/#sqlite-storage-backend), `deleteAll()` removes the entire contents of a Durable Object's private SQLite database, including both SQL data and key-value data.
114114
- For Durable Objects with a key-value storage backend, an in-progress `deleteAll()` operation can fail, which may leave a subset of data undeleted. Durable Objects with a SQLite storage backend do not have a partial `deleteAll()` issue because `deleteAll()` operations are atomic (all or nothing).
115115
- `deleteAll()` does not proactively delete [Alarms](/durable-objects/api/alarms/). Use [`deleteAlarm()`](/durable-objects/api/alarms/#deletealarm) to delete an alarm.
116116

@@ -203,13 +203,13 @@ The `put()` method returns a `Promise`, but most applications can discard this p
203203

204204
- Provides access to the `put()`, `get()`, `delete()` and `list()` methods documented above to run in the current transaction context. In order to get transactional behavior within a transaction closure, you must call the methods on the `txn` Object instead of on the top-level `ctx.storage` Object.<br/><br/>Also supports a `rollback()` function that ensures any changes made during the transaction will be rolled back rather than committed. After `rollback()` is called, any subsequent operations on the `txn` Object will fail with an exception. `rollback()` takes no parameters and returns nothing to the caller.
205205

206-
* When using [the SQLite-backed storage engine](/durable-objects/best-practices/access-durable-objects-storage/#sqlite-storage-backend), the `txn` object is obsolete. Any storage operations performed directly on the `ctx.storage` object, including SQL queries using [`ctx.storage.sql.exec()`](/durable-objects/api/sql-storage/#exec), will be considered part of the transaction.
206+
* When using [the SQLite-backed storage engine](/durable-objects/features/access-durable-objects-storage/#sqlite-storage-backend), the `txn` object is obsolete. Any storage operations performed directly on the `ctx.storage` object, including SQL queries using [`ctx.storage.sql.exec()`](/durable-objects/api/sql-storage/#exec), will be considered part of the transaction.
207207

208208
### `transactionSync`
209209

210210
- `transactionSync(callback)`: <Type text='any' />
211211

212-
- Only available when using [the SQLite-backed storage engine](/durable-objects/best-practices/access-durable-objects-storage/#sqlite-storage-backend).
212+
- Only available when using [the SQLite-backed storage engine](/durable-objects/features/access-durable-objects-storage/#sqlite-storage-backend).
213213

214214
- Invokes `callback()` wrapped in a transaction, and returns its result.
215215

@@ -262,5 +262,5 @@ The `put()` method returns a `Promise`, but most applications can discard this p
262262
## Related resources
263263

264264
- [Durable Objects: Easy, Fast, Correct – Choose Three](https://blog.cloudflare.com/durable-objects-easy-fast-correct-choose-three/)
265-
- [WebSockets API](/durable-objects/best-practices/websockets/)
265+
- [WebSockets API](/durable-objects/features/websockets/)
266266

0 commit comments

Comments
 (0)