Durable Objects without Cloudflare, on the database you already run
Описание и применение
Solid Objects позволяет реализовать Durable Objects как библиотеку, работающую на любом SQL‑базе, обеспечивая сериализацию вызовов и хранение состояния и таймеров в базе, устраняя необходимость внешних сервисов.
Задача
Developers need single‑threaded, per‑identity stateful objects without relying on a vendor‑specific edge platform, while avoiding the complexity of databases, queues, and locks.
Результат
Solid Objects enables per‑identity, single‑threaded stateful objects on any SQL database, eliminating the need for external queues, locks, or vendor‑specific edge platforms. It serializes concurrent calls, guarantees atomic state updates, and stores timers in the same database, reducing operational cost and complexity.
Рабочий процесс
- 1. Install Solid Objects via npm or add the Ruby gem to a Rails app.
- 2. Define an actor class by extending Actor and implementing business logic.
- 3. Create a runtime with createRuntime, passing a database driver (e.g., sqlite).
- 4. Install the runtime to set up necessary tables.
- 5. Obtain a reference to an actor instance with runtime.ref(actorClass, identity).
- 6. Call actor methods; each call is queued as a durable message and processed one at a time.
- 7. Use schedule() to set per‑identity timers that survive crashes.
- 8. Run quickstart tests to verify serialization and concurrency.
- 9. Deploy the application; no additional services are required beyond the existing database.
Доказательства
Solid Objects ships in two implementations that share one design: a Ruby gem that runs in production in an app with over 100,000 users, and a TypeScript package for Node.
The ten‑minute hold uses a durable reminder. Calling schedule with the buyer's key arms one alarm for that hold, and calling it again with the same key moves the alarm instead of adding a second one.
- Дата записи: 2026-09-06T23:22:38.577Z