You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d535fdb
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/agents.md
+20Lines changed: 20 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -64,6 +64,12 @@ bin/rails solid_objects:doctor
64
64
The generator adds an initializer and copies migrations into the application.
65
65
The doctor checks the configuration, the tables, and one real actor round trip.
66
66
67
+
Install the current release. `bundle add solid_objects` selects it. Do not pin
68
+
a version that you remember from earlier work; the API changed between
69
+
releases. The current version is on <https://rubygems.org/gems/solid_objects>.
70
+
71
+
The generated policies deny every call. Do step 5 before you call an actor.
72
+
67
73
The `json` gem 3.x works only with Active Support 8.1.4 or newer. On Rails
68
74
7.1, 7.2, 8.0, or 8.1 before 8.1.4, pin `gem "json", "~> 2"` in the
69
75
`Gemfile`. Without the pin, Active Support raises an `ArgumentError`, such as
@@ -153,11 +159,25 @@ Obey these rules in actor code:
153
159
- Use `schedule(at:, key:)` for delayed work. A reminder is one named alarm
154
160
for each actor and key. A new `schedule` with the same key moves the alarm.
155
161
- Use `reject(code, message)` for a business rule failure that must not retry.
162
+
It takes a code and a message, for example
163
+
`reject(:room_full, "The room is full")`.
156
164
- Do not write Active Record models directly in a handler. The runtime raises
157
165
`SolidObjects::ApplicationWriteForbidden`. Use `commit_action` for a short
158
166
write in the same database.
159
167
- Do not call an external API in a handler. Use `emit` and an effect handler.
160
168
- Write each handler so that it can run again. Delivery is at least once.
169
+
- A reminder changes state only when it runs, and it runs only while
170
+
`solid_objects start` runs. Do not compute expiry from the clock in a query;
171
+
read the state that the reminder committed.
172
+
173
+
Avoid these mistakes:
174
+
175
+
| Mistake | Correct form |
176
+
| --- | --- |
177
+
|`schedule(at: deadline)` with no operation after it |`schedule(at: deadline, key: buyer).expire(buyer:)`. `schedule` stages a reminder only when you call an operation on its result |
178
+
|`reject "room full"`|`reject(:room_full, "The room is full")`|
179
+
|`id` inside an actor |`actor_id`. An actor has no `id` method |
180
+
|`register_effect(:name) { \|context, arguments\| ... }`|`register_effect(:name) { \|arguments, context\| ... }`. The arguments come first |
161
181
162
182
[Reminders](reminders.md) and the [architecture guide](architecture.md) give
Copy file name to clipboardExpand all lines: solid_objects.gemspec
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
9
9
spec.version=SolidObjects::VERSION
10
10
spec.authors=["Lucas Carlson"]
11
11
spec.summary="SQL-backed virtual actors for Ruby on Rails"
12
-
spec.description="Solid Objects is a SQL-backed virtual actor library for Ruby on Rails, with durable state, ordered operations, and automatic activation. It brings the Cloudflare Durable Objects programming model to Rails: addressable objects with ordered mailboxes, fenced activation, per-object reminders, transactional effects, and reactive ERB. It runs on MySQL, PostgreSQL, and SQLite without Redis."
12
+
spec.description="Solid Objects is a SQL-backed virtual actor library for Ruby on Rails, with durable state, ordered operations, and automatic activation. It brings the Cloudflare Durable Objects programming model to Rails: addressable objects with ordered mailboxes, fenced activation, per-object reminders, transactional effects, and reactive ERB. It runs on MySQL, PostgreSQL, and SQLite without Redis, and requires Ruby 3.3 or newer and Rails 7.1 or newer."
0 commit comments