solid_objects 0.11.0 → 0.12.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 (57) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +23 -0
  3. data/README.md +39 -16
  4. data/app/controllers/solid_objects/components_controller.rb +4 -4
  5. data/app/models/solid_objects/message.rb +1 -1
  6. data/app/views/solid_objects/dead_letters/index.html.erb +1 -1
  7. data/app/views/solid_objects/instances/show.html.erb +1 -1
  8. data/benchmark/support.rb +10 -10
  9. data/db/migrate/20260813000000_rename_message_dispatch_columns.rb +53 -0
  10. data/docs/architecture.md +11 -9
  11. data/docs/authorization.md +2 -2
  12. data/docs/database-schema.md +4 -4
  13. data/docs/development.md +1 -1
  14. data/docs/migrating-existing-state.md +1 -3
  15. data/docs/roadmap.md +1 -1
  16. data/lib/solid_objects/actor.rb +43 -32
  17. data/lib/solid_objects/actor_channel.rb +3 -3
  18. data/lib/solid_objects/actor_definition.rb +9 -6
  19. data/lib/solid_objects/actor_view.rb +1 -1
  20. data/lib/solid_objects/application_write_guard.rb +1 -1
  21. data/lib/solid_objects/client.rb +52 -52
  22. data/lib/solid_objects/component_registration.rb +2 -2
  23. data/lib/solid_objects/component_renderer.rb +1 -1
  24. data/lib/solid_objects/component_subscriptions.rb +21 -21
  25. data/lib/solid_objects/database_adapters/sqlite.rb +7 -1
  26. data/lib/solid_objects/dead_letter_manager.rb +4 -4
  27. data/lib/solid_objects/doctor.rb +8 -8
  28. data/lib/solid_objects/effect_executor.rb +22 -22
  29. data/lib/solid_objects/errors.rb +27 -27
  30. data/lib/solid_objects/executor.rb +40 -38
  31. data/lib/solid_objects/lease.rb +3 -3
  32. data/lib/solid_objects/mailbox.rb +34 -27
  33. data/lib/solid_objects/operation_dispatcher.rb +51 -0
  34. data/lib/solid_objects/payload_broadcast.rb +1 -1
  35. data/lib/solid_objects/reference.rb +60 -29
  36. data/lib/solid_objects/reminder_scheduler.rb +6 -6
  37. data/lib/solid_objects/sync_diagnostics.rb +6 -6
  38. data/lib/solid_objects/turbo_stream_renderer.rb +13 -13
  39. data/lib/solid_objects/version.rb +1 -1
  40. data/lib/solid_objects.rb +1 -0
  41. data/sig/generated/controllers/solid_objects/components_controller.rbs +2 -2
  42. data/sig/generated/lib/solid_objects/actor.rbs +17 -17
  43. data/sig/generated/lib/solid_objects/actor_definition.rbs +4 -4
  44. data/sig/generated/lib/solid_objects/client.rbs +8 -8
  45. data/sig/generated/lib/solid_objects/component_registration.rbs +2 -2
  46. data/sig/generated/lib/solid_objects/component_subscriptions.rbs +8 -8
  47. data/sig/generated/lib/solid_objects/database_adapters/sqlite.rbs +3 -0
  48. data/sig/generated/lib/solid_objects/effect_executor.rbs +2 -2
  49. data/sig/generated/lib/solid_objects/errors.rbs +18 -18
  50. data/sig/generated/lib/solid_objects/executor.rbs +10 -10
  51. data/sig/generated/lib/solid_objects/lease.rbs +2 -2
  52. data/sig/generated/lib/solid_objects/mailbox.rbs +8 -8
  53. data/sig/generated/lib/solid_objects/operation_dispatcher.rbs +35 -0
  54. data/sig/generated/lib/solid_objects/reference.rbs +7 -4
  55. data/sig/generated/lib/solid_objects/sync_diagnostics.rbs +2 -2
  56. data/sig/generated/lib/solid_objects/turbo_stream_renderer.rbs +8 -8
  57. metadata +5 -2
@@ -8,7 +8,7 @@ module SolidObjects
8
8
  instance = Instance.uncached { Instance.find(message.instance_id) }
9
9
  blocker = earlier_blocker(message)
10
10
  status = message_status(message)
11
- waiting_on = waiting_reason(message, instance, blocker)
11
+ waiting_on = waiting_reason(message:, instance:, blocker:)
12
12
  activation = activation_details(instance)
13
13
  build_error(
14
14
  message,
@@ -38,7 +38,7 @@ module SolidObjects
38
38
  timeout:,
39
39
  actor_type: message_reference.actor_type,
40
40
  actor_id: message_reference.actor_id,
41
- message_name: "unknown",
41
+ operation: "unknown",
42
42
  message_id: message_reference.id,
43
43
  request_id: message_reference.request_id,
44
44
  sequence: message_reference.sequence,
@@ -70,7 +70,7 @@ module SolidObjects
70
70
  timeout:,
71
71
  actor_type: message.actor_type,
72
72
  actor_id: message.actor_id,
73
- message_name: message.message_name,
73
+ operation: message.operation,
74
74
  message_id: message.id,
75
75
  request_id: message.request_id,
76
76
  sequence: message.sequence,
@@ -105,8 +105,8 @@ module SolidObjects
105
105
  "unknown"
106
106
  end
107
107
 
108
- # @rbs (Message, Instance, Message?) -> String
109
- def waiting_reason(message, instance, blocker)
108
+ # @rbs (message: Message, instance: Instance, blocker: Message?) -> String
109
+ def waiting_reason(message:, instance:, blocker:)
110
110
  return "actor_paused" if instance.paused_at
111
111
  return "activation_held" if live_activation?(instance)
112
112
  return "earlier_message" if blocker
@@ -179,7 +179,7 @@ module SolidObjects
179
179
  {
180
180
  "message_id" => blocker.id,
181
181
  "sequence" => blocker.sequence,
182
- "message_name" => blocker.message_name,
182
+ "operation" => blocker.operation,
183
183
  "status" => message_status(blocker)
184
184
  }
185
185
  end
@@ -20,9 +20,9 @@ module SolidObjects
20
20
  ""
21
21
  else
22
22
  observable_value(
23
- reference,
24
- broadcast.observable_name,
25
- broadcast.value
23
+ reference:,
24
+ name: broadcast.observable_name,
25
+ value: broadcast.value
26
26
  )
27
27
  end
28
28
  metadata = Base64.urlsafe_encode64(
@@ -35,16 +35,16 @@ module SolidObjects
35
35
  "#{stream}<!--#{INVALIDATION_MARKER}#{metadata}-->"
36
36
  end
37
37
 
38
- # @rbs (Reference, Symbol | String, untyped) -> String
39
- def observable_value(reference, name, value)
38
+ # @rbs (reference: Reference, name: Symbol | String, value: untyped) -> String
39
+ def observable_value(reference:, name:, value:)
40
40
  target = DomIdentity.observable(reference, name)
41
41
  content = ERB::Util.html_escape(display_value(value))
42
42
  %(<turbo-stream action="replace" target="#{target}"><template><span id="#{target}">#{content}</span></template></turbo-stream>)
43
43
  end
44
44
 
45
- # @rbs (ComponentRegistration, Integer, Integer) -> String
46
- def component_refresh(registration, instance_id, revision)
47
- return morph_component_refresh(registration, instance_id, revision) if registration.morph?
45
+ # @rbs (registration: ComponentRegistration, instance_id: Integer, revision: Integer) -> String
46
+ def component_refresh(registration:, instance_id:, revision:)
47
+ return morph_component_refresh(registration:, instance_id:, revision:) if registration.morph?
48
48
 
49
49
  target = registration.dom_id
50
50
  source = ERB::Util.html_escape(
@@ -54,13 +54,13 @@ module SolidObjects
54
54
  %(<turbo-stream action="replace" target="#{target}"><template><turbo-frame id="#{target}" src="#{source}" data-solid-objects-revision="#{revision_value}" data-solid-objects-refresh="replace"></turbo-frame></template></turbo-stream>)
55
55
  end
56
56
 
57
- # @rbs (Array[ComponentRegistration], Integer, Integer) -> String
58
- def batch_refresh(registrations, instance_id, revision)
57
+ # @rbs (registrations: Array[ComponentRegistration], instance_id: Integer, revision: Integer) -> String
58
+ def batch_refresh(registrations:, instance_id:, revision:)
59
59
  first = registrations.first
60
60
  scope = DomIdentity.scope(first.reference)
61
61
  batch = ERB::Util.html_escape(first.batch)
62
62
  source = ERB::Util.html_escape(
63
- first.batch_refresh_url(registrations, instance_id, revision)
63
+ first.batch_refresh_url(registrations:, instance_id:, revision:)
64
64
  )
65
65
  targets = ERB::Util.html_escape(registrations.map(&:dom_id).join(" "))
66
66
  %(<turbo-stream action="append" target="#{scope}"><template><solid-objects-batch-refresh data-batch="#{batch}" data-revision="#{instance_id}:#{revision}" data-targets="#{targets}" data-source="#{source}"></solid-objects-batch-refresh></template></turbo-stream>)
@@ -104,8 +104,8 @@ module SolidObjects
104
104
  end
105
105
  private_class_method :display_value
106
106
 
107
- # @rbs (ComponentRegistration, Integer, Integer) -> String
108
- def morph_component_refresh(registration, instance_id, revision)
107
+ # @rbs (registration: ComponentRegistration, instance_id: Integer, revision: Integer) -> String
108
+ def morph_component_refresh(registration:, instance_id:, revision:)
109
109
  source = ERB::Util.html_escape(
110
110
  registration.refresh_url(instance_id, revision)
111
111
  )
@@ -1,5 +1,5 @@
1
1
  # rbs_inline: enabled
2
2
 
3
3
  module SolidObjects
4
- VERSION = "0.11.0"
4
+ VERSION = "0.12.0"
5
5
  end
data/lib/solid_objects.rb CHANGED
@@ -21,6 +21,7 @@ require "solid_objects/serialization"
21
21
  require "solid_objects/context"
22
22
  require "solid_objects/actor_registry"
23
23
  require "solid_objects/state"
24
+ require "solid_objects/operation_dispatcher"
24
25
  require "solid_objects/actor_definition"
25
26
  require "solid_objects/application_write_guard"
26
27
  require "solid_objects/actor"
@@ -39,7 +39,7 @@ module SolidObjects
39
39
  # @rbs () -> untyped
40
40
  def component_view_context: () -> untyped
41
41
 
42
- # @rbs (ComponentRegistration, ActorSnapshot, untyped) -> String
43
- def component_frame: (ComponentRegistration, ActorSnapshot, untyped) -> String
42
+ # @rbs (registration: ComponentRegistration, snapshot: ActorSnapshot, rendered: untyped) -> String
43
+ def component_frame: (registration: ComponentRegistration, snapshot: ActorSnapshot, rendered: untyped) -> String
44
44
  end
45
45
  end
@@ -7,16 +7,16 @@ module SolidObjects
7
7
 
8
8
  attr_reader arguments(): untyped
9
9
 
10
- attr_reader success_message_name(): untyped
10
+ attr_reader success_operation(): untyped
11
11
 
12
- attr_reader failure_message_name(): untyped
12
+ attr_reader failure_operation(): untyped
13
13
 
14
- def self.new: (untyped name, untyped arguments, untyped success_message_name, untyped failure_message_name) -> instance
15
- | (name: untyped, arguments: untyped, success_message_name: untyped, failure_message_name: untyped) -> instance
14
+ def self.new: (untyped name, untyped arguments, untyped success_operation, untyped failure_operation) -> instance
15
+ | (name: untyped, arguments: untyped, success_operation: untyped, failure_operation: untyped) -> instance
16
16
 
17
- def self.members: () -> [ :name, :arguments, :success_message_name, :failure_message_name ]
17
+ def self.members: () -> [ :name, :arguments, :success_operation, :failure_operation ]
18
18
 
19
- def members: () -> [ :name, :arguments, :success_message_name, :failure_message_name ]
19
+ def members: () -> [ :name, :arguments, :success_operation, :failure_operation ]
20
20
  end
21
21
 
22
22
  class CommitActionIntent < Data
@@ -56,7 +56,7 @@ module SolidObjects
56
56
 
57
57
  attr_reader actor_id(): untyped
58
58
 
59
- attr_reader message_name(): untyped
59
+ attr_reader operation(): untyped
60
60
 
61
61
  attr_reader arguments(): untyped
62
62
 
@@ -64,12 +64,12 @@ module SolidObjects
64
64
 
65
65
  attr_reader idempotency_key(): untyped
66
66
 
67
- def self.new: (untyped actor_type, untyped actor_id, untyped message_name, untyped arguments, untyped available_at, untyped idempotency_key) -> instance
68
- | (actor_type: untyped, actor_id: untyped, message_name: untyped, arguments: untyped, available_at: untyped, idempotency_key: untyped) -> instance
67
+ def self.new: (untyped actor_type, untyped actor_id, untyped operation, untyped arguments, untyped available_at, untyped idempotency_key) -> instance
68
+ | (actor_type: untyped, actor_id: untyped, operation: untyped, arguments: untyped, available_at: untyped, idempotency_key: untyped) -> instance
69
69
 
70
- def self.members: () -> [ :actor_type, :actor_id, :message_name, :arguments, :available_at, :idempotency_key ]
70
+ def self.members: () -> [ :actor_type, :actor_id, :operation, :arguments, :available_at, :idempotency_key ]
71
71
 
72
- def members: () -> [ :actor_type, :actor_id, :message_name, :arguments, :available_at, :idempotency_key ]
72
+ def members: () -> [ :actor_type, :actor_id, :operation, :arguments, :available_at, :idempotency_key ]
73
73
  end
74
74
 
75
75
  # @rbs (Class) -> void
@@ -157,11 +157,11 @@ module SolidObjects
157
157
  # @rbs (Symbol | String, **untyped) -> nil
158
158
  def commit_action: (Symbol | String, **untyped) -> nil
159
159
 
160
- # @rbs (Symbol | String, at: Time, ?every: Numeric?, ?missed: Symbol | String, arguments: Hash[Symbol | String, untyped]) -> nil
161
- def schedule: (Symbol | String, at: Time, arguments: Hash[Symbol | String, untyped], ?every: Numeric?, ?missed: Symbol | String) -> nil
160
+ # @rbs (at: Time, ?every: Numeric?, ?missed: Symbol | String) -> OperationDispatcher
161
+ def schedule: (at: Time, ?every: Numeric?, ?missed: Symbol | String) -> OperationDispatcher
162
162
 
163
- # @rbs (Reference, Symbol | String, ?available_at: Time?, ?idempotency_key: String?, **untyped) -> nil
164
- def send_to: (Reference, Symbol | String, ?available_at: Time?, ?idempotency_key: String?, **untyped) -> nil
163
+ # @rbs (Reference, ?available_at: Time?, ?idempotency_key: String?) -> OperationDispatcher
164
+ def send_to: (Reference, ?available_at: Time?, ?idempotency_key: String?) -> OperationDispatcher
165
165
 
166
166
  # @rbs (Symbol | String, Hash[String, untyped]) -> untyped
167
167
  def invoke: (Symbol | String, Hash[String, untyped]) -> untyped
@@ -178,8 +178,8 @@ module SolidObjects
178
178
  # @rbs () -> void
179
179
  def deactivate: () -> void
180
180
 
181
- # @rbs (Reference, Symbol | String, Hash[Symbol | String, untyped], ?available_at: Time?, idempotency_key: String?) -> OutboundMessageIntent
182
- def stage_outbound_message: (Reference, Symbol | String, Hash[Symbol | String, untyped], idempotency_key: String?, ?available_at: Time?) -> OutboundMessageIntent
181
+ # @rbs (reference: Reference, operation: Symbol | String, arguments: Hash[Symbol | String, untyped], ?available_at: Time?, idempotency_key: String?) -> OutboundMessageIntent
182
+ def stage_outbound_message: (reference: Reference, operation: Symbol | String, arguments: Hash[Symbol | String, untyped], idempotency_key: String?, ?available_at: Time?) -> OutboundMessageIntent
183
183
 
184
184
  # @rbs () -> Array[EffectIntent]
185
185
  def drain_effect_intents: () -> Array[EffectIntent]
@@ -94,8 +94,8 @@ module SolidObjects
94
94
  # @rbs (Integer) -> Integer
95
95
  def set_state_version: (Integer) -> Integer
96
96
 
97
- # @rbs (Integer, Integer, Proc) -> StateMigration
98
- def add_state_migration: (Integer, Integer, Proc) -> StateMigration
97
+ # @rbs (from: Integer, to: Integer, block: Proc) -> StateMigration
98
+ def add_state_migration: (from: Integer, to: Integer, block: Proc) -> StateMigration
99
99
 
100
100
  # @rbs (Integer, Hash[String, untyped]) -> Hash[String, untyped]
101
101
  def migrate_state: (Integer, Hash[String, untyped]) -> Hash[String, untyped]
@@ -118,7 +118,7 @@ module SolidObjects
118
118
  # @rbs (Array[Symbol]) -> void
119
119
  def validate_attribute_methods!: (Array[Symbol]) -> void
120
120
 
121
- # @rbs (Hash[Symbol, Handler], Symbol | String, Proc) -> Handler
122
- def add_handler: (Hash[Symbol, Handler], Symbol | String, Proc) -> Handler
121
+ # @rbs (collection: Hash[Symbol, Handler], name: Symbol | String, block: Proc) -> Handler
122
+ def add_handler: (collection: Hash[Symbol, Handler], name: Symbol | String, block: Proc) -> Handler
123
123
  end
124
124
  end
@@ -7,11 +7,11 @@ module SolidObjects
7
7
  # @rbs (?mailbox: Mailbox) -> void
8
8
  def initialize: (?mailbox: Mailbox) -> void
9
9
 
10
- # @rbs (Reference, Symbol | String, Hash[Symbol | String, untyped], ?available_at: Time?, ?idempotency_key: String?, ?authorization_context: untyped) -> MessageReference
11
- def async: (Reference, Symbol | String, Hash[Symbol | String, untyped], ?available_at: Time?, ?idempotency_key: String?, ?authorization_context: untyped) -> MessageReference
10
+ # @rbs (reference: Reference, operation: Symbol | String, arguments: Hash[Symbol | String, untyped], ?available_at: Time?, ?idempotency_key: String?, ?authorization_context: untyped) -> MessageReference
11
+ def async: (reference: Reference, operation: Symbol | String, arguments: Hash[Symbol | String, untyped], ?available_at: Time?, ?idempotency_key: String?, ?authorization_context: untyped) -> MessageReference
12
12
 
13
- # @rbs (Reference, Symbol | String, Hash[Symbol | String, untyped], timeout: Numeric, ?idempotency_key: String?, ?authorization_context: untyped) -> untyped
14
- def sync: (Reference, Symbol | String, Hash[Symbol | String, untyped], timeout: Numeric, ?idempotency_key: String?, ?authorization_context: untyped) -> untyped
13
+ # @rbs (reference: Reference, operation: Symbol | String, arguments: Hash[Symbol | String, untyped], timeout: Numeric, ?idempotency_key: String?, ?authorization_context: untyped) -> untyped
14
+ def sync: (reference: Reference, operation: Symbol | String, arguments: Hash[Symbol | String, untyped], timeout: Numeric, ?idempotency_key: String?, ?authorization_context: untyped) -> untyped
15
15
 
16
16
  # @rbs (MessageReference, timeout: Numeric, ?authorization_context: untyped) -> untyped
17
17
  def wait: (MessageReference, timeout: Numeric, ?authorization_context: untyped) -> untyped
@@ -26,8 +26,8 @@ module SolidObjects
26
26
 
27
27
  attr_reader mailbox: untyped
28
28
 
29
- # @rbs (Reference, Symbol | String, Hash[Symbol | String, untyped], idempotency_key: String?, timeout: Numeric) -> MessageReference
30
- def enqueue_sync: (Reference, Symbol | String, Hash[Symbol | String, untyped], idempotency_key: String?, timeout: Numeric) -> MessageReference
29
+ # @rbs (reference: Reference, operation: Symbol | String, arguments: Hash[Symbol | String, untyped], idempotency_key: String?, timeout: Numeric) -> MessageReference
30
+ def enqueue_sync: (reference: Reference, operation: Symbol | String, arguments: Hash[Symbol | String, untyped], idempotency_key: String?, timeout: Numeric) -> MessageReference
31
31
 
32
32
  # @rbs (MessageReference, Message) -> void
33
33
  def validate_message_reference!: (MessageReference, Message) -> void
@@ -35,8 +35,8 @@ module SolidObjects
35
35
  # @rbs (Reference, Symbol | String) -> void
36
36
  def reject_sync_inside_transaction!: (Reference, Symbol | String) -> void
37
37
 
38
- # @rbs (Proc, Reference, Symbol | String, Hash[Symbol | String, untyped], authorization_context: untyped) -> void
39
- def authorize!: (Proc, Reference, Symbol | String, Hash[Symbol | String, untyped], authorization_context: untyped) -> void
38
+ # @rbs (hook: Proc, reference: Reference, operation: Symbol | String, arguments: Hash[Symbol | String, untyped], authorization_context: untyped) -> void
39
+ def authorize!: (hook: Proc, reference: Reference, operation: Symbol | String, arguments: Hash[Symbol | String, untyped], authorization_context: untyped) -> void
40
40
 
41
41
  # @rbs (Reference, authorization_context: untyped) -> void
42
42
  def authorize_destroy!: (Reference, authorization_context: untyped) -> void
@@ -73,8 +73,8 @@ module SolidObjects
73
73
  # @rbs () -> Hash[String, untyped]
74
74
  def authorization_arguments: () -> Hash[String, untyped]
75
75
 
76
- # @rbs (Array[ComponentRegistration], Integer, Integer) -> String
77
- def batch_refresh_url: (Array[ComponentRegistration], Integer, Integer) -> String
76
+ # @rbs (registrations: Array[ComponentRegistration], instance_id: Integer, revision: Integer) -> String
77
+ def batch_refresh_url: (registrations: Array[ComponentRegistration], instance_id: Integer, revision: Integer) -> String
78
78
 
79
79
  # @rbs (Integer, Integer) -> String
80
80
  def refresh_url: (Integer, Integer) -> String
@@ -33,16 +33,16 @@ module SolidObjects
33
33
 
34
34
  # Live invalidations and reconnect replays share this, so a reconnecting
35
35
  # client pays the same number of requests a connected one does.
36
- # @rbs (Array[ComponentRegistration], Integer, Integer) -> Array[String]
37
- def refresh_streams: (Array[ComponentRegistration], Integer, Integer) -> Array[String]
36
+ # @rbs (changed: Array[ComponentRegistration], instance_id: Integer, revision: Integer) -> Array[String]
37
+ def refresh_streams: (changed: Array[ComponentRegistration], instance_id: Integer, revision: Integer) -> Array[String]
38
38
 
39
- # @rbs (ComponentRegistration, Integer, Integer) -> void
40
- def record_revision: (ComponentRegistration, Integer, Integer) -> void
39
+ # @rbs (registration: ComponentRegistration, instance_id: Integer, revision: Integer) -> void
40
+ def record_revision: (registration: ComponentRegistration, instance_id: Integer, revision: Integer) -> void
41
41
 
42
- # @rbs (ComponentRegistration, Integer, Integer) -> String
43
- def refresh: (ComponentRegistration, Integer, Integer) -> String
42
+ # @rbs (registration: ComponentRegistration, instance_id: Integer, revision: Integer) -> String
43
+ def refresh: (registration: ComponentRegistration, instance_id: Integer, revision: Integer) -> String
44
44
 
45
- # @rbs (String, Integer, Integer) -> bool
46
- def newer_revision?: (String, Integer, Integer) -> bool
45
+ # @rbs (dom_id: String, instance_id: Integer, revision: Integer) -> bool
46
+ def newer_revision?: (dom_id: String, instance_id: Integer, revision: Integer) -> bool
47
47
  end
48
48
  end
@@ -49,6 +49,9 @@ module SolidObjects
49
49
  # @rbs (Exception) -> bool
50
50
  def deadline_error?: (Exception) -> bool
51
51
 
52
+ # @rbs (Exception) -> bool
53
+ def reconnect_blocked_error?: (Exception) -> bool
54
+
52
55
  # @rbs (Exception) -> bool
53
56
  def busy_error?: (Exception) -> bool
54
57
 
@@ -76,7 +76,7 @@ module SolidObjects
76
76
  # @rbs (Effect) -> void
77
77
  def verify_claim!: (Effect) -> void
78
78
 
79
- # @rbs (Effect, String?, String, Hash[String, untyped]) -> Message?
80
- def enqueue_result_message: (Effect, String?, String, Hash[String, untyped]) -> Message?
79
+ # @rbs (effect: Effect, operation: String?, outcome: String, arguments: Hash[String, untyped]) -> Message?
80
+ def enqueue_result_message: (effect: Effect, operation: String?, outcome: String, arguments: Hash[String, untyped]) -> Message?
81
81
  end
82
82
  end
@@ -71,7 +71,7 @@ module SolidObjects
71
71
 
72
72
  @actor_id: String
73
73
 
74
- @message_name: String
74
+ @operation: String
75
75
 
76
76
  attr_reader timeout: untyped
77
77
 
@@ -79,10 +79,10 @@ module SolidObjects
79
79
 
80
80
  attr_reader actor_id: untyped
81
81
 
82
- attr_reader message_name: untyped
82
+ attr_reader operation: untyped
83
83
 
84
- # @rbs (timeout: Numeric, actor_type: String, actor_id: String, message_name: String) -> void
85
- def initialize: (timeout: Numeric, actor_type: String, actor_id: String, message_name: String) -> void
84
+ # @rbs (timeout: Numeric, actor_type: String, actor_id: String, operation: String) -> void
85
+ def initialize: (timeout: Numeric, actor_type: String, actor_id: String, operation: String) -> void
86
86
  end
87
87
 
88
88
  class SyncTimeout < Error
@@ -92,7 +92,7 @@ module SolidObjects
92
92
 
93
93
  @actor_id: String
94
94
 
95
- @message_name: String
95
+ @operation: String
96
96
 
97
97
  @message_id: Integer
98
98
 
@@ -114,7 +114,7 @@ module SolidObjects
114
114
 
115
115
  attr_reader actor_id: untyped
116
116
 
117
- attr_reader message_name: untyped
117
+ attr_reader operation: untyped
118
118
 
119
119
  attr_reader message_id: untyped
120
120
 
@@ -130,8 +130,8 @@ module SolidObjects
130
130
 
131
131
  attr_reader blocker: untyped
132
132
 
133
- # @rbs (timeout: Numeric, actor_type: String, actor_id: String, message_name: String, message_id: Integer, request_id: String, sequence: Integer, status: String, waiting_on: String, activation: Hash[String, untyped], blocker: Hash[String, untyped]?) -> void
134
- def initialize: (timeout: Numeric, actor_type: String, actor_id: String, message_name: String, message_id: Integer, request_id: String, sequence: Integer, status: String, waiting_on: String, activation: Hash[String, untyped], blocker: Hash[String, untyped]?) -> void
133
+ # @rbs (timeout: Numeric, actor_type: String, actor_id: String, operation: String, message_id: Integer, request_id: String, sequence: Integer, status: String, waiting_on: String, activation: Hash[String, untyped], blocker: Hash[String, untyped]?) -> void
134
+ def initialize: (timeout: Numeric, actor_type: String, actor_id: String, operation: String, message_id: Integer, request_id: String, sequence: Integer, status: String, waiting_on: String, activation: Hash[String, untyped], blocker: Hash[String, untyped]?) -> void
135
135
 
136
136
  # @rbs () -> MessageReference
137
137
  def message_reference: () -> MessageReference
@@ -142,16 +142,16 @@ module SolidObjects
142
142
 
143
143
  @actor_id: String
144
144
 
145
- @message_name: String
145
+ @operation: String
146
146
 
147
147
  attr_reader actor_type: untyped
148
148
 
149
149
  attr_reader actor_id: untyped
150
150
 
151
- attr_reader message_name: untyped
151
+ attr_reader operation: untyped
152
152
 
153
- # @rbs (actor_type: String, actor_id: String, message_name: String) -> void
154
- def initialize: (actor_type: String, actor_id: String, message_name: String) -> void
153
+ # @rbs (actor_type: String, actor_id: String, operation: String) -> void
154
+ def initialize: (actor_type: String, actor_id: String, operation: String) -> void
155
155
  end
156
156
 
157
157
  class ApplicationWriteForbidden < NonRetryableError
@@ -159,21 +159,21 @@ module SolidObjects
159
159
 
160
160
  @actor_id: String
161
161
 
162
- @message_name: String
162
+ @operation: String
163
163
 
164
164
  attr_reader actor_type: untyped
165
165
 
166
166
  attr_reader actor_id: untyped
167
167
 
168
- attr_reader message_name: untyped
168
+ attr_reader operation: untyped
169
169
 
170
- # @rbs (actor_type: String, actor_id: String, message_name: String) -> void
171
- def initialize: (actor_type: String, actor_id: String, message_name: String) -> void
170
+ # @rbs (actor_type: String, actor_id: String, operation: String) -> void
171
+ def initialize: (actor_type: String, actor_id: String, operation: String) -> void
172
172
  end
173
173
 
174
174
  class CommitActionUnavailable < NonRetryableError
175
- # @rbs (actor_type: String, actor_id: String, message_name: String) -> void
176
- def initialize: (actor_type: String, actor_id: String, message_name: String) -> void
175
+ # @rbs (actor_type: String, actor_id: String, operation: String) -> void
176
+ def initialize: (actor_type: String, actor_id: String, operation: String) -> void
177
177
  end
178
178
 
179
179
  class UnknownCommitAction < NonRetryableError
@@ -36,14 +36,14 @@ module SolidObjects
36
36
  # @rbs (Array[Actor::CommitActionIntent]) -> void
37
37
  def execute_commit_actions: (Array[Actor::CommitActionIntent]) -> void
38
38
 
39
- # @rbs (Actor::CommitActionIntent, Proc, CommitActionContext) -> untyped
40
- def execute_commit_action: (Actor::CommitActionIntent, Proc, CommitActionContext) -> untyped
39
+ # @rbs (intent: Actor::CommitActionIntent, handler: Proc, context: CommitActionContext) -> untyped
40
+ def execute_commit_action: (intent: Actor::CommitActionIntent, handler: Proc, context: CommitActionContext) -> untyped
41
41
 
42
42
  # @rbs () -> void
43
43
  def ensure_application_database_is_shared!: () -> void
44
44
 
45
- # @rbs (Message, Instance, Array[Actor::EffectIntent]) -> Array[Effect]
46
- def enqueue_effects: (Message, Instance, Array[Actor::EffectIntent]) -> Array[Effect]
45
+ # @rbs (message: Message, instance: Instance, intents: Array[Actor::EffectIntent]) -> Array[Effect]
46
+ def enqueue_effects: (message: Message, instance: Instance, intents: Array[Actor::EffectIntent]) -> Array[Effect]
47
47
 
48
48
  # A reminder is one named alarm per actor, so scheduling a name that is
49
49
  # already armed moves it rather than adding a second. An actor that arms a
@@ -62,11 +62,11 @@ module SolidObjects
62
62
  # @rbs (Reminder, Time?) -> Hash[Symbol, untyped]?
63
63
  def moved_reminder_payload: (Reminder, Time?) -> Hash[Symbol, untyped]?
64
64
 
65
- # @rbs (Message, Instance, Array[Actor::OutboundMessageIntent]) -> Array[Effect]
66
- def enqueue_actor_messages: (Message, Instance, Array[Actor::OutboundMessageIntent]) -> Array[Effect]
65
+ # @rbs (message: Message, instance: Instance, intents: Array[Actor::OutboundMessageIntent]) -> Array[Effect]
66
+ def enqueue_actor_messages: (message: Message, instance: Instance, intents: Array[Actor::OutboundMessageIntent]) -> Array[Effect]
67
67
 
68
- # @rbs (Message, Instance, Hash[String, untyped], state_changed: bool) -> void
69
- def enqueue_broadcasts: (Message, Instance, Hash[String, untyped], state_changed: bool) -> void
68
+ # @rbs (message: Message, instance: Instance, observable_changes: Hash[String, untyped], state_changed: bool) -> void
69
+ def enqueue_broadcasts: (message: Message, instance: Instance, observable_changes: Hash[String, untyped], state_changed: bool) -> void
70
70
 
71
71
  # @rbs () -> bool
72
72
  def payload_broadcasts?: () -> bool
@@ -83,8 +83,8 @@ module SolidObjects
83
83
  # @rbs (Exception) -> Hash[String, untyped]
84
84
  def serialized_error: (Exception) -> Hash[String, untyped]
85
85
 
86
- # @rbs (Message, Hash[String, untyped], Time) -> DeadLetter
87
- def create_dead_letter: (Message, Hash[String, untyped], Time) -> DeadLetter
86
+ # @rbs (message: Message, error_details: Hash[String, untyped], now: Time) -> DeadLetter
87
+ def create_dead_letter: (message: Message, error_details: Hash[String, untyped], now: Time) -> DeadLetter
88
88
 
89
89
  # @rbs () -> Hash[Symbol, untyped]
90
90
  def instrumentation_payload: () -> Hash[Symbol, untyped]
@@ -8,8 +8,8 @@ module SolidObjects
8
8
  # @rbs (instance_id: Integer, owner_id: String, ?activation_token: String, ?duration: Numeric, ?database_adapter: DatabaseAdapter) -> Lease?
9
9
  def self.acquire: (instance_id: Integer, owner_id: String, ?activation_token: String, ?duration: Numeric, ?database_adapter: DatabaseAdapter) -> Lease?
10
10
 
11
- # @rbs (Instance, String, Time) -> bool
12
- private def self.held_by_another_live_owner?: (Instance, String, Time) -> bool
11
+ # @rbs (instance: Instance, activation_token: String, now: Time) -> bool
12
+ private def self.held_by_another_live_owner?: (instance: Instance, activation_token: String, now: Time) -> bool
13
13
 
14
14
  @database_adapter: DatabaseAdapter
15
15
 
@@ -9,11 +9,11 @@ module SolidObjects
9
9
  # @rbs (?database_adapter: DatabaseAdapter) -> void
10
10
  def initialize: (?database_adapter: DatabaseAdapter) -> void
11
11
 
12
- # @rbs (Reference, Symbol | String, Hash[Symbol | String, untyped], kind: String, ?available_at: Time?, idempotency_key: String?) -> MessageReference
13
- def enqueue: (Reference, Symbol | String, Hash[Symbol | String, untyped], kind: String, idempotency_key: String?, ?available_at: Time?) -> MessageReference
12
+ # @rbs (reference: Reference, operation: Symbol | String, arguments: Hash[Symbol | String, untyped], delivery_mode: String, ?available_at: Time?, idempotency_key: String?) -> MessageReference
13
+ def enqueue: (reference: Reference, operation: Symbol | String, arguments: Hash[Symbol | String, untyped], delivery_mode: String, idempotency_key: String?, ?available_at: Time?) -> MessageReference
14
14
 
15
- # @rbs (Reference, Symbol | String, Hash[Symbol | String, untyped], kind: String, ?available_at: Time?, idempotency_key: String?, ?actor_class: Class?) -> Message
16
- def enqueue_in_transaction: (Reference, Symbol | String, Hash[Symbol | String, untyped], kind: String, idempotency_key: String?, ?available_at: Time?, ?actor_class: Class?) -> Message
15
+ # @rbs (reference: Reference, operation: Symbol | String, arguments: Hash[Symbol | String, untyped], delivery_mode: String, ?available_at: Time?, idempotency_key: String?, ?actor_class: Class?) -> Message
16
+ def enqueue_in_transaction: (reference: Reference, operation: Symbol | String, arguments: Hash[Symbol | String, untyped], delivery_mode: String, idempotency_key: String?, ?available_at: Time?, ?actor_class: Class?) -> Message
17
17
 
18
18
  # @rbs (Message) -> void
19
19
  def announce: (Message) -> void
@@ -31,14 +31,14 @@ module SolidObjects
31
31
  # @rbs (Instance, String?) -> Message?
32
32
  def find_idempotent_message: (Instance, String?) -> Message?
33
33
 
34
- # @rbs (Message, Symbol | String, String, untyped) -> Message
35
- def validate_idempotent_message!: (Message, Symbol | String, String, untyped) -> Message
34
+ # @rbs (existing_message: Message, operation: Symbol | String, delivery_mode: String, arguments: untyped) -> Message
35
+ def validate_idempotent_message!: (existing_message: Message, operation: Symbol | String, delivery_mode: String, arguments: untyped) -> Message
36
36
 
37
37
  # @rbs (Instance) -> void
38
38
  def enforce_mailbox_limit!: (Instance) -> void
39
39
 
40
- # @rbs (Instance, Reference, Symbol | String, untyped, kind: String, available_at: Time?, idempotency_key: String?) -> Message
41
- def create_message: (Instance, Reference, Symbol | String, untyped, kind: String, available_at: Time?, idempotency_key: String?) -> Message
40
+ # @rbs (instance: Instance, reference: Reference, operation: Symbol | String, arguments: untyped, delivery_mode: String, available_at: Time?, idempotency_key: String?) -> Message
41
+ def create_message: (instance: Instance, reference: Reference, operation: Symbol | String, arguments: untyped, delivery_mode: String, available_at: Time?, idempotency_key: String?) -> Message
42
42
 
43
43
  # @rbs (Time?, Time) -> Time
44
44
  def normalize_availability: (Time?, Time) -> Time
@@ -0,0 +1,35 @@
1
+ # Generated from lib/solid_objects/operation_dispatcher.rb with RBS::Inline
2
+
3
+ module SolidObjects
4
+ class OperationDispatcher
5
+ @actor_type: String
6
+
7
+ @handlers: Hash[Symbol, ActorDefinition::Handler]
8
+
9
+ @dispatch: Proc
10
+
11
+ # @rbs (actor_type: String, handlers: Hash[Symbol, ActorDefinition::Handler]) { (Symbol, Hash[Symbol, untyped]) -> untyped } -> void
12
+ def initialize: (actor_type: String, handlers: Hash[Symbol, ActorDefinition::Handler]) { (Symbol, Hash[Symbol, untyped]) -> untyped } -> void
13
+
14
+ # @rbs (Symbol, *untyped, **untyped) -> untyped
15
+ def method_missing: (Symbol, *untyped, **untyped) -> untyped
16
+
17
+ # @rbs (Symbol, bool) -> bool
18
+ def respond_to_missing?: (Symbol, bool) -> bool
19
+
20
+ private
21
+
22
+ attr_reader actor_type: untyped
23
+
24
+ attr_reader handlers: untyped
25
+
26
+ attr_reader dispatch: untyped
27
+
28
+ RESERVED_REFERENCE_METHOD_NAMES: untyped
29
+
30
+ RESERVED_OPERATION_NAMES: untyped
31
+
32
+ # @rbs (Symbol | String) -> void
33
+ def self.validate_operation_name!: (Symbol | String) -> void
34
+ end
35
+ end
@@ -13,11 +13,11 @@ module SolidObjects
13
13
  # @rbs (actor_type: String, actor_id: String) -> void
14
14
  def initialize: (actor_type: String, actor_id: String) -> void
15
15
 
16
- # @rbs (Symbol | String, ?available_at: Time?, ?idempotency_key: String?, ?authorization_context: untyped, **untyped) -> MessageReference?
17
- def async: (Symbol | String, ?available_at: Time?, ?idempotency_key: String?, ?authorization_context: untyped, **untyped) -> MessageReference?
16
+ # @rbs (?available_at: Time?, ?idempotency_key: String?, ?authorization_context: untyped) -> OperationDispatcher
17
+ def async: (?available_at: Time?, ?idempotency_key: String?, ?authorization_context: untyped) -> OperationDispatcher
18
18
 
19
- # @rbs (Symbol | String, ?timeout: Numeric, ?idempotency_key: String?, ?authorization_context: untyped, **untyped) -> untyped
20
- def sync: (Symbol | String, ?timeout: Numeric, ?idempotency_key: String?, ?authorization_context: untyped, **untyped) -> untyped
19
+ # @rbs (?timeout: Numeric, ?idempotency_key: String?, ?authorization_context: untyped) -> OperationDispatcher
20
+ def sync: (?timeout: Numeric, ?idempotency_key: String?, ?authorization_context: untyped) -> OperationDispatcher
21
21
 
22
22
  # @rbs (?authorization_context: untyped) -> bool
23
23
  def destroy: (?authorization_context: untyped) -> bool
@@ -36,6 +36,9 @@ module SolidObjects
36
36
 
37
37
  private
38
38
 
39
+ # @rbs (Symbol | String, Hash[Symbol, untyped], timeout: Numeric, idempotency_key: String?, authorization_context: untyped) -> untyped
40
+ def invoke_synchronously: (Symbol | String, Hash[Symbol, untyped], timeout: Numeric, idempotency_key: String?, authorization_context: untyped) -> untyped
41
+
39
42
  # @rbs (Symbol | String) -> bool
40
43
  def actor_message?: (Symbol | String) -> bool
41
44
 
@@ -19,8 +19,8 @@ module SolidObjects
19
19
  # @rbs (Message) -> String
20
20
  def message_status: (Message) -> String
21
21
 
22
- # @rbs (Message, Instance, Message?) -> String
23
- def waiting_reason: (Message, Instance, Message?) -> String
22
+ # @rbs (message: Message, instance: Instance, blocker: Message?) -> String
23
+ def waiting_reason: (message: Message, instance: Instance, blocker: Message?) -> String
24
24
 
25
25
  # @rbs (ReadyMessage?) -> bool
26
26
  def future?: (ReadyMessage?) -> bool