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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +17 -0
- data/MIT-LICENSE +19 -0
- data/README.md +744 -0
- data/Rakefile +40 -0
- data/app/controllers/solid_objects/application_controller.rb +23 -0
- data/app/controllers/solid_objects/dead_letters_controller.rb +23 -0
- data/app/controllers/solid_objects/instances_controller.rb +29 -0
- data/app/helpers/solid_objects/actor_helper.rb +25 -0
- data/app/models/solid_objects/broadcast.rb +10 -0
- data/app/models/solid_objects/claimed_message.rb +14 -0
- data/app/models/solid_objects/dead_letter.rb +13 -0
- data/app/models/solid_objects/effect.rb +10 -0
- data/app/models/solid_objects/instance.rb +93 -0
- data/app/models/solid_objects/message.rb +53 -0
- data/app/models/solid_objects/process.rb +13 -0
- data/app/models/solid_objects/ready_message.rb +10 -0
- data/app/models/solid_objects/record.rb +17 -0
- data/app/models/solid_objects/reminder.rb +9 -0
- data/app/views/solid_objects/dead_letters/index.html.erb +26 -0
- data/app/views/solid_objects/instances/index.html.erb +24 -0
- data/app/views/solid_objects/instances/show.html.erb +35 -0
- data/benchmark/activation_cache.rb +5 -0
- data/benchmark/ask_latency.rb +5 -0
- data/benchmark/claim.rb +5 -0
- data/benchmark/cold_actors.rb +5 -0
- data/benchmark/concurrent_actors.rb +5 -0
- data/benchmark/enqueue.rb +5 -0
- data/benchmark/hot_actor.rb +5 -0
- data/benchmark/processing.rb +5 -0
- data/benchmark/query_count.rb +5 -0
- data/benchmark/support.rb +271 -0
- data/config/routes.rb +8 -0
- data/db/migrate/20260805000000_create_solid_objects_tables.rb +319 -0
- data/docs/adr/0001-postgresql-backend.md +21 -0
- data/docs/adr/0002-jsonb-actor-state.md +21 -0
- data/docs/adr/0003-mailbox-ordering.md +30 -0
- data/docs/adr/0004-activation-leasing.md +21 -0
- data/docs/adr/0005-fencing-tokens.md +25 -0
- data/docs/adr/0006-at-least-once-delivery.md +24 -0
- data/docs/adr/0007-transactional-outbox.md +21 -0
- data/docs/adr/0008-actor-communication.md +21 -0
- data/docs/adr/0009-realtime-updates.md +21 -0
- data/docs/adr/0010-state-versioning.md +29 -0
- data/docs/adr/0011-wake-up-strategy.md +34 -0
- data/docs/adr/0012-not-active-jobs.md +21 -0
- data/docs/adr/0013-database-adapters.md +48 -0
- data/docs/architecture.md +615 -0
- data/docs/benchmarks.md +26 -0
- data/docs/correctness.md +124 -0
- data/docs/database-schema.md +111 -0
- data/docs/development.md +87 -0
- data/docs/implementation-plan.md +518 -0
- data/docs/operations.md +123 -0
- data/docs/realtime.md +51 -0
- data/docs/research/solid_queue.md +545 -0
- data/docs/roadmap.md +53 -0
- data/docs/security.md +61 -0
- data/docs/state-migrations.md +46 -0
- data/examples/application/README.md +16 -0
- data/examples/application/app/actors/chat_room_actor.rb +34 -0
- data/examples/application/app/actors/shopping_cart_actor.rb +79 -0
- data/examples/application/app/controllers/cart_controller.rb +54 -0
- data/examples/application/app/controllers/chat_rooms_controller.rb +44 -0
- data/examples/application/app/views/actors/chat_room_actor/_messages.html.erb +8 -0
- data/examples/application/app/views/actors/shopping_cart_actor/_summary.html.erb +10 -0
- data/examples/application/app/views/cart/show.html.erb +13 -0
- data/examples/application/app/views/chat_rooms/show.html.erb +8 -0
- data/examples/application/config/initializers/solid_objects.rb +23 -0
- data/examples/application/config/routes.rb +20 -0
- data/exe/solid_objects +9 -0
- data/lib/generators/solid_objects/install_generator.rb +21 -0
- data/lib/generators/solid_objects/templates/solid_objects.rb +13 -0
- data/lib/solid_objects/action_cable_broadcast_adapter.rb +19 -0
- data/lib/solid_objects/activation.rb +183 -0
- data/lib/solid_objects/activation_manager.rb +102 -0
- data/lib/solid_objects/actor.rb +271 -0
- data/lib/solid_objects/actor_channel.rb +29 -0
- data/lib/solid_objects/actor_definition.rb +212 -0
- data/lib/solid_objects/actor_registry.rb +65 -0
- data/lib/solid_objects/actor_snapshot.rb +42 -0
- data/lib/solid_objects/actor_view.rb +117 -0
- data/lib/solid_objects/broadcast_executor.rb +162 -0
- data/lib/solid_objects/cli.rb +118 -0
- data/lib/solid_objects/client.rb +153 -0
- data/lib/solid_objects/configuration.rb +168 -0
- data/lib/solid_objects/context.rb +41 -0
- data/lib/solid_objects/database_adapter.rb +82 -0
- data/lib/solid_objects/database_adapters/mysql.rb +22 -0
- data/lib/solid_objects/database_adapters/postgresql.rb +17 -0
- data/lib/solid_objects/database_adapters/sqlite.rb +12 -0
- data/lib/solid_objects/dead_letter_manager.rb +47 -0
- data/lib/solid_objects/dom_identity.rb +38 -0
- data/lib/solid_objects/effect_executor.rb +235 -0
- data/lib/solid_objects/effect_registry.rb +34 -0
- data/lib/solid_objects/engine.rb +33 -0
- data/lib/solid_objects/errors.rb +65 -0
- data/lib/solid_objects/executor.rb +290 -0
- data/lib/solid_objects/instrumentation.rb +10 -0
- data/lib/solid_objects/lease.rb +172 -0
- data/lib/solid_objects/lease_renewer.rb +70 -0
- data/lib/solid_objects/log_subscriber.rb +29 -0
- data/lib/solid_objects/mailbox.rb +178 -0
- data/lib/solid_objects/message_reference.rb +52 -0
- data/lib/solid_objects/process_registry.rb +143 -0
- data/lib/solid_objects/reference.rb +96 -0
- data/lib/solid_objects/reminder_scheduler.rb +168 -0
- data/lib/solid_objects/serialization.rb +99 -0
- data/lib/solid_objects/state.rb +111 -0
- data/lib/solid_objects/stream_name.rb +29 -0
- data/lib/solid_objects/stream_token.rb +59 -0
- data/lib/solid_objects/supervisor.rb +87 -0
- data/lib/solid_objects/turbo_stream_renderer.rb +35 -0
- data/lib/solid_objects/version.rb +5 -0
- data/lib/solid_objects/wake_up.rb +28 -0
- data/lib/solid_objects/worker.rb +139 -0
- data/lib/solid_objects.rb +118 -0
- data/sig/generated/controllers/solid_objects/application_controller.rbs +10 -0
- data/sig/generated/controllers/solid_objects/dead_letters_controller.rbs +11 -0
- data/sig/generated/controllers/solid_objects/instances_controller.rbs +11 -0
- data/sig/generated/helpers/solid_objects/actor_helper.rbs +8 -0
- data/sig/generated/lib/generators/solid_objects/install_generator.rbs +13 -0
- data/sig/generated/lib/solid_objects/action_cable_broadcast_adapter.rbs +8 -0
- data/sig/generated/lib/solid_objects/activation.rbs +65 -0
- data/sig/generated/lib/solid_objects/activation_manager.rbs +36 -0
- data/sig/generated/lib/solid_objects/actor.rbs +183 -0
- data/sig/generated/lib/solid_objects/actor_channel.rbs +8 -0
- data/sig/generated/lib/solid_objects/actor_definition.rbs +117 -0
- data/sig/generated/lib/solid_objects/actor_registry.rbs +36 -0
- data/sig/generated/lib/solid_objects/actor_snapshot.rbs +28 -0
- data/sig/generated/lib/solid_objects/actor_view.rbs +56 -0
- data/sig/generated/lib/solid_objects/broadcast_executor.rbs +55 -0
- data/sig/generated/lib/solid_objects/cli.rbs +31 -0
- data/sig/generated/lib/solid_objects/client.rbs +35 -0
- data/sig/generated/lib/solid_objects/configuration.rbs +147 -0
- data/sig/generated/lib/solid_objects/context.rbs +56 -0
- data/sig/generated/lib/solid_objects/database_adapter.rbs +42 -0
- data/sig/generated/lib/solid_objects/database_adapters/mysql.rbs +16 -0
- data/sig/generated/lib/solid_objects/database_adapters/postgresql.rbs +13 -0
- data/sig/generated/lib/solid_objects/database_adapters/sqlite.rbs +10 -0
- data/sig/generated/lib/solid_objects/dead_letter_manager.rbs +16 -0
- data/sig/generated/lib/solid_objects/dom_identity.rbs +20 -0
- data/sig/generated/lib/solid_objects/effect_executor.rbs +82 -0
- data/sig/generated/lib/solid_objects/effect_registry.rbs +24 -0
- data/sig/generated/lib/solid_objects/engine.rbs +7 -0
- data/sig/generated/lib/solid_objects/errors.rbs +64 -0
- data/sig/generated/lib/solid_objects/executor.rbs +60 -0
- data/sig/generated/lib/solid_objects/instrumentation.rbs +8 -0
- data/sig/generated/lib/solid_objects/lease.rbs +57 -0
- data/sig/generated/lib/solid_objects/lease_renewer.rbs +42 -0
- data/sig/generated/lib/solid_objects/log_subscriber.rbs +11 -0
- data/sig/generated/lib/solid_objects/mailbox.rbs +46 -0
- data/sig/generated/lib/solid_objects/message_reference.rbs +37 -0
- data/sig/generated/lib/solid_objects/process_registry.rbs +46 -0
- data/sig/generated/lib/solid_objects/reference.rbs +45 -0
- data/sig/generated/lib/solid_objects/reminder_scheduler.rbs +55 -0
- data/sig/generated/lib/solid_objects/serialization.rbs +31 -0
- data/sig/generated/lib/solid_objects/state.rbs +72 -0
- data/sig/generated/lib/solid_objects/stream_name.rbs +11 -0
- data/sig/generated/lib/solid_objects/stream_token.rbs +19 -0
- data/sig/generated/lib/solid_objects/supervisor.rbs +38 -0
- data/sig/generated/lib/solid_objects/turbo_stream_renderer.rbs +14 -0
- data/sig/generated/lib/solid_objects/version.rbs +5 -0
- data/sig/generated/lib/solid_objects/wake_up.rbs +24 -0
- data/sig/generated/lib/solid_objects/worker.rbs +56 -0
- data/sig/generated/lib/solid_objects.rbs +41 -0
- data/sig/generated/models/solid_objects/broadcast.rbs +6 -0
- data/sig/generated/models/solid_objects/claimed_message.rbs +6 -0
- data/sig/generated/models/solid_objects/dead_letter.rbs +6 -0
- data/sig/generated/models/solid_objects/effect.rbs +6 -0
- data/sig/generated/models/solid_objects/instance.rbs +25 -0
- data/sig/generated/models/solid_objects/message.rbs +22 -0
- data/sig/generated/models/solid_objects/process.rbs +6 -0
- data/sig/generated/models/solid_objects/ready_message.rbs +6 -0
- data/sig/generated/models/solid_objects/record.rbs +8 -0
- data/sig/generated/models/solid_objects/reminder.rbs +6 -0
- data/sig/support/framework.rbs +37 -0
- metadata +467 -0
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# rbs_inline: enabled
|
|
2
|
+
|
|
3
|
+
require "active_record"
|
|
4
|
+
require "active_support"
|
|
5
|
+
require "active_support/core_ext/numeric/bytes"
|
|
6
|
+
require "active_support/core_ext/numeric/time"
|
|
7
|
+
require "active_support/isolated_execution_state"
|
|
8
|
+
require "active_support/notifications"
|
|
9
|
+
require "json"
|
|
10
|
+
require "logger"
|
|
11
|
+
require "securerandom"
|
|
12
|
+
|
|
13
|
+
require "solid_objects/version"
|
|
14
|
+
require "solid_objects/errors"
|
|
15
|
+
require "solid_objects/configuration"
|
|
16
|
+
require "solid_objects/instrumentation"
|
|
17
|
+
require "solid_objects/log_subscriber"
|
|
18
|
+
require "solid_objects/serialization"
|
|
19
|
+
require "solid_objects/context"
|
|
20
|
+
require "solid_objects/actor_registry"
|
|
21
|
+
require "solid_objects/state"
|
|
22
|
+
require "solid_objects/actor_definition"
|
|
23
|
+
require "solid_objects/actor"
|
|
24
|
+
require "solid_objects/reference"
|
|
25
|
+
require "solid_objects/message_reference"
|
|
26
|
+
require "solid_objects/dead_letter_manager"
|
|
27
|
+
require "solid_objects/stream_name"
|
|
28
|
+
require "solid_objects/dom_identity"
|
|
29
|
+
require "solid_objects/stream_token"
|
|
30
|
+
require "solid_objects/turbo_stream_renderer"
|
|
31
|
+
require "solid_objects/actor_snapshot"
|
|
32
|
+
require "solid_objects/actor_view"
|
|
33
|
+
require "solid_objects/action_cable_broadcast_adapter"
|
|
34
|
+
require "solid_objects/wake_up"
|
|
35
|
+
require "solid_objects/effect_registry"
|
|
36
|
+
require "solid_objects/lease"
|
|
37
|
+
require "solid_objects/lease_renewer"
|
|
38
|
+
require "solid_objects/worker"
|
|
39
|
+
require "solid_objects/effect_executor"
|
|
40
|
+
require "solid_objects/reminder_scheduler"
|
|
41
|
+
require "solid_objects/broadcast_executor"
|
|
42
|
+
require "solid_objects/supervisor"
|
|
43
|
+
require "solid_objects/engine" if defined?(Rails::Engine)
|
|
44
|
+
|
|
45
|
+
module SolidObjects
|
|
46
|
+
extend Instrumentation
|
|
47
|
+
|
|
48
|
+
class << self
|
|
49
|
+
# @rbs () -> Configuration
|
|
50
|
+
def configuration
|
|
51
|
+
@configuration ||= Configuration.new
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
# @rbs () { (Configuration) -> void } -> Configuration
|
|
55
|
+
def configure
|
|
56
|
+
yield configuration
|
|
57
|
+
configuration.validate!
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
# @rbs () -> ActorRegistry
|
|
61
|
+
def registry
|
|
62
|
+
@registry ||= ActorRegistry.new
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# @rbs () -> EffectRegistry
|
|
66
|
+
def effect_registry
|
|
67
|
+
@effect_registry ||= EffectRegistry.new
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# @rbs (String | Symbol) { (Hash[String, untyped], EffectContext) -> untyped } -> Proc
|
|
71
|
+
def register_effect(name, &handler)
|
|
72
|
+
effect_registry.register(name, handler)
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# @rbs () -> Client
|
|
76
|
+
def client
|
|
77
|
+
require "solid_objects/client"
|
|
78
|
+
@client ||= Client.new
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# @rbs () -> DeadLetterManager
|
|
82
|
+
def dead_letters
|
|
83
|
+
@dead_letters ||= DeadLetterManager.new
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
# @rbs (String | Symbol) -> String
|
|
87
|
+
def table_name(name)
|
|
88
|
+
"#{configuration.table_name_prefix}#{name}"
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
# @rbs (String, Class) -> Class
|
|
92
|
+
def register_actor(type, actor_class)
|
|
93
|
+
registry.register(type, actor_class)
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
# @rbs () -> void
|
|
97
|
+
def reset!
|
|
98
|
+
@configuration = Configuration.new
|
|
99
|
+
@registry = ActorRegistry.new
|
|
100
|
+
@client = nil
|
|
101
|
+
@database_adapter = nil
|
|
102
|
+
@wake_up = nil
|
|
103
|
+
@effect_registry = EffectRegistry.new
|
|
104
|
+
@dead_letters = nil
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# @rbs () -> DatabaseAdapter
|
|
108
|
+
def database_adapter
|
|
109
|
+
require "solid_objects/database_adapter"
|
|
110
|
+
@database_adapter ||= DatabaseAdapter.for(SolidObjects::Record.connection)
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
# @rbs () -> WakeUp
|
|
114
|
+
def wake_up
|
|
115
|
+
@wake_up ||= configuration.wake_up_adapter || WakeUp.new
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Generated from app/controllers/solid_objects/dead_letters_controller.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module SolidObjects
|
|
4
|
+
class DeadLettersController < ApplicationController
|
|
5
|
+
# @rbs () -> void
|
|
6
|
+
def index: () -> void
|
|
7
|
+
|
|
8
|
+
# @rbs () -> void
|
|
9
|
+
def retry: () -> void
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Generated from app/controllers/solid_objects/instances_controller.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module SolidObjects
|
|
4
|
+
class InstancesController < ApplicationController
|
|
5
|
+
# @rbs () -> void
|
|
6
|
+
def index: () -> void
|
|
7
|
+
|
|
8
|
+
# @rbs () -> void
|
|
9
|
+
def show: () -> void
|
|
10
|
+
end
|
|
11
|
+
end
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Generated from app/helpers/solid_objects/actor_helper.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module SolidObjects
|
|
4
|
+
module ActorHelper
|
|
5
|
+
# @rbs (Reference, ?authorization_context: untyped) { (ActorView) -> untyped } -> untyped
|
|
6
|
+
def solid_object: (Reference, ?authorization_context: untyped) { (ActorView) -> untyped } -> untyped
|
|
7
|
+
end
|
|
8
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Generated from lib/generators/solid_objects/install_generator.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module SolidObjects
|
|
4
|
+
module Generators
|
|
5
|
+
class InstallGenerator < Rails::Generators::Base
|
|
6
|
+
# @rbs () -> void
|
|
7
|
+
def copy_initializer: () -> void
|
|
8
|
+
|
|
9
|
+
# @rbs () -> void
|
|
10
|
+
def copy_migrations: () -> void
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Generated from lib/solid_objects/activation.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module SolidObjects
|
|
4
|
+
class Activation
|
|
5
|
+
@pass_exhausted: bool
|
|
6
|
+
|
|
7
|
+
@last_used_at: Float
|
|
8
|
+
|
|
9
|
+
@actor: Actor
|
|
10
|
+
|
|
11
|
+
@actor_class: Class
|
|
12
|
+
|
|
13
|
+
@lease: Lease
|
|
14
|
+
|
|
15
|
+
attr_reader lease: untyped
|
|
16
|
+
|
|
17
|
+
attr_reader actor: untyped
|
|
18
|
+
|
|
19
|
+
# @rbs (lease: Lease) -> void
|
|
20
|
+
def initialize: (lease: Lease) -> void
|
|
21
|
+
|
|
22
|
+
# @rbs () -> Integer
|
|
23
|
+
def drain: () -> Integer
|
|
24
|
+
|
|
25
|
+
# @rbs () -> bool
|
|
26
|
+
def ready?: () -> bool
|
|
27
|
+
|
|
28
|
+
# @rbs () -> bool
|
|
29
|
+
def pass_exhausted?: () -> bool
|
|
30
|
+
|
|
31
|
+
# @rbs () -> bool
|
|
32
|
+
def idle?: () -> bool
|
|
33
|
+
|
|
34
|
+
# @rbs () -> void
|
|
35
|
+
def renew_lease: () -> void
|
|
36
|
+
|
|
37
|
+
# @rbs () -> bool
|
|
38
|
+
def lease_renewal_due?: () -> bool
|
|
39
|
+
|
|
40
|
+
# @rbs () -> void
|
|
41
|
+
def yield_ready_messages: () -> void
|
|
42
|
+
|
|
43
|
+
# @rbs (Hash[String, untyped]) -> void
|
|
44
|
+
def restore_state: (Hash[String, untyped]) -> void
|
|
45
|
+
|
|
46
|
+
# @rbs () -> void
|
|
47
|
+
def deactivate: () -> void
|
|
48
|
+
|
|
49
|
+
private
|
|
50
|
+
|
|
51
|
+
attr_reader actor_class: untyped
|
|
52
|
+
|
|
53
|
+
# @rbs (Instance) -> Actor
|
|
54
|
+
def build_actor: (Instance) -> Actor
|
|
55
|
+
|
|
56
|
+
# @rbs () -> Message?
|
|
57
|
+
def claim_next_message: () -> Message?
|
|
58
|
+
|
|
59
|
+
# @rbs (Instance) -> void
|
|
60
|
+
def recover_stale_claim: (Instance) -> void
|
|
61
|
+
|
|
62
|
+
# @rbs () -> Float
|
|
63
|
+
def monotonic_now: () -> Float
|
|
64
|
+
end
|
|
65
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Generated from lib/solid_objects/activation_manager.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module SolidObjects
|
|
4
|
+
class ActivationManager
|
|
5
|
+
@owner_id: String
|
|
6
|
+
|
|
7
|
+
@database_adapter: DatabaseAdapter
|
|
8
|
+
|
|
9
|
+
# @rbs (owner_id: String, ?database_adapter: DatabaseAdapter) -> void
|
|
10
|
+
def initialize: (owner_id: String, ?database_adapter: DatabaseAdapter) -> void
|
|
11
|
+
|
|
12
|
+
# @rbs () -> Activation?
|
|
13
|
+
def claim_next: () -> Activation?
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
attr_reader owner_id: untyped
|
|
18
|
+
|
|
19
|
+
attr_reader database_adapter: untyped
|
|
20
|
+
|
|
21
|
+
# @rbs (Time) -> Array[Integer]
|
|
22
|
+
def candidate_instance_ids: (Time) -> Array[Integer]
|
|
23
|
+
|
|
24
|
+
# @rbs (Time) -> Array[Integer]
|
|
25
|
+
def ready_instance_ids: (Time) -> Array[Integer]
|
|
26
|
+
|
|
27
|
+
# @rbs (Time) -> Array[Integer]
|
|
28
|
+
def claimed_instance_ids: (Time) -> Array[Integer]
|
|
29
|
+
|
|
30
|
+
# @rbs (Instance, Time) -> bool
|
|
31
|
+
def claimable?: (Instance, Time) -> bool
|
|
32
|
+
|
|
33
|
+
# @rbs () -> String
|
|
34
|
+
def available_lease_sql: () -> String
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# Generated from lib/solid_objects/actor.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module SolidObjects
|
|
4
|
+
class Actor
|
|
5
|
+
class EffectIntent < Data
|
|
6
|
+
attr_reader name(): untyped
|
|
7
|
+
|
|
8
|
+
attr_reader arguments(): untyped
|
|
9
|
+
|
|
10
|
+
attr_reader success_message_name(): untyped
|
|
11
|
+
|
|
12
|
+
attr_reader failure_message_name(): untyped
|
|
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
|
|
16
|
+
|
|
17
|
+
def self.members: () -> [ :name, :arguments, :success_message_name, :failure_message_name ]
|
|
18
|
+
|
|
19
|
+
def members: () -> [ :name, :arguments, :success_message_name, :failure_message_name ]
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
class ReminderIntent < Data
|
|
23
|
+
attr_reader name(): untyped
|
|
24
|
+
|
|
25
|
+
attr_reader at(): untyped
|
|
26
|
+
|
|
27
|
+
attr_reader arguments(): untyped
|
|
28
|
+
|
|
29
|
+
attr_reader interval_seconds(): untyped
|
|
30
|
+
|
|
31
|
+
attr_reader missed_policy(): untyped
|
|
32
|
+
|
|
33
|
+
def self.new: (untyped name, untyped at, untyped arguments, untyped interval_seconds, untyped missed_policy) -> instance
|
|
34
|
+
| (name: untyped, at: untyped, arguments: untyped, interval_seconds: untyped, missed_policy: untyped) -> instance
|
|
35
|
+
|
|
36
|
+
def self.members: () -> [ :name, :at, :arguments, :interval_seconds, :missed_policy ]
|
|
37
|
+
|
|
38
|
+
def members: () -> [ :name, :at, :arguments, :interval_seconds, :missed_policy ]
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
class OutboundMessageIntent < Data
|
|
42
|
+
attr_reader actor_type(): untyped
|
|
43
|
+
|
|
44
|
+
attr_reader actor_id(): untyped
|
|
45
|
+
|
|
46
|
+
attr_reader message_name(): untyped
|
|
47
|
+
|
|
48
|
+
attr_reader arguments(): untyped
|
|
49
|
+
|
|
50
|
+
attr_reader available_at(): untyped
|
|
51
|
+
|
|
52
|
+
attr_reader idempotency_key(): untyped
|
|
53
|
+
|
|
54
|
+
def self.new: (untyped actor_type, untyped actor_id, untyped message_name, untyped arguments, untyped available_at, untyped idempotency_key) -> instance
|
|
55
|
+
| (actor_type: untyped, actor_id: untyped, message_name: untyped, arguments: untyped, available_at: untyped, idempotency_key: untyped) -> instance
|
|
56
|
+
|
|
57
|
+
def self.members: () -> [ :actor_type, :actor_id, :message_name, :arguments, :available_at, :idempotency_key ]
|
|
58
|
+
|
|
59
|
+
def members: () -> [ :actor_type, :actor_id, :message_name, :arguments, :available_at, :idempotency_key ]
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# @rbs (Class) -> void
|
|
63
|
+
def self.inherited: (Class) -> void
|
|
64
|
+
|
|
65
|
+
# @rbs (?String | Symbol) -> String
|
|
66
|
+
def self.actor_type: (?String | Symbol) -> String
|
|
67
|
+
|
|
68
|
+
# @rbs (Symbol | String, ?default: untyped) -> StateDefinition::Attribute
|
|
69
|
+
def self.attribute: (Symbol | String, ?default: untyped) -> StateDefinition::Attribute
|
|
70
|
+
|
|
71
|
+
# @rbs (Symbol | String) { (*untyped, **untyped) -> untyped } -> ActorDefinition::Handler
|
|
72
|
+
def self.message: (Symbol | String) { (*untyped, **untyped) -> untyped } -> ActorDefinition::Handler
|
|
73
|
+
|
|
74
|
+
# @rbs (Symbol | String) { (*untyped, **untyped) -> untyped } -> ActorDefinition::Handler
|
|
75
|
+
def self.query: (Symbol | String) { (*untyped, **untyped) -> untyped } -> ActorDefinition::Handler
|
|
76
|
+
|
|
77
|
+
# @rbs (Symbol | String) ?{ () -> untyped } -> ActorDefinition::Handler
|
|
78
|
+
def self.observable: (Symbol | String) ?{ () -> untyped } -> ActorDefinition::Handler
|
|
79
|
+
|
|
80
|
+
# @rbs (?Integer) -> Integer
|
|
81
|
+
def self.state_version: (?Integer) -> Integer
|
|
82
|
+
|
|
83
|
+
# @rbs (from: Integer, to: Integer) { (Hash[String, untyped]) -> Hash[String, untyped] } -> ActorDefinition::StateMigration
|
|
84
|
+
def self.migrate_state: (from: Integer, to: Integer) { (Hash[String, untyped]) -> Hash[String, untyped] } -> ActorDefinition::StateMigration
|
|
85
|
+
|
|
86
|
+
# @rbs () { () -> untyped } -> Proc
|
|
87
|
+
def self.on_activate: () { () -> untyped } -> Proc
|
|
88
|
+
|
|
89
|
+
# @rbs () { () -> untyped } -> Proc
|
|
90
|
+
def self.on_deactivate: () { () -> untyped } -> Proc
|
|
91
|
+
|
|
92
|
+
# @rbs (String | Integer) -> Reference
|
|
93
|
+
def self.ref: (String | Integer) -> Reference
|
|
94
|
+
|
|
95
|
+
# @rbs () -> ActorDefinition
|
|
96
|
+
def self.definition: () -> ActorDefinition
|
|
97
|
+
|
|
98
|
+
# @rbs () -> Class
|
|
99
|
+
def self.ensure_registered!: () -> Class
|
|
100
|
+
|
|
101
|
+
# @rbs (Symbol) -> void
|
|
102
|
+
private def self.method_added: (Symbol) -> void
|
|
103
|
+
|
|
104
|
+
# @rbs () -> Hash[Symbol, bool]
|
|
105
|
+
private def self.generated_attribute_methods: () -> Hash[Symbol, bool]
|
|
106
|
+
|
|
107
|
+
# @rbs (Symbol) -> void
|
|
108
|
+
private def self.ensure_attribute_methods_available!: (Symbol) -> void
|
|
109
|
+
|
|
110
|
+
# @rbs () -> String
|
|
111
|
+
private def self.default_actor_type: () -> String
|
|
112
|
+
|
|
113
|
+
@outbound_message_intents: Array[OutboundMessageIntent]
|
|
114
|
+
|
|
115
|
+
@reminder_intents: Array[ReminderIntent]
|
|
116
|
+
|
|
117
|
+
@effect_intents: Array[EffectIntent]
|
|
118
|
+
|
|
119
|
+
@state: State
|
|
120
|
+
|
|
121
|
+
@actor_id: String
|
|
122
|
+
|
|
123
|
+
attr_reader actor_id: untyped
|
|
124
|
+
|
|
125
|
+
attr_reader state: untyped
|
|
126
|
+
|
|
127
|
+
# @rbs (actor_id: String, state: State) -> void
|
|
128
|
+
def initialize: (actor_id: String, state: State) -> void
|
|
129
|
+
|
|
130
|
+
# @rbs () -> MessageContext?
|
|
131
|
+
def current_message: () -> MessageContext?
|
|
132
|
+
|
|
133
|
+
# @rbs (Symbol | String, ?on_success: Symbol | String?, ?on_failure: Symbol | String?, **untyped) -> EffectIntent
|
|
134
|
+
def emit: (Symbol | String, ?on_success: Symbol | String?, ?on_failure: Symbol | String?, **untyped) -> EffectIntent
|
|
135
|
+
|
|
136
|
+
# @rbs (Symbol | String, at: Time, ?every: Numeric?, ?missed: Symbol | String, arguments: Hash[Symbol | String, untyped]) -> ReminderIntent
|
|
137
|
+
def schedule: (Symbol | String, at: Time, arguments: Hash[Symbol | String, untyped], ?every: Numeric?, ?missed: Symbol | String) -> ReminderIntent
|
|
138
|
+
|
|
139
|
+
# @rbs (Reference, Symbol | String, ?available_at: Time?, ?idempotency_key: String?, **untyped) -> OutboundMessageIntent
|
|
140
|
+
def send_to: (Reference, Symbol | String, ?available_at: Time?, ?idempotency_key: String?, **untyped) -> OutboundMessageIntent
|
|
141
|
+
|
|
142
|
+
# @rbs (Symbol | String, Hash[String, untyped]) -> untyped
|
|
143
|
+
def invoke: (Symbol | String, Hash[String, untyped]) -> untyped
|
|
144
|
+
|
|
145
|
+
# @rbs () -> Hash[String, untyped]
|
|
146
|
+
def observable_values: () -> Hash[String, untyped]
|
|
147
|
+
|
|
148
|
+
# @rbs () -> void
|
|
149
|
+
def activate: () -> void
|
|
150
|
+
|
|
151
|
+
# @rbs () -> void
|
|
152
|
+
def deactivate: () -> void
|
|
153
|
+
|
|
154
|
+
# @rbs (Reference, Symbol | String, Hash[Symbol | String, untyped], ?available_at: Time?, idempotency_key: String?) -> OutboundMessageIntent
|
|
155
|
+
def stage_outbound_message: (Reference, Symbol | String, Hash[Symbol | String, untyped], idempotency_key: String?, ?available_at: Time?) -> OutboundMessageIntent
|
|
156
|
+
|
|
157
|
+
# @rbs () -> Array[EffectIntent]
|
|
158
|
+
def drain_effect_intents: () -> Array[EffectIntent]
|
|
159
|
+
|
|
160
|
+
# @rbs () -> Array[ReminderIntent]
|
|
161
|
+
def drain_reminder_intents: () -> Array[ReminderIntent]
|
|
162
|
+
|
|
163
|
+
# @rbs () -> Array[OutboundMessageIntent]
|
|
164
|
+
def drain_outbound_message_intents: () -> Array[OutboundMessageIntent]
|
|
165
|
+
|
|
166
|
+
# @rbs () -> void
|
|
167
|
+
def discard_intents: () -> void
|
|
168
|
+
|
|
169
|
+
private
|
|
170
|
+
|
|
171
|
+
attr_reader effect_intents: untyped
|
|
172
|
+
|
|
173
|
+
attr_reader reminder_intents: untyped
|
|
174
|
+
|
|
175
|
+
attr_reader outbound_message_intents: untyped
|
|
176
|
+
|
|
177
|
+
# @rbs (Hash[String, untyped]) -> Hash[Symbol, untyped]
|
|
178
|
+
def keyword_arguments: (Hash[String, untyped]) -> Hash[Symbol, untyped]
|
|
179
|
+
|
|
180
|
+
# @rbs (Symbol | String?) -> void
|
|
181
|
+
def validate_effect_callback!: (Symbol | String?) -> void
|
|
182
|
+
end
|
|
183
|
+
end
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Generated from lib/solid_objects/actor_definition.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module SolidObjects
|
|
4
|
+
class ActorDefinition
|
|
5
|
+
class Handler < Data
|
|
6
|
+
attr_reader name(): untyped
|
|
7
|
+
|
|
8
|
+
attr_reader block(): untyped
|
|
9
|
+
|
|
10
|
+
def self.new: (untyped name, untyped block) -> instance
|
|
11
|
+
| (name: untyped, block: untyped) -> instance
|
|
12
|
+
|
|
13
|
+
def self.members: () -> [ :name, :block ]
|
|
14
|
+
|
|
15
|
+
def members: () -> [ :name, :block ]
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
class StateMigration < Data
|
|
19
|
+
attr_reader from(): untyped
|
|
20
|
+
|
|
21
|
+
attr_reader to(): untyped
|
|
22
|
+
|
|
23
|
+
attr_reader block(): untyped
|
|
24
|
+
|
|
25
|
+
def self.new: (untyped from, untyped to, untyped block) -> instance
|
|
26
|
+
| (from: untyped, to: untyped, block: untyped) -> instance
|
|
27
|
+
|
|
28
|
+
def self.members: () -> [ :from, :to, :block ]
|
|
29
|
+
|
|
30
|
+
def members: () -> [ :from, :to, :block ]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
@method_messages: Hash[Symbol, bool]
|
|
34
|
+
|
|
35
|
+
@attribute_queries: Hash[Symbol, bool]
|
|
36
|
+
|
|
37
|
+
@deactivation_hooks: Array[Proc]
|
|
38
|
+
|
|
39
|
+
@activation_hooks: Array[Proc]
|
|
40
|
+
|
|
41
|
+
@state_migrations: Array[StateMigration]
|
|
42
|
+
|
|
43
|
+
@state_version: Integer
|
|
44
|
+
|
|
45
|
+
@observables: Hash[Symbol, Handler]
|
|
46
|
+
|
|
47
|
+
@queries: Hash[Symbol, Handler]
|
|
48
|
+
|
|
49
|
+
@messages: Hash[Symbol, Handler]
|
|
50
|
+
|
|
51
|
+
@state_definition: StateDefinition
|
|
52
|
+
|
|
53
|
+
attr_reader state_definition: untyped
|
|
54
|
+
|
|
55
|
+
attr_reader messages: untyped
|
|
56
|
+
|
|
57
|
+
attr_reader queries: untyped
|
|
58
|
+
|
|
59
|
+
attr_reader observables: untyped
|
|
60
|
+
|
|
61
|
+
attr_reader state_version: untyped
|
|
62
|
+
|
|
63
|
+
attr_reader state_migrations: untyped
|
|
64
|
+
|
|
65
|
+
attr_reader activation_hooks: untyped
|
|
66
|
+
|
|
67
|
+
attr_reader deactivation_hooks: untyped
|
|
68
|
+
|
|
69
|
+
# @rbs () -> void
|
|
70
|
+
def initialize: () -> void
|
|
71
|
+
|
|
72
|
+
# @rbs (Symbol | String, default: untyped) -> StateDefinition::Attribute
|
|
73
|
+
def add_attribute: (Symbol | String, default: untyped) -> StateDefinition::Attribute
|
|
74
|
+
|
|
75
|
+
# @rbs (Symbol | String, Proc) -> Handler
|
|
76
|
+
def add_message: (Symbol | String, Proc) -> Handler
|
|
77
|
+
|
|
78
|
+
# @rbs (Symbol | String, Proc) -> Handler
|
|
79
|
+
def add_query: (Symbol | String, Proc) -> Handler
|
|
80
|
+
|
|
81
|
+
# @rbs (Symbol | String, Proc?) -> Handler
|
|
82
|
+
def add_observable: (Symbol | String, Proc?) -> Handler
|
|
83
|
+
|
|
84
|
+
# @rbs (Class) -> ActorDefinition
|
|
85
|
+
def synchronize_instance_messages: (Class) -> ActorDefinition
|
|
86
|
+
|
|
87
|
+
# @rbs (Integer) -> Integer
|
|
88
|
+
def set_state_version: (Integer) -> Integer
|
|
89
|
+
|
|
90
|
+
# @rbs (Integer, Integer, Proc) -> StateMigration
|
|
91
|
+
def add_state_migration: (Integer, Integer, Proc) -> StateMigration
|
|
92
|
+
|
|
93
|
+
# @rbs (Integer, Hash[String, untyped]) -> Hash[String, untyped]
|
|
94
|
+
def migrate_state: (Integer, Hash[String, untyped]) -> Hash[String, untyped]
|
|
95
|
+
|
|
96
|
+
# @rbs () -> ActorDefinition
|
|
97
|
+
def duplicate: () -> ActorDefinition
|
|
98
|
+
|
|
99
|
+
private
|
|
100
|
+
|
|
101
|
+
attr_reader attribute_queries: untyped
|
|
102
|
+
|
|
103
|
+
attr_reader method_messages: untyped
|
|
104
|
+
|
|
105
|
+
# @rbs (Symbol) -> Handler
|
|
106
|
+
def add_method_message: (Symbol) -> Handler
|
|
107
|
+
|
|
108
|
+
# @rbs (Class) -> Array[Symbol]
|
|
109
|
+
def actor_message_method_names: (Class) -> Array[Symbol]
|
|
110
|
+
|
|
111
|
+
# @rbs (Array[Symbol]) -> void
|
|
112
|
+
def validate_attribute_methods!: (Array[Symbol]) -> void
|
|
113
|
+
|
|
114
|
+
# @rbs (Hash[Symbol, Handler], Symbol | String, Proc) -> Handler
|
|
115
|
+
def add_handler: (Hash[Symbol, Handler], Symbol | String, Proc) -> Handler
|
|
116
|
+
end
|
|
117
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Generated from lib/solid_objects/actor_registry.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module SolidObjects
|
|
4
|
+
class ActorRegistry
|
|
5
|
+
@actors: Hash[String, Class]
|
|
6
|
+
|
|
7
|
+
@mutex: Mutex
|
|
8
|
+
|
|
9
|
+
# @rbs () -> void
|
|
10
|
+
def initialize: () -> void
|
|
11
|
+
|
|
12
|
+
# @rbs (String | Symbol, Class) -> Class
|
|
13
|
+
def register: (String | Symbol, Class) -> Class
|
|
14
|
+
|
|
15
|
+
# @rbs (String | Symbol) -> Class
|
|
16
|
+
def fetch: (String | Symbol) -> Class
|
|
17
|
+
|
|
18
|
+
# @rbs (String | Symbol) -> bool
|
|
19
|
+
def registered?: (String | Symbol) -> bool
|
|
20
|
+
|
|
21
|
+
# @rbs () -> Hash[String, Class]
|
|
22
|
+
def to_h: () -> Hash[String, Class]
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
attr_reader actors: untyped
|
|
27
|
+
|
|
28
|
+
attr_reader mutex: untyped
|
|
29
|
+
|
|
30
|
+
# @rbs (String | Symbol) -> String
|
|
31
|
+
def normalize: (String | Symbol) -> String
|
|
32
|
+
|
|
33
|
+
# @rbs (untyped) -> void
|
|
34
|
+
def validate_actor_class!: (untyped) -> void
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Generated from lib/solid_objects/actor_snapshot.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module SolidObjects
|
|
4
|
+
class ActorSnapshot
|
|
5
|
+
@reference: Reference
|
|
6
|
+
|
|
7
|
+
@actor_class: Class
|
|
8
|
+
|
|
9
|
+
@actor: Actor
|
|
10
|
+
|
|
11
|
+
attr_reader reference: untyped
|
|
12
|
+
|
|
13
|
+
attr_reader actor_class: untyped
|
|
14
|
+
|
|
15
|
+
attr_reader actor: untyped
|
|
16
|
+
|
|
17
|
+
# @rbs (Reference) -> void
|
|
18
|
+
def initialize: (Reference) -> void
|
|
19
|
+
|
|
20
|
+
# @rbs () -> Hash[String, untyped]
|
|
21
|
+
def observable_values: () -> Hash[String, untyped]
|
|
22
|
+
|
|
23
|
+
private
|
|
24
|
+
|
|
25
|
+
# @rbs () -> Actor
|
|
26
|
+
def build_actor: () -> Actor
|
|
27
|
+
end
|
|
28
|
+
end
|