solid_objects 0.9.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +87 -0
  3. data/README.md +2 -1
  4. data/app/controllers/solid_objects/components_controller.rb +3 -18
  5. data/app/models/solid_objects/instance.rb +31 -4
  6. data/benchmark/support.rb +47 -5
  7. data/docs/architecture.md +4 -0
  8. data/docs/benchmarks.md +19 -2
  9. data/docs/local-testing.md +7 -0
  10. data/docs/realtime.md +59 -4
  11. data/docs/roadmap.md +49 -28
  12. data/exe/solid_objects +12 -1
  13. data/lib/generators/solid_objects/templates/solid_objects.rb +8 -0
  14. data/lib/solid_objects/actor_channel.rb +50 -10
  15. data/lib/solid_objects/callable_keywords.rb +29 -0
  16. data/lib/solid_objects/component_subscriptions.rb +19 -11
  17. data/lib/solid_objects/configuration.rb +13 -0
  18. data/lib/solid_objects/database_adapter.rb +24 -4
  19. data/lib/solid_objects/database_adapters/mysql.rb +17 -1
  20. data/lib/solid_objects/payload_broadcast.rb +29 -1
  21. data/lib/solid_objects/supervisor.rb +76 -0
  22. data/lib/solid_objects/version.rb +1 -1
  23. data/lib/solid_objects/wake_up_adapters.rb +1 -1
  24. data/lib/solid_objects.rb +2 -0
  25. data/sig/generated/controllers/solid_objects/components_controller.rbs +0 -8
  26. data/sig/generated/lib/solid_objects/actor_channel.rbs +19 -0
  27. data/sig/generated/lib/solid_objects/callable_keywords.rbs +16 -0
  28. data/sig/generated/lib/solid_objects/component_subscriptions.rbs +5 -0
  29. data/sig/generated/lib/solid_objects/configuration.rbs +10 -2
  30. data/sig/generated/lib/solid_objects/database_adapter.rbs +10 -0
  31. data/sig/generated/lib/solid_objects/database_adapters/mysql.rbs +10 -0
  32. data/sig/generated/lib/solid_objects/payload_broadcast.rbs +13 -0
  33. data/sig/generated/lib/solid_objects/supervisor.rbs +32 -0
  34. data/sig/generated/models/solid_objects/instance.rbs +11 -0
  35. metadata +17 -1
@@ -29,6 +29,19 @@ module SolidObjects
29
29
  # @rbs (ActorDefinition::Handler) -> untyped
30
30
  def rendered_payload: (ActorDefinition::Handler) -> untyped
31
31
 
32
+ # The block runs against the actor instance, like every other block in the
33
+ # actor DSL, and still receives the actor and the resolved authorization
34
+ # context as arguments, so blocks written to the documented signature are
35
+ # unaffected.
36
+ # @rbs (ActorDefinition::Handler) -> untyped
37
+ def evaluated_payload: (ActorDefinition::Handler) -> untyped
38
+
39
+ # Distinguishes a block that relied on the old class-level receiver from an
40
+ # ordinary typo, so the one behaviour change reports itself instead of
41
+ # surfacing as an unexplained NameError.
42
+ # @rbs (NameError[untyped]) -> bool
43
+ def class_level_receiver?: (NameError[untyped]) -> bool
44
+
32
45
  # @rbs () -> void
33
46
  def authorize!: () -> void
34
47
  end
@@ -2,8 +2,12 @@
2
2
 
3
3
  module SolidObjects
4
4
  class Supervisor
5
+ MAXIMUM_RETENTION_BACKOFF_DOUBLINGS: ::Integer
6
+
5
7
  @lifecycle: Thread::Mutex
6
8
 
9
+ @retention: Thread?
10
+
7
11
  @cleaned_up_at: Float
8
12
 
9
13
  @started: bool
@@ -52,6 +56,34 @@ module SolidObjects
52
56
  # @rbs (Thread?) -> String?
53
57
  def thread_error: (Thread?) -> String?
54
58
 
59
+ # Retention gets its own thread rather than sharing the monitor's. A large
60
+ # backlog or a lock wait can make a pass slow, and role replacement must not
61
+ # wait behind housekeeping.
62
+ # @rbs () -> void
63
+ def retention_loop: () -> void
64
+
65
+ # Sleeping the whole interval would make shutdown wait out an hour-long
66
+ # nap, so the pause is taken in short steps that notice a stop request.
67
+ # @rbs (Integer) -> void
68
+ def wait_for_next_retention: (Integer) -> void
69
+
70
+ # Every actor call writes a durable message row, so retention that is only
71
+ # configured and never run leaves those rows to grow without bound. The
72
+ # supervisor runs it rather than requiring every application to schedule
73
+ # its own job.
74
+ # @rbs () -> void
75
+ def prune_expired_records: () -> void
76
+
77
+ # A transient lock or connection error must not defer retention for the
78
+ # whole interval, so a failed pass retries at monitor cadence. The pause
79
+ # then doubles per consecutive failure, capped by the interval, so a
80
+ # database that stays down is not polled once a second forever.
81
+ # @rbs (Integer) -> Float
82
+ def retention_pause: (Integer) -> Float
83
+
84
+ # @rbs () -> void
85
+ def stop_retention: () -> void
86
+
55
87
  # @rbs () -> void
56
88
  def cleanup_dead_processes: () -> void
57
89
 
@@ -14,6 +14,17 @@ module SolidObjects
14
14
  # @rbs (actor_type: String, actor_ids: Array[String]) -> Hash[String, Hash[String, untyped]]
15
15
  def self.states_for: (actor_type: String, actor_ids: Array[String]) -> Hash[String, Hash[String, untyped]]
16
16
 
17
+ # A cast result carries the connection collation, not the column's, and
18
+ # MySQL refuses to compare two collations. Which collation a connection
19
+ # uses is a property of the client rather than the schema: mysql2
20
+ # negotiates the database default while Trilogy negotiates
21
+ # utf8mb4_general_ci, so the comparison is pinned to the column's own.
22
+ # @rbs (untyped) -> untyped
23
+ private def self.collated: (untyped) -> untyped
24
+
25
+ # @rbs () -> String?
26
+ private def self.owner_id_collation: () -> String?
27
+
17
28
  # @rbs () -> String
18
29
  private def self.owner_id_cast_type: () -> String
19
30
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solid_objects
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucas Carlson
@@ -248,6 +248,20 @@ dependencies:
248
248
  - - ">="
249
249
  - !ruby/object:Gem::Version
250
250
  version: '0'
251
+ - !ruby/object:Gem::Dependency
252
+ name: trilogy
253
+ requirement: !ruby/object:Gem::Requirement
254
+ requirements:
255
+ - - ">="
256
+ - !ruby/object:Gem::Version
257
+ version: '2.7'
258
+ type: :development
259
+ prerelease: false
260
+ version_requirements: !ruby/object:Gem::Requirement
261
+ requirements:
262
+ - - ">="
263
+ - !ruby/object:Gem::Version
264
+ version: '2.7'
251
265
  description: 'The Cloudflare Durable Objects programming model for Rails: addressable
252
266
  objects with durable state, ordered mailboxes, fenced activation, per-object alarms,
253
267
  transactional effects, and reactive ERB. It runs on MySQL, PostgreSQL, and SQLite
@@ -354,6 +368,7 @@ files:
354
368
  - lib/solid_objects/application_actor_loader.rb
355
369
  - lib/solid_objects/application_write_guard.rb
356
370
  - lib/solid_objects/broadcast_executor.rb
371
+ - lib/solid_objects/callable_keywords.rb
357
372
  - lib/solid_objects/caller_process.rb
358
373
  - lib/solid_objects/cli.rb
359
374
  - lib/solid_objects/client.rb
@@ -428,6 +443,7 @@ files:
428
443
  - sig/generated/lib/solid_objects/application_actor_loader.rbs
429
444
  - sig/generated/lib/solid_objects/application_write_guard.rbs
430
445
  - sig/generated/lib/solid_objects/broadcast_executor.rbs
446
+ - sig/generated/lib/solid_objects/callable_keywords.rbs
431
447
  - sig/generated/lib/solid_objects/caller_process.rbs
432
448
  - sig/generated/lib/solid_objects/cli.rbs
433
449
  - sig/generated/lib/solid_objects/client.rbs