When using the SQLite-backed storage engine, the txn object is obsolete. Any storage operations performed directly on the ctx.storage object, including SQL queries using ctx.storage.sql.exec(), will be considered part of the transaction.You can use both APIs, KV and SQL, inside an SQLite DO.
transactionSync with SQLite.transaction(...), so what you suggest could be done by starting one in one fetch/rpc call, but without awaiting the returned promise and just storing it in-memory. Then another request can await for it when needed.transaction() method.Error: Durable Object test helpers can only be used with stubs pointing to objects defined within the same worker.
state.storage.deleteAll() to remove an old instance. An old instance will not incur any request or duration charges if they aren't being accessed, but their used storage will be charged until deletedHibernation is only supported when a Durable Object acts as a WebSocket server. Currently, outgoing WebSockets cannot hibernate. on this page here: https://developers.cloudflare.com/durable-objects/best-practices/websockets/#websocket-hibernation-apistorage.get() and provide multiple keys, does each key count as a read unit, or do we count units per 4KB for all keys combined? Trying to minimise storage usage without moving to SQL backendminiflare: {
workers: [
{
name: "dummy-do",
modules: true,
scriptPath: "./test/database/mo.ts"
}
],
durableObjects: {
"MockSqlBackupDO": { className: "DummyDO", scriptName: "dummy-do", useSQLite: true }
}
}transactionSynctransaction(...)transaction()function doX() {
this.promiseTxn = this.storage.transaction(async (txn) => {
const a = txn.get("keyA");
const nextRequestValue = await this.waitForAValueSetByAFutureRequest();
txn.put("keyB", a + nextRequestValue);
});
}// Using KV for simplicity
const a = txn.get("foo")txn.put("bar", a + "yo");