solid_objects 0.1.0

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 (178) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +17 -0
  3. data/MIT-LICENSE +19 -0
  4. data/README.md +744 -0
  5. data/Rakefile +40 -0
  6. data/app/controllers/solid_objects/application_controller.rb +23 -0
  7. data/app/controllers/solid_objects/dead_letters_controller.rb +23 -0
  8. data/app/controllers/solid_objects/instances_controller.rb +29 -0
  9. data/app/helpers/solid_objects/actor_helper.rb +25 -0
  10. data/app/models/solid_objects/broadcast.rb +10 -0
  11. data/app/models/solid_objects/claimed_message.rb +14 -0
  12. data/app/models/solid_objects/dead_letter.rb +13 -0
  13. data/app/models/solid_objects/effect.rb +10 -0
  14. data/app/models/solid_objects/instance.rb +93 -0
  15. data/app/models/solid_objects/message.rb +53 -0
  16. data/app/models/solid_objects/process.rb +13 -0
  17. data/app/models/solid_objects/ready_message.rb +10 -0
  18. data/app/models/solid_objects/record.rb +17 -0
  19. data/app/models/solid_objects/reminder.rb +9 -0
  20. data/app/views/solid_objects/dead_letters/index.html.erb +26 -0
  21. data/app/views/solid_objects/instances/index.html.erb +24 -0
  22. data/app/views/solid_objects/instances/show.html.erb +35 -0
  23. data/benchmark/activation_cache.rb +5 -0
  24. data/benchmark/ask_latency.rb +5 -0
  25. data/benchmark/claim.rb +5 -0
  26. data/benchmark/cold_actors.rb +5 -0
  27. data/benchmark/concurrent_actors.rb +5 -0
  28. data/benchmark/enqueue.rb +5 -0
  29. data/benchmark/hot_actor.rb +5 -0
  30. data/benchmark/processing.rb +5 -0
  31. data/benchmark/query_count.rb +5 -0
  32. data/benchmark/support.rb +271 -0
  33. data/config/routes.rb +8 -0
  34. data/db/migrate/20260805000000_create_solid_objects_tables.rb +319 -0
  35. data/docs/adr/0001-postgresql-backend.md +21 -0
  36. data/docs/adr/0002-jsonb-actor-state.md +21 -0
  37. data/docs/adr/0003-mailbox-ordering.md +30 -0
  38. data/docs/adr/0004-activation-leasing.md +21 -0
  39. data/docs/adr/0005-fencing-tokens.md +25 -0
  40. data/docs/adr/0006-at-least-once-delivery.md +24 -0
  41. data/docs/adr/0007-transactional-outbox.md +21 -0
  42. data/docs/adr/0008-actor-communication.md +21 -0
  43. data/docs/adr/0009-realtime-updates.md +21 -0
  44. data/docs/adr/0010-state-versioning.md +29 -0
  45. data/docs/adr/0011-wake-up-strategy.md +34 -0
  46. data/docs/adr/0012-not-active-jobs.md +21 -0
  47. data/docs/adr/0013-database-adapters.md +48 -0
  48. data/docs/architecture.md +615 -0
  49. data/docs/benchmarks.md +26 -0
  50. data/docs/correctness.md +124 -0
  51. data/docs/database-schema.md +111 -0
  52. data/docs/development.md +87 -0
  53. data/docs/implementation-plan.md +518 -0
  54. data/docs/operations.md +123 -0
  55. data/docs/realtime.md +51 -0
  56. data/docs/research/solid_queue.md +545 -0
  57. data/docs/roadmap.md +53 -0
  58. data/docs/security.md +61 -0
  59. data/docs/state-migrations.md +46 -0
  60. data/examples/application/README.md +16 -0
  61. data/examples/application/app/actors/chat_room_actor.rb +34 -0
  62. data/examples/application/app/actors/shopping_cart_actor.rb +79 -0
  63. data/examples/application/app/controllers/cart_controller.rb +54 -0
  64. data/examples/application/app/controllers/chat_rooms_controller.rb +44 -0
  65. data/examples/application/app/views/actors/chat_room_actor/_messages.html.erb +8 -0
  66. data/examples/application/app/views/actors/shopping_cart_actor/_summary.html.erb +10 -0
  67. data/examples/application/app/views/cart/show.html.erb +13 -0
  68. data/examples/application/app/views/chat_rooms/show.html.erb +8 -0
  69. data/examples/application/config/initializers/solid_objects.rb +23 -0
  70. data/examples/application/config/routes.rb +20 -0
  71. data/exe/solid_objects +9 -0
  72. data/lib/generators/solid_objects/install_generator.rb +21 -0
  73. data/lib/generators/solid_objects/templates/solid_objects.rb +13 -0
  74. data/lib/solid_objects/action_cable_broadcast_adapter.rb +19 -0
  75. data/lib/solid_objects/activation.rb +183 -0
  76. data/lib/solid_objects/activation_manager.rb +102 -0
  77. data/lib/solid_objects/actor.rb +271 -0
  78. data/lib/solid_objects/actor_channel.rb +29 -0
  79. data/lib/solid_objects/actor_definition.rb +212 -0
  80. data/lib/solid_objects/actor_registry.rb +65 -0
  81. data/lib/solid_objects/actor_snapshot.rb +42 -0
  82. data/lib/solid_objects/actor_view.rb +117 -0
  83. data/lib/solid_objects/broadcast_executor.rb +162 -0
  84. data/lib/solid_objects/cli.rb +118 -0
  85. data/lib/solid_objects/client.rb +153 -0
  86. data/lib/solid_objects/configuration.rb +168 -0
  87. data/lib/solid_objects/context.rb +41 -0
  88. data/lib/solid_objects/database_adapter.rb +82 -0
  89. data/lib/solid_objects/database_adapters/mysql.rb +22 -0
  90. data/lib/solid_objects/database_adapters/postgresql.rb +17 -0
  91. data/lib/solid_objects/database_adapters/sqlite.rb +12 -0
  92. data/lib/solid_objects/dead_letter_manager.rb +47 -0
  93. data/lib/solid_objects/dom_identity.rb +38 -0
  94. data/lib/solid_objects/effect_executor.rb +235 -0
  95. data/lib/solid_objects/effect_registry.rb +34 -0
  96. data/lib/solid_objects/engine.rb +33 -0
  97. data/lib/solid_objects/errors.rb +65 -0
  98. data/lib/solid_objects/executor.rb +290 -0
  99. data/lib/solid_objects/instrumentation.rb +10 -0
  100. data/lib/solid_objects/lease.rb +172 -0
  101. data/lib/solid_objects/lease_renewer.rb +70 -0
  102. data/lib/solid_objects/log_subscriber.rb +29 -0
  103. data/lib/solid_objects/mailbox.rb +178 -0
  104. data/lib/solid_objects/message_reference.rb +52 -0
  105. data/lib/solid_objects/process_registry.rb +143 -0
  106. data/lib/solid_objects/reference.rb +96 -0
  107. data/lib/solid_objects/reminder_scheduler.rb +168 -0
  108. data/lib/solid_objects/serialization.rb +99 -0
  109. data/lib/solid_objects/state.rb +111 -0
  110. data/lib/solid_objects/stream_name.rb +29 -0
  111. data/lib/solid_objects/stream_token.rb +59 -0
  112. data/lib/solid_objects/supervisor.rb +87 -0
  113. data/lib/solid_objects/turbo_stream_renderer.rb +35 -0
  114. data/lib/solid_objects/version.rb +5 -0
  115. data/lib/solid_objects/wake_up.rb +28 -0
  116. data/lib/solid_objects/worker.rb +139 -0
  117. data/lib/solid_objects.rb +118 -0
  118. data/sig/generated/controllers/solid_objects/application_controller.rbs +10 -0
  119. data/sig/generated/controllers/solid_objects/dead_letters_controller.rbs +11 -0
  120. data/sig/generated/controllers/solid_objects/instances_controller.rbs +11 -0
  121. data/sig/generated/helpers/solid_objects/actor_helper.rbs +8 -0
  122. data/sig/generated/lib/generators/solid_objects/install_generator.rbs +13 -0
  123. data/sig/generated/lib/solid_objects/action_cable_broadcast_adapter.rbs +8 -0
  124. data/sig/generated/lib/solid_objects/activation.rbs +65 -0
  125. data/sig/generated/lib/solid_objects/activation_manager.rbs +36 -0
  126. data/sig/generated/lib/solid_objects/actor.rbs +183 -0
  127. data/sig/generated/lib/solid_objects/actor_channel.rbs +8 -0
  128. data/sig/generated/lib/solid_objects/actor_definition.rbs +117 -0
  129. data/sig/generated/lib/solid_objects/actor_registry.rbs +36 -0
  130. data/sig/generated/lib/solid_objects/actor_snapshot.rbs +28 -0
  131. data/sig/generated/lib/solid_objects/actor_view.rbs +56 -0
  132. data/sig/generated/lib/solid_objects/broadcast_executor.rbs +55 -0
  133. data/sig/generated/lib/solid_objects/cli.rbs +31 -0
  134. data/sig/generated/lib/solid_objects/client.rbs +35 -0
  135. data/sig/generated/lib/solid_objects/configuration.rbs +147 -0
  136. data/sig/generated/lib/solid_objects/context.rbs +56 -0
  137. data/sig/generated/lib/solid_objects/database_adapter.rbs +42 -0
  138. data/sig/generated/lib/solid_objects/database_adapters/mysql.rbs +16 -0
  139. data/sig/generated/lib/solid_objects/database_adapters/postgresql.rbs +13 -0
  140. data/sig/generated/lib/solid_objects/database_adapters/sqlite.rbs +10 -0
  141. data/sig/generated/lib/solid_objects/dead_letter_manager.rbs +16 -0
  142. data/sig/generated/lib/solid_objects/dom_identity.rbs +20 -0
  143. data/sig/generated/lib/solid_objects/effect_executor.rbs +82 -0
  144. data/sig/generated/lib/solid_objects/effect_registry.rbs +24 -0
  145. data/sig/generated/lib/solid_objects/engine.rbs +7 -0
  146. data/sig/generated/lib/solid_objects/errors.rbs +64 -0
  147. data/sig/generated/lib/solid_objects/executor.rbs +60 -0
  148. data/sig/generated/lib/solid_objects/instrumentation.rbs +8 -0
  149. data/sig/generated/lib/solid_objects/lease.rbs +57 -0
  150. data/sig/generated/lib/solid_objects/lease_renewer.rbs +42 -0
  151. data/sig/generated/lib/solid_objects/log_subscriber.rbs +11 -0
  152. data/sig/generated/lib/solid_objects/mailbox.rbs +46 -0
  153. data/sig/generated/lib/solid_objects/message_reference.rbs +37 -0
  154. data/sig/generated/lib/solid_objects/process_registry.rbs +46 -0
  155. data/sig/generated/lib/solid_objects/reference.rbs +45 -0
  156. data/sig/generated/lib/solid_objects/reminder_scheduler.rbs +55 -0
  157. data/sig/generated/lib/solid_objects/serialization.rbs +31 -0
  158. data/sig/generated/lib/solid_objects/state.rbs +72 -0
  159. data/sig/generated/lib/solid_objects/stream_name.rbs +11 -0
  160. data/sig/generated/lib/solid_objects/stream_token.rbs +19 -0
  161. data/sig/generated/lib/solid_objects/supervisor.rbs +38 -0
  162. data/sig/generated/lib/solid_objects/turbo_stream_renderer.rbs +14 -0
  163. data/sig/generated/lib/solid_objects/version.rbs +5 -0
  164. data/sig/generated/lib/solid_objects/wake_up.rbs +24 -0
  165. data/sig/generated/lib/solid_objects/worker.rbs +56 -0
  166. data/sig/generated/lib/solid_objects.rbs +41 -0
  167. data/sig/generated/models/solid_objects/broadcast.rbs +6 -0
  168. data/sig/generated/models/solid_objects/claimed_message.rbs +6 -0
  169. data/sig/generated/models/solid_objects/dead_letter.rbs +6 -0
  170. data/sig/generated/models/solid_objects/effect.rbs +6 -0
  171. data/sig/generated/models/solid_objects/instance.rbs +25 -0
  172. data/sig/generated/models/solid_objects/message.rbs +22 -0
  173. data/sig/generated/models/solid_objects/process.rbs +6 -0
  174. data/sig/generated/models/solid_objects/ready_message.rbs +6 -0
  175. data/sig/generated/models/solid_objects/record.rbs +8 -0
  176. data/sig/generated/models/solid_objects/reminder.rbs +6 -0
  177. data/sig/support/framework.rbs +37 -0
  178. metadata +467 -0
@@ -0,0 +1,56 @@
1
+ # Generated from lib/solid_objects/actor_view.rb with RBS::Inline
2
+
3
+ module SolidObjects
4
+ class ActorView
5
+ @snapshot: ActorSnapshot
6
+
7
+ @authorization_context: untyped
8
+
9
+ @view_context: untyped
10
+
11
+ @reference: Reference
12
+
13
+ attr_reader reference: untyped
14
+
15
+ # @rbs (reference: Reference, view_context: untyped, authorization_context: untyped) -> void
16
+ def initialize: (reference: Reference, view_context: untyped, authorization_context: untyped) -> void
17
+
18
+ # @rbs (Symbol | String) -> untyped
19
+ def value: (Symbol | String) -> untyped
20
+
21
+ # @rbs (Symbol | String, ?partial: String?) -> untyped
22
+ def component: (Symbol | String, ?partial: String?) -> untyped
23
+
24
+ # @rbs () -> State
25
+ def state: () -> State
26
+
27
+ # @rbs (Symbol, *untyped, **untyped) -> untyped
28
+ def method_missing: (Symbol, *untyped, **untyped) -> untyped
29
+
30
+ # @rbs (Symbol, bool) -> bool
31
+ def respond_to_missing?: (Symbol, bool) -> bool
32
+
33
+ private
34
+
35
+ attr_reader view_context: untyped
36
+
37
+ attr_reader authorization_context: untyped
38
+
39
+ attr_reader snapshot: untyped
40
+
41
+ # @rbs (Symbol | String) -> void
42
+ def authorize_read!: (Symbol | String) -> void
43
+
44
+ # @rbs (Symbol | String) -> bool
45
+ def observable?: (Symbol | String) -> bool
46
+
47
+ # @rbs (untyped) -> String
48
+ def display_value: (untyped) -> String
49
+
50
+ # @rbs (Symbol | String) -> String
51
+ def normalized_component_name: (Symbol | String) -> String
52
+
53
+ # @rbs (String) -> String
54
+ def default_partial: (String) -> String
55
+ end
56
+ end
@@ -0,0 +1,55 @@
1
+ # Generated from lib/solid_objects/broadcast_executor.rb with RBS::Inline
2
+
3
+ module SolidObjects
4
+ class BroadcastExecutor
5
+ @shutdown_requested: bool
6
+
7
+ @stopped: bool
8
+
9
+ @database_adapter: DatabaseAdapter
10
+
11
+ @process_registry: ProcessRegistry
12
+
13
+ # @rbs (?process_registry: ProcessRegistry, ?database_adapter: DatabaseAdapter) -> void
14
+ def initialize: (?process_registry: ProcessRegistry, ?database_adapter: DatabaseAdapter) -> void
15
+
16
+ # @rbs () -> bool
17
+ def run_once: () -> bool
18
+
19
+ # @rbs () -> void
20
+ def stop: () -> void
21
+
22
+ # @rbs () -> void
23
+ def run: () -> void
24
+
25
+ # @rbs () -> void
26
+ def request_shutdown: () -> void
27
+
28
+ # @rbs () -> bool
29
+ def stopped?: () -> bool
30
+
31
+ # @rbs () -> bool
32
+ def shutdown_requested?: () -> bool
33
+
34
+ private
35
+
36
+ attr_reader process_registry: untyped
37
+
38
+ attr_reader database_adapter: untyped
39
+
40
+ # @rbs () -> Broadcast?
41
+ def claim_next: () -> Broadcast?
42
+
43
+ # @rbs () -> Proc | ActionCableBroadcastAdapter
44
+ def broadcast_adapter: () -> Proc
45
+
46
+ # @rbs (Broadcast) -> void
47
+ def complete: (Broadcast) -> void
48
+
49
+ # @rbs (Broadcast, Exception) -> void
50
+ def fail_broadcast: (Broadcast, Exception) -> void
51
+
52
+ # @rbs (Broadcast) -> void
53
+ def verify_claim!: (Broadcast) -> void
54
+ end
55
+ end
@@ -0,0 +1,31 @@
1
+ # Generated from lib/solid_objects/cli.rb with RBS::Inline
2
+
3
+ module SolidObjects
4
+ class CLI < Thor
5
+ # @rbs () -> void
6
+ def start: () -> void
7
+
8
+ # @rbs () -> void
9
+ def status: () -> void
10
+
11
+ # @rbs () -> void
12
+ def cleanup: () -> void
13
+
14
+ # @rbs () -> void
15
+ def dead_letters: () -> void
16
+
17
+ # @rbs (String) -> void
18
+ def retry_dead_letter: (String) -> void
19
+
20
+ private
21
+
22
+ # @rbs () -> void
23
+ def boot_application: () -> void
24
+
25
+ # @rbs (Symbol, Integer) -> Integer
26
+ def numeric_option: (Symbol, Integer) -> Integer
27
+
28
+ # @rbs (Symbol) -> void
29
+ def authorize_administration!: (Symbol) -> void
30
+ end
31
+ end
@@ -0,0 +1,35 @@
1
+ # Generated from lib/solid_objects/client.rb with RBS::Inline
2
+
3
+ module SolidObjects
4
+ class Client
5
+ @mailbox: Mailbox
6
+
7
+ # @rbs (?mailbox: Mailbox) -> void
8
+ def initialize: (?mailbox: Mailbox) -> void
9
+
10
+ # @rbs (Reference, Symbol | String, Hash[Symbol | String, untyped], ?available_at: Time?, ?idempotency_key: String?, ?authorization_context: untyped) -> MessageReference
11
+ def tell: (Reference, Symbol | String, Hash[Symbol | String, untyped], ?available_at: Time?, ?idempotency_key: String?, ?authorization_context: untyped) -> MessageReference
12
+
13
+ # @rbs (Reference, Symbol | String, Hash[Symbol | String, untyped], timeout: Numeric, ?idempotency_key: String?, ?authorization_context: untyped) -> untyped
14
+ def ask: (Reference, Symbol | String, Hash[Symbol | String, untyped], timeout: Numeric, ?idempotency_key: String?, ?authorization_context: untyped) -> untyped
15
+
16
+ # @rbs (Reference, ?authorization_context: untyped) -> bool
17
+ def destroy: (Reference, ?authorization_context: untyped) -> bool
18
+
19
+ private
20
+
21
+ attr_reader mailbox: untyped
22
+
23
+ # @rbs (Proc, Reference, Symbol | String, Hash[Symbol | String, untyped], authorization_context: untyped) -> void
24
+ def authorize!: (Proc, Reference, Symbol | String, Hash[Symbol | String, untyped], authorization_context: untyped) -> void
25
+
26
+ # @rbs (Reference, authorization_context: untyped) -> void
27
+ def authorize_destroy!: (Reference, authorization_context: untyped) -> void
28
+
29
+ # @rbs (MessageReference, timeout: Numeric) -> untyped
30
+ def wait_for_result: (MessageReference, timeout: Numeric) -> untyped
31
+
32
+ # @rbs () -> Float
33
+ def monotonic_now: () -> Float
34
+ end
35
+ end
@@ -0,0 +1,147 @@
1
+ # Generated from lib/solid_objects/configuration.rb with RBS::Inline
2
+
3
+ module SolidObjects
4
+ class Configuration
5
+ @max_attempts: Integer
6
+
7
+ @retry_delay: Proc
8
+
9
+ @process_heartbeat_interval: Float
10
+
11
+ @process_alive_threshold: Float
12
+
13
+ @shutdown_timeout: Float
14
+
15
+ @worker_count: Integer
16
+
17
+ @effect_worker_count: Integer
18
+
19
+ @broadcast_worker_count: Integer
20
+
21
+ @reminder_scheduler_count: Integer
22
+
23
+ @connects_to: Hash[Symbol, untyped]?
24
+
25
+ @logger: untyped
26
+
27
+ @stream_signing_secret: String?
28
+
29
+ @broadcast_adapter: Proc?
30
+
31
+ @wake_up_adapter: untyped
32
+
33
+ @authorize_message: Proc
34
+
35
+ @authorize_query: Proc
36
+
37
+ @authorize_destroy: Proc
38
+
39
+ @authorize_subscription: Proc
40
+
41
+ @authorize_administration: Proc
42
+
43
+ @table_name_prefix: String
44
+
45
+ @polling_interval: Float
46
+
47
+ @ask_polling_interval: Float
48
+
49
+ @lease_duration: Float
50
+
51
+ @lease_renewal_interval: Float
52
+
53
+ @idle_deactivation_timeout: Float
54
+
55
+ @max_messages_per_activation_pass: Integer
56
+
57
+ @max_activation_duration: Float
58
+
59
+ @max_mailbox_length: Integer
60
+
61
+ @claim_scan_limit: Integer
62
+
63
+ @max_payload_bytes: Integer
64
+
65
+ @max_state_bytes: Integer
66
+
67
+ @max_result_bytes: Integer
68
+
69
+ attr_accessor table_name_prefix: untyped
70
+
71
+ attr_accessor polling_interval: untyped
72
+
73
+ attr_accessor ask_polling_interval: untyped
74
+
75
+ attr_accessor lease_duration: untyped
76
+
77
+ attr_accessor lease_renewal_interval: untyped
78
+
79
+ attr_accessor idle_deactivation_timeout: untyped
80
+
81
+ attr_accessor max_messages_per_activation_pass: untyped
82
+
83
+ attr_accessor max_activation_duration: untyped
84
+
85
+ attr_accessor max_mailbox_length: untyped
86
+
87
+ attr_accessor claim_scan_limit: untyped
88
+
89
+ attr_accessor max_payload_bytes: untyped
90
+
91
+ attr_accessor max_state_bytes: untyped
92
+
93
+ attr_accessor max_result_bytes: untyped
94
+
95
+ attr_accessor max_attempts: untyped
96
+
97
+ attr_accessor retry_delay: untyped
98
+
99
+ attr_accessor process_heartbeat_interval: untyped
100
+
101
+ attr_accessor process_alive_threshold: untyped
102
+
103
+ attr_accessor shutdown_timeout: untyped
104
+
105
+ attr_accessor worker_count: untyped
106
+
107
+ attr_accessor effect_worker_count: untyped
108
+
109
+ attr_accessor broadcast_worker_count: untyped
110
+
111
+ attr_accessor reminder_scheduler_count: untyped
112
+
113
+ attr_accessor connects_to: untyped
114
+
115
+ attr_accessor logger: untyped
116
+
117
+ attr_accessor stream_signing_secret: untyped
118
+
119
+ attr_accessor broadcast_adapter: untyped
120
+
121
+ attr_accessor wake_up_adapter: untyped
122
+
123
+ attr_accessor authorize_message: untyped
124
+
125
+ attr_accessor authorize_query: untyped
126
+
127
+ attr_accessor authorize_destroy: untyped
128
+
129
+ attr_accessor authorize_subscription: untyped
130
+
131
+ attr_accessor authorize_administration: untyped
132
+
133
+ # @rbs () -> void
134
+ def initialize: () -> void
135
+
136
+ # @rbs () -> self
137
+ def validate!: () -> self
138
+
139
+ private
140
+
141
+ # @rbs () -> Hash[Symbol, Numeric]
142
+ def positive_values: () -> Hash[Symbol, Numeric]
143
+
144
+ # @rbs () -> Hash[Symbol, Integer]
145
+ def component_counts: () -> Hash[Symbol, Integer]
146
+ end
147
+ end
@@ -0,0 +1,56 @@
1
+ # Generated from lib/solid_objects/context.rb with RBS::Inline
2
+
3
+ module SolidObjects
4
+ class MessageContext < Data
5
+ attr_reader id(): untyped
6
+
7
+ attr_reader attempt(): untyped
8
+
9
+ attr_reader enqueued_at(): untyped
10
+
11
+ attr_reader idempotency_key(): untyped
12
+
13
+ attr_reader request_id(): untyped
14
+
15
+ def self.new: (untyped id, untyped attempt, untyped enqueued_at, untyped idempotency_key, untyped request_id) -> instance
16
+ | (id: untyped, attempt: untyped, enqueued_at: untyped, idempotency_key: untyped, request_id: untyped) -> instance
17
+
18
+ def self.members: () -> [ :id, :attempt, :enqueued_at, :idempotency_key, :request_id ]
19
+
20
+ def members: () -> [ :id, :attempt, :enqueued_at, :idempotency_key, :request_id ]
21
+ end
22
+
23
+ module Context
24
+ STORAGE_KEY: ::Symbol
25
+
26
+ class Frame < Data
27
+ attr_reader actor(): untyped
28
+
29
+ attr_reader message(): untyped
30
+
31
+ attr_reader authorization_context(): untyped
32
+
33
+ def self.new: (untyped actor, untyped message, untyped authorization_context) -> instance
34
+ | (actor: untyped, message: untyped, authorization_context: untyped) -> instance
35
+
36
+ def self.members: () -> [ :actor, :message, :authorization_context ]
37
+
38
+ def members: () -> [ :actor, :message, :authorization_context ]
39
+ end
40
+
41
+ # @rbs () -> Frame?
42
+ def self.current: () -> Frame?
43
+
44
+ # @rbs () -> Actor?
45
+ def self.current_actor: () -> Actor?
46
+
47
+ # @rbs () -> MessageContext?
48
+ def self.current_message: () -> MessageContext?
49
+
50
+ # @rbs () -> untyped
51
+ def self.authorization_context: () -> untyped
52
+
53
+ # @rbs (actor: Actor?, message: MessageContext?, authorization_context: untyped) { () -> untyped } -> untyped
54
+ def self.with: (actor: Actor?, message: MessageContext?, authorization_context: untyped) { () -> untyped } -> untyped
55
+ end
56
+ end
@@ -0,0 +1,42 @@
1
+ # Generated from lib/solid_objects/database_adapter.rb with RBS::Inline
2
+
3
+ module SolidObjects
4
+ class DatabaseAdapter
5
+ # @rbs (untyped) -> DatabaseAdapter
6
+ def self.for: (untyped) -> DatabaseAdapter
7
+
8
+ @connection_pool: untyped
9
+
10
+ @fixed_connection: untyped
11
+
12
+ # @rbs (untyped) -> void
13
+ def initialize: (untyped) -> void
14
+
15
+ # @rbs () -> bool
16
+ def supports_skip_locked?: () -> bool
17
+
18
+ # @rbs () -> String?
19
+ def claim_lock: () -> String?
20
+
21
+ # @rbs () -> String
22
+ def current_time_expression: () -> String
23
+
24
+ # @rbs () -> Time
25
+ def database_now: () -> Time
26
+
27
+ # @rbs () { () -> untyped } -> untyped
28
+ def transaction: () { () -> untyped } -> untyped
29
+
30
+ # @rbs (ActiveRecord::Relation[untyped]) -> ActiveRecord::Relation[untyped]
31
+ def lock_candidates: (ActiveRecord::Relation[untyped]) -> ActiveRecord::Relation[untyped]
32
+
33
+ private
34
+
35
+ attr_reader connection_pool: untyped
36
+
37
+ attr_reader fixed_connection: untyped
38
+
39
+ # @rbs () { (untyped) -> untyped } -> untyped
40
+ def with_connection: () { (untyped) -> untyped } -> untyped
41
+ end
42
+ end
@@ -0,0 +1,16 @@
1
+ # Generated from lib/solid_objects/database_adapters/mysql.rb with RBS::Inline
2
+
3
+ module SolidObjects
4
+ module DatabaseAdapters
5
+ class Mysql < DatabaseAdapter
6
+ # @rbs () -> bool
7
+ def supports_skip_locked?: () -> bool
8
+
9
+ # @rbs () -> String
10
+ def claim_lock: () -> String
11
+
12
+ # @rbs () -> String
13
+ def current_time_expression: () -> String
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,13 @@
1
+ # Generated from lib/solid_objects/database_adapters/postgresql.rb with RBS::Inline
2
+
3
+ module SolidObjects
4
+ module DatabaseAdapters
5
+ class Postgresql < DatabaseAdapter
6
+ # @rbs () -> bool
7
+ def supports_skip_locked?: () -> bool
8
+
9
+ # @rbs () -> String
10
+ def claim_lock: () -> String
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,10 @@
1
+ # Generated from lib/solid_objects/database_adapters/sqlite.rb with RBS::Inline
2
+
3
+ module SolidObjects
4
+ module DatabaseAdapters
5
+ class Sqlite < DatabaseAdapter
6
+ # @rbs () -> String
7
+ def current_time_expression: () -> String
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,16 @@
1
+ # Generated from lib/solid_objects/dead_letter_manager.rb with RBS::Inline
2
+
3
+ module SolidObjects
4
+ class DeadLetterManager
5
+ # @rbs (?authorization_context: untyped) -> ActiveRecord::Relation[DeadLetter]
6
+ def all: (?authorization_context: untyped) -> ActiveRecord::Relation[DeadLetter]
7
+
8
+ # @rbs (Integer, ?authorization_context: untyped) -> MessageReference
9
+ def retry: (Integer, ?authorization_context: untyped) -> MessageReference
10
+
11
+ private
12
+
13
+ # @rbs (Symbol, authorization_context: untyped, ?dead_letter_id: Integer?) -> void
14
+ def authorize!: (Symbol, authorization_context: untyped, ?dead_letter_id: Integer?) -> void
15
+ end
16
+ end
@@ -0,0 +1,20 @@
1
+ # Generated from lib/solid_objects/dom_identity.rb with RBS::Inline
2
+
3
+ module SolidObjects
4
+ module DomIdentity
5
+ # @rbs (Reference) -> String
6
+ def self?.scope: (Reference) -> String
7
+
8
+ # @rbs (Reference, Symbol | String) -> String
9
+ def self?.observable: (Reference, Symbol | String) -> String
10
+
11
+ # @rbs (Reference, Symbol | String) -> String
12
+ def self?.component: (Reference, Symbol | String) -> String
13
+
14
+ # @rbs (Reference) -> String
15
+ def self?.identity_digest: (Reference) -> String
16
+
17
+ # @rbs (Symbol | String) -> String
18
+ def self?.normalized_name: (Symbol | String) -> String
19
+ end
20
+ end
@@ -0,0 +1,82 @@
1
+ # Generated from lib/solid_objects/effect_executor.rb with RBS::Inline
2
+
3
+ module SolidObjects
4
+ class EffectContext < Data
5
+ attr_reader id(): untyped
6
+
7
+ attr_reader attempt(): untyped
8
+
9
+ attr_reader source_message_id(): untyped
10
+
11
+ attr_reader actor_type(): untyped
12
+
13
+ attr_reader actor_id(): untyped
14
+
15
+ def self.new: (untyped id, untyped attempt, untyped source_message_id, untyped actor_type, untyped actor_id) -> instance
16
+ | (id: untyped, attempt: untyped, source_message_id: untyped, actor_type: untyped, actor_id: untyped) -> instance
17
+
18
+ def self.members: () -> [ :id, :attempt, :source_message_id, :actor_type, :actor_id ]
19
+
20
+ def members: () -> [ :id, :attempt, :source_message_id, :actor_type, :actor_id ]
21
+ end
22
+
23
+ class EffectExecutor
24
+ ACTOR_MESSAGE_EFFECT: ::String
25
+
26
+ @shutdown_requested: bool
27
+
28
+ @stopped: bool
29
+
30
+ @database_adapter: DatabaseAdapter
31
+
32
+ @process_registry: ProcessRegistry
33
+
34
+ # @rbs (?process_registry: ProcessRegistry, ?database_adapter: DatabaseAdapter) -> void
35
+ def initialize: (?process_registry: ProcessRegistry, ?database_adapter: DatabaseAdapter) -> void
36
+
37
+ # @rbs () -> bool
38
+ def run_once: () -> bool
39
+
40
+ # @rbs () -> void
41
+ def stop: () -> void
42
+
43
+ # @rbs () -> void
44
+ def run: () -> void
45
+
46
+ # @rbs () -> void
47
+ def request_shutdown: () -> void
48
+
49
+ # @rbs () -> bool
50
+ def stopped?: () -> bool
51
+
52
+ # @rbs () -> bool
53
+ def shutdown_requested?: () -> bool
54
+
55
+ private
56
+
57
+ attr_reader process_registry: untyped
58
+
59
+ attr_reader database_adapter: untyped
60
+
61
+ # @rbs () -> Effect?
62
+ def claim_next: () -> Effect?
63
+
64
+ # @rbs (Effect) -> untyped
65
+ def deliver: (Effect) -> untyped
66
+
67
+ # @rbs (Effect) -> Integer
68
+ def deliver_actor_message: (Effect) -> Integer
69
+
70
+ # @rbs (Effect, untyped) -> void
71
+ def complete: (Effect, untyped) -> void
72
+
73
+ # @rbs (Effect, Exception) -> void
74
+ def fail_effect: (Effect, Exception) -> void
75
+
76
+ # @rbs (Effect) -> void
77
+ def verify_claim!: (Effect) -> void
78
+
79
+ # @rbs (Effect, String?, String, Hash[String, untyped]) -> Message?
80
+ def enqueue_result_message: (Effect, String?, String, Hash[String, untyped]) -> Message?
81
+ end
82
+ end
@@ -0,0 +1,24 @@
1
+ # Generated from lib/solid_objects/effect_registry.rb with RBS::Inline
2
+
3
+ module SolidObjects
4
+ class EffectRegistry
5
+ @handlers: Hash[String, Proc]
6
+
7
+ @mutex: Mutex
8
+
9
+ # @rbs () -> void
10
+ def initialize: () -> void
11
+
12
+ # @rbs (String | Symbol, Proc) -> Proc
13
+ def register: (String | Symbol, Proc) -> Proc
14
+
15
+ # @rbs (String | Symbol) -> Proc
16
+ def fetch: (String | Symbol) -> Proc
17
+
18
+ private
19
+
20
+ attr_reader handlers: untyped
21
+
22
+ attr_reader mutex: untyped
23
+ end
24
+ end
@@ -0,0 +1,7 @@
1
+ # Generated from lib/solid_objects/engine.rb with RBS::Inline
2
+
3
+ module SolidObjects
4
+ class Engine < ::Rails::Engine
5
+ include SolidObjects::ActorHelper
6
+ end
7
+ end
@@ -0,0 +1,64 @@
1
+ # Generated from lib/solid_objects/errors.rb with RBS::Inline
2
+
3
+ module SolidObjects
4
+ class Error < StandardError
5
+ end
6
+
7
+ class UnsupportedDatabase < Error
8
+ end
9
+
10
+ class InvalidActor < Error
11
+ end
12
+
13
+ class UnknownActorType < Error
14
+ end
15
+
16
+ class UnknownMessage < Error
17
+ end
18
+
19
+ class InvalidPayload < Error
20
+ end
21
+
22
+ class PayloadTooLarge < InvalidPayload
23
+ end
24
+
25
+ class MailboxFull < Error
26
+ end
27
+
28
+ class IdempotencyConflict < Error
29
+ end
30
+
31
+ class Unauthorized < Error
32
+ end
33
+
34
+ class InvalidStreamToken < Error
35
+ end
36
+
37
+ class LostActivation < Error
38
+ end
39
+
40
+ class ActorDestroyed < LostActivation
41
+ end
42
+
43
+ class AskTimeout < Error
44
+ end
45
+
46
+ class MessageFailed < Error
47
+ @message_id: Integer
48
+
49
+ @details: Hash[String, untyped]
50
+
51
+ attr_reader message_id: untyped
52
+
53
+ attr_reader details: untyped
54
+
55
+ # @rbs (String, message_id: Integer, details: Hash[String, untyped]) -> void
56
+ def initialize: (String, message_id: Integer, details: Hash[String, untyped]) -> void
57
+ end
58
+
59
+ class StateMigrationError < Error
60
+ end
61
+
62
+ class ActorCallCycle < Error
63
+ end
64
+ end