solid_objects 0.2.1 → 0.3.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 +4 -4
- data/CHANGELOG.md +14 -0
- data/README.md +129 -8
- data/docs/architecture.md +62 -15
- data/docs/authorization.md +16 -3
- data/docs/benchmarks.md +6 -2
- data/docs/correctness.md +19 -1
- data/docs/database-schema.md +5 -0
- data/docs/development.md +40 -0
- data/docs/fit.md +10 -2
- data/docs/migrating-existing-state.md +8 -1
- data/docs/operations.md +74 -36
- data/docs/roadmap.md +8 -2
- data/docs/security.md +25 -3
- data/docs/state-migrations.md +2 -0
- data/lib/generators/solid_objects/templates/solid_objects.rb +30 -2
- data/lib/solid_objects/activation.rb +33 -4
- data/lib/solid_objects/actor.rb +47 -6
- data/lib/solid_objects/actor_definition.rb +2 -0
- data/lib/solid_objects/actor_snapshot.rb +10 -4
- data/lib/solid_objects/application_write_guard.rb +24 -0
- data/lib/solid_objects/caller_process.rb +28 -0
- data/lib/solid_objects/cli.rb +44 -5
- data/lib/solid_objects/client.rb +98 -5
- data/lib/solid_objects/commit_action_registry.rb +42 -0
- data/lib/solid_objects/configuration.rb +27 -1
- data/lib/solid_objects/database_adapter.rb +28 -1
- data/lib/solid_objects/database_adapters/mysql.rb +46 -0
- data/lib/solid_objects/database_adapters/postgresql.rb +29 -0
- data/lib/solid_objects/database_adapters/sqlite.rb +28 -0
- data/lib/solid_objects/errors.rb +144 -0
- data/lib/solid_objects/executor.rb +64 -4
- data/lib/solid_objects/instance_pruner.rb +97 -0
- data/lib/solid_objects/message_pruner.rb +97 -0
- data/lib/solid_objects/message_reference.rb +9 -0
- data/lib/solid_objects/process_pruner.rb +49 -0
- data/lib/solid_objects/reference.rb +5 -0
- data/lib/solid_objects/state_snapshot.rb +41 -0
- data/lib/solid_objects/sync_deadline.rb +57 -0
- data/lib/solid_objects/sync_diagnostics.rb +133 -0
- data/lib/solid_objects/synchronous_invocation.rb +26 -7
- data/lib/solid_objects/test_helper.rb +78 -0
- data/lib/solid_objects/version.rb +1 -1
- data/lib/solid_objects/worker.rb +1 -1
- data/lib/solid_objects.rb +34 -0
- data/sig/generated/lib/solid_objects/activation.rbs +3 -0
- data/sig/generated/lib/solid_objects/actor.rbs +26 -0
- data/sig/generated/lib/solid_objects/application_write_guard.rbs +8 -0
- data/sig/generated/lib/solid_objects/caller_process.rbs +11 -0
- data/sig/generated/lib/solid_objects/cli.rbs +11 -2
- data/sig/generated/lib/solid_objects/client.rbs +15 -0
- data/sig/generated/lib/solid_objects/commit_action_registry.rbs +43 -0
- data/sig/generated/lib/solid_objects/configuration.rbs +27 -7
- data/sig/generated/lib/solid_objects/database_adapter.rbs +9 -0
- data/sig/generated/lib/solid_objects/database_adapters/mysql.rbs +8 -0
- data/sig/generated/lib/solid_objects/database_adapters/postgresql.rbs +8 -0
- data/sig/generated/lib/solid_objects/database_adapters/sqlite.rbs +8 -0
- data/sig/generated/lib/solid_objects/errors.rbs +118 -0
- data/sig/generated/lib/solid_objects/executor.rbs +12 -0
- data/sig/generated/lib/solid_objects/instance_pruner.rbs +36 -0
- data/sig/generated/lib/solid_objects/message_pruner.rbs +42 -0
- data/sig/generated/lib/solid_objects/message_reference.rbs +3 -0
- data/sig/generated/lib/solid_objects/process_pruner.rbs +27 -0
- data/sig/generated/lib/solid_objects/reference.rbs +3 -0
- data/sig/generated/lib/solid_objects/state_snapshot.rbs +30 -0
- data/sig/generated/lib/solid_objects/sync_deadline.rbs +31 -0
- data/sig/generated/lib/solid_objects/sync_diagnostics.rbs +34 -0
- data/sig/generated/lib/solid_objects/synchronous_invocation.rbs +3 -0
- data/sig/generated/lib/solid_objects/test_helper.rbs +25 -0
- data/sig/generated/lib/solid_objects.rbs +12 -0
- metadata +19 -1
data/lib/solid_objects.rb
CHANGED
|
@@ -12,6 +12,7 @@ require "securerandom"
|
|
|
12
12
|
|
|
13
13
|
require "solid_objects/version"
|
|
14
14
|
require "solid_objects/errors"
|
|
15
|
+
require "solid_objects/sync_deadline"
|
|
15
16
|
require "solid_objects/configuration"
|
|
16
17
|
require "solid_objects/instrumentation"
|
|
17
18
|
require "solid_objects/log_subscriber"
|
|
@@ -20,19 +21,25 @@ require "solid_objects/context"
|
|
|
20
21
|
require "solid_objects/actor_registry"
|
|
21
22
|
require "solid_objects/state"
|
|
22
23
|
require "solid_objects/actor_definition"
|
|
24
|
+
require "solid_objects/application_write_guard"
|
|
23
25
|
require "solid_objects/actor"
|
|
24
26
|
require "solid_objects/reference"
|
|
25
27
|
require "solid_objects/message_reference"
|
|
26
28
|
require "solid_objects/dead_letter_manager"
|
|
29
|
+
require "solid_objects/message_pruner"
|
|
30
|
+
require "solid_objects/instance_pruner"
|
|
31
|
+
require "solid_objects/process_pruner"
|
|
27
32
|
require "solid_objects/stream_name"
|
|
28
33
|
require "solid_objects/dom_identity"
|
|
29
34
|
require "solid_objects/stream_token"
|
|
30
35
|
require "solid_objects/turbo_stream_renderer"
|
|
31
36
|
require "solid_objects/actor_snapshot"
|
|
37
|
+
require "solid_objects/state_snapshot"
|
|
32
38
|
require "solid_objects/actor_view"
|
|
33
39
|
require "solid_objects/action_cable_broadcast_adapter"
|
|
34
40
|
require "solid_objects/wake_up"
|
|
35
41
|
require "solid_objects/effect_registry"
|
|
42
|
+
require "solid_objects/commit_action_registry"
|
|
36
43
|
require "solid_objects/lease"
|
|
37
44
|
require "solid_objects/lease_renewer"
|
|
38
45
|
require "solid_objects/worker"
|
|
@@ -72,6 +79,16 @@ module SolidObjects
|
|
|
72
79
|
effect_registry.register(name, handler)
|
|
73
80
|
end
|
|
74
81
|
|
|
82
|
+
# @rbs () -> CommitActionRegistry
|
|
83
|
+
def commit_action_registry
|
|
84
|
+
@commit_action_registry ||= CommitActionRegistry.new
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
# @rbs (String | Symbol) { (Hash[String, untyped], CommitActionContext) -> untyped } -> Proc
|
|
88
|
+
def register_commit_action(name, &handler)
|
|
89
|
+
commit_action_registry.register(name, handler)
|
|
90
|
+
end
|
|
91
|
+
|
|
75
92
|
# @rbs () -> Client
|
|
76
93
|
def client
|
|
77
94
|
require "solid_objects/client"
|
|
@@ -84,6 +101,17 @@ module SolidObjects
|
|
|
84
101
|
@caller_process ||= CallerProcess.new
|
|
85
102
|
end
|
|
86
103
|
|
|
104
|
+
# @rbs () -> bool
|
|
105
|
+
def reset_caller_process!
|
|
106
|
+
caller_process = @caller_process
|
|
107
|
+
@caller_process = nil
|
|
108
|
+
return false unless caller_process
|
|
109
|
+
|
|
110
|
+
caller_process.stop
|
|
111
|
+
rescue ActiveRecord::ActiveRecordError
|
|
112
|
+
false
|
|
113
|
+
end
|
|
114
|
+
|
|
87
115
|
# @rbs () -> DeadLetterManager
|
|
88
116
|
def dead_letters
|
|
89
117
|
@dead_letters ||= DeadLetterManager.new
|
|
@@ -99,6 +127,11 @@ module SolidObjects
|
|
|
99
127
|
registry.register(type, actor_class)
|
|
100
128
|
end
|
|
101
129
|
|
|
130
|
+
# @rbs (untyped) -> untyped
|
|
131
|
+
def mutable_copy(value)
|
|
132
|
+
Serialization.deep_copy(value)
|
|
133
|
+
end
|
|
134
|
+
|
|
102
135
|
# @rbs () -> void
|
|
103
136
|
def reset!
|
|
104
137
|
@configuration = Configuration.new
|
|
@@ -108,6 +141,7 @@ module SolidObjects
|
|
|
108
141
|
@wake_up = nil
|
|
109
142
|
@caller_process = nil
|
|
110
143
|
@effect_registry = EffectRegistry.new
|
|
144
|
+
@commit_action_registry = CommitActionRegistry.new
|
|
111
145
|
@dead_letters = nil
|
|
112
146
|
end
|
|
113
147
|
|
|
@@ -19,6 +19,19 @@ module SolidObjects
|
|
|
19
19
|
def members: () -> [ :name, :arguments, :success_message_name, :failure_message_name ]
|
|
20
20
|
end
|
|
21
21
|
|
|
22
|
+
class CommitActionIntent < Data
|
|
23
|
+
attr_reader name(): untyped
|
|
24
|
+
|
|
25
|
+
attr_reader arguments(): untyped
|
|
26
|
+
|
|
27
|
+
def self.new: (untyped name, untyped arguments) -> instance
|
|
28
|
+
| (name: untyped, arguments: untyped) -> instance
|
|
29
|
+
|
|
30
|
+
def self.members: () -> [ :name, :arguments ]
|
|
31
|
+
|
|
32
|
+
def members: () -> [ :name, :arguments ]
|
|
33
|
+
end
|
|
34
|
+
|
|
22
35
|
class ReminderIntent < Data
|
|
23
36
|
attr_reader name(): untyped
|
|
24
37
|
|
|
@@ -114,6 +127,8 @@ module SolidObjects
|
|
|
114
127
|
|
|
115
128
|
@reminder_intents: Array[ReminderIntent]
|
|
116
129
|
|
|
130
|
+
@commit_action_intents: Array[CommitActionIntent]
|
|
131
|
+
|
|
117
132
|
@effect_intents: Array[EffectIntent]
|
|
118
133
|
|
|
119
134
|
@state: State
|
|
@@ -136,6 +151,9 @@ module SolidObjects
|
|
|
136
151
|
# @rbs (Symbol | String, ?on_success: Symbol | String?, ?on_failure: Symbol | String?, **untyped) -> nil
|
|
137
152
|
def emit: (Symbol | String, ?on_success: Symbol | String?, ?on_failure: Symbol | String?, **untyped) -> nil
|
|
138
153
|
|
|
154
|
+
# @rbs (Symbol | String, **untyped) -> nil
|
|
155
|
+
def commit_action: (Symbol | String, **untyped) -> nil
|
|
156
|
+
|
|
139
157
|
# @rbs (Symbol | String, at: Time, ?every: Numeric?, ?missed: Symbol | String, arguments: Hash[Symbol | String, untyped]) -> nil
|
|
140
158
|
def schedule: (Symbol | String, at: Time, arguments: Hash[Symbol | String, untyped], ?every: Numeric?, ?missed: Symbol | String) -> nil
|
|
141
159
|
|
|
@@ -160,6 +178,9 @@ module SolidObjects
|
|
|
160
178
|
# @rbs () -> Array[EffectIntent]
|
|
161
179
|
def drain_effect_intents: () -> Array[EffectIntent]
|
|
162
180
|
|
|
181
|
+
# @rbs () -> Array[CommitActionIntent]
|
|
182
|
+
def drain_commit_action_intents: () -> Array[CommitActionIntent]
|
|
183
|
+
|
|
163
184
|
# @rbs () -> Array[ReminderIntent]
|
|
164
185
|
def drain_reminder_intents: () -> Array[ReminderIntent]
|
|
165
186
|
|
|
@@ -173,10 +194,15 @@ module SolidObjects
|
|
|
173
194
|
|
|
174
195
|
attr_reader effect_intents: untyped
|
|
175
196
|
|
|
197
|
+
attr_reader commit_action_intents: untyped
|
|
198
|
+
|
|
176
199
|
attr_reader reminder_intents: untyped
|
|
177
200
|
|
|
178
201
|
attr_reader outbound_message_intents: untyped
|
|
179
202
|
|
|
203
|
+
# @rbs (String) { () -> untyped } -> untyped
|
|
204
|
+
def guard_application_writes: (String) { () -> untyped } -> untyped
|
|
205
|
+
|
|
180
206
|
# @rbs (Hash[String, untyped]) -> Hash[Symbol, untyped]
|
|
181
207
|
def keyword_arguments: (Hash[String, untyped]) -> Hash[Symbol, untyped]
|
|
182
208
|
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Generated from lib/solid_objects/application_write_guard.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module SolidObjects
|
|
4
|
+
class ApplicationWriteGuard
|
|
5
|
+
# @rbs (actor_type: String, actor_id: String, operation: String) { () -> untyped } -> untyped
|
|
6
|
+
def self.call: (actor_type: String, actor_id: String, operation: String) { () -> untyped } -> untyped
|
|
7
|
+
end
|
|
8
|
+
end
|
|
@@ -8,12 +8,17 @@ module SolidObjects
|
|
|
8
8
|
|
|
9
9
|
@registry: ProcessRegistry?
|
|
10
10
|
|
|
11
|
+
@shutdown_hook_installed: bool
|
|
12
|
+
|
|
11
13
|
# @rbs () -> void
|
|
12
14
|
def initialize: () -> void
|
|
13
15
|
|
|
14
16
|
# @rbs () -> ProcessRegistry
|
|
15
17
|
def process_registry: () -> ProcessRegistry
|
|
16
18
|
|
|
19
|
+
# @rbs () -> bool
|
|
20
|
+
def stop: () -> bool
|
|
21
|
+
|
|
17
22
|
private
|
|
18
23
|
|
|
19
24
|
attr_reader mutex: untyped
|
|
@@ -28,5 +33,11 @@ module SolidObjects
|
|
|
28
33
|
|
|
29
34
|
# @rbs () -> ProcessRegistry
|
|
30
35
|
def register: () -> ProcessRegistry
|
|
36
|
+
|
|
37
|
+
# @rbs () -> void
|
|
38
|
+
def install_shutdown_hook: () -> void
|
|
39
|
+
|
|
40
|
+
# @rbs () -> bool
|
|
41
|
+
def stop_after_exit: () -> bool
|
|
31
42
|
end
|
|
32
43
|
end
|
|
@@ -11,6 +11,15 @@ module SolidObjects
|
|
|
11
11
|
# @rbs () -> void
|
|
12
12
|
def cleanup: () -> void
|
|
13
13
|
|
|
14
|
+
# @rbs () -> void
|
|
15
|
+
def prune_messages: () -> void
|
|
16
|
+
|
|
17
|
+
# @rbs () -> void
|
|
18
|
+
def prune_instances: () -> void
|
|
19
|
+
|
|
20
|
+
# @rbs () -> void
|
|
21
|
+
def prune_processes: () -> void
|
|
22
|
+
|
|
14
23
|
# @rbs () -> void
|
|
15
24
|
def dead_letters: () -> void
|
|
16
25
|
|
|
@@ -25,7 +34,7 @@ module SolidObjects
|
|
|
25
34
|
# @rbs (Symbol, Integer) -> Integer
|
|
26
35
|
def numeric_option: (Symbol, Integer) -> Integer
|
|
27
36
|
|
|
28
|
-
# @rbs (Symbol) -> void
|
|
29
|
-
def authorize_administration!: (Symbol) -> void
|
|
37
|
+
# @rbs (Symbol, resource: String) -> void
|
|
38
|
+
def authorize_administration!: (Symbol, resource: String) -> void
|
|
30
39
|
end
|
|
31
40
|
end
|
|
@@ -13,6 +13,12 @@ module SolidObjects
|
|
|
13
13
|
# @rbs (Reference, Symbol | String, Hash[Symbol | String, untyped], timeout: Numeric, ?idempotency_key: String?, ?authorization_context: untyped) -> untyped
|
|
14
14
|
def sync: (Reference, Symbol | String, Hash[Symbol | String, untyped], timeout: Numeric, ?idempotency_key: String?, ?authorization_context: untyped) -> untyped
|
|
15
15
|
|
|
16
|
+
# @rbs (MessageReference, timeout: Numeric, ?authorization_context: untyped) -> untyped
|
|
17
|
+
def wait: (MessageReference, timeout: Numeric, ?authorization_context: untyped) -> untyped
|
|
18
|
+
|
|
19
|
+
# @rbs (Reference, ?authorization_context: untyped) -> StateSnapshot
|
|
20
|
+
def snapshot: (Reference, ?authorization_context: untyped) -> StateSnapshot
|
|
21
|
+
|
|
16
22
|
# @rbs (Reference, ?authorization_context: untyped) -> bool
|
|
17
23
|
def destroy: (Reference, ?authorization_context: untyped) -> bool
|
|
18
24
|
|
|
@@ -20,6 +26,15 @@ module SolidObjects
|
|
|
20
26
|
|
|
21
27
|
attr_reader mailbox: untyped
|
|
22
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
|
|
31
|
+
|
|
32
|
+
# @rbs (MessageReference, Message) -> void
|
|
33
|
+
def validate_message_reference!: (MessageReference, Message) -> void
|
|
34
|
+
|
|
35
|
+
# @rbs (Reference, Symbol | String) -> void
|
|
36
|
+
def reject_sync_inside_transaction!: (Reference, Symbol | String) -> void
|
|
37
|
+
|
|
23
38
|
# @rbs (Proc, Reference, Symbol | String, Hash[Symbol | String, untyped], authorization_context: untyped) -> void
|
|
24
39
|
def authorize!: (Proc, Reference, Symbol | String, Hash[Symbol | String, untyped], authorization_context: untyped) -> void
|
|
25
40
|
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Generated from lib/solid_objects/commit_action_registry.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module SolidObjects
|
|
4
|
+
class CommitActionContext < Data
|
|
5
|
+
attr_reader message_id(): untyped
|
|
6
|
+
|
|
7
|
+
attr_reader request_id(): untyped
|
|
8
|
+
|
|
9
|
+
attr_reader actor_type(): untyped
|
|
10
|
+
|
|
11
|
+
attr_reader actor_id(): untyped
|
|
12
|
+
|
|
13
|
+
attr_reader activation_generation(): untyped
|
|
14
|
+
|
|
15
|
+
def self.new: (untyped message_id, untyped request_id, untyped actor_type, untyped actor_id, untyped activation_generation) -> instance
|
|
16
|
+
| (message_id: untyped, request_id: untyped, actor_type: untyped, actor_id: untyped, activation_generation: untyped) -> instance
|
|
17
|
+
|
|
18
|
+
def self.members: () -> [ :message_id, :request_id, :actor_type, :actor_id, :activation_generation ]
|
|
19
|
+
|
|
20
|
+
def members: () -> [ :message_id, :request_id, :actor_type, :actor_id, :activation_generation ]
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
class CommitActionRegistry
|
|
24
|
+
@handlers: Hash[String, Proc]
|
|
25
|
+
|
|
26
|
+
@mutex: Mutex
|
|
27
|
+
|
|
28
|
+
# @rbs () -> void
|
|
29
|
+
def initialize: () -> void
|
|
30
|
+
|
|
31
|
+
# @rbs (String | Symbol, Proc) -> Proc
|
|
32
|
+
def register: (String | Symbol, Proc) -> Proc
|
|
33
|
+
|
|
34
|
+
# @rbs (String | Symbol) -> Proc
|
|
35
|
+
def fetch: (String | Symbol) -> Proc
|
|
36
|
+
|
|
37
|
+
private
|
|
38
|
+
|
|
39
|
+
attr_reader handlers: untyped
|
|
40
|
+
|
|
41
|
+
attr_reader mutex: untyped
|
|
42
|
+
end
|
|
43
|
+
end
|
|
@@ -2,16 +2,22 @@
|
|
|
2
2
|
|
|
3
3
|
module SolidObjects
|
|
4
4
|
class Configuration
|
|
5
|
-
@
|
|
6
|
-
|
|
7
|
-
@retry_delay: Proc
|
|
8
|
-
|
|
9
|
-
@process_heartbeat_interval: Float
|
|
5
|
+
@table_name_prefix: String
|
|
10
6
|
|
|
11
7
|
@process_alive_threshold: Float
|
|
12
8
|
|
|
13
9
|
@shutdown_timeout: Float
|
|
14
10
|
|
|
11
|
+
@message_retention: Numeric
|
|
12
|
+
|
|
13
|
+
@message_retention_by_actor_type: Hash[String, Numeric]
|
|
14
|
+
|
|
15
|
+
@instance_retention_by_actor_type: Hash[String, Numeric]
|
|
16
|
+
|
|
17
|
+
@process_retention: Numeric
|
|
18
|
+
|
|
19
|
+
@prune_batch_size: Integer
|
|
20
|
+
|
|
15
21
|
@worker_count: Integer
|
|
16
22
|
|
|
17
23
|
@effect_worker_count: Integer
|
|
@@ -40,8 +46,6 @@ module SolidObjects
|
|
|
40
46
|
|
|
41
47
|
@authorize_administration: Proc
|
|
42
48
|
|
|
43
|
-
@table_name_prefix: String
|
|
44
|
-
|
|
45
49
|
@polling_interval: Float
|
|
46
50
|
|
|
47
51
|
@sync_polling_interval: Float
|
|
@@ -66,6 +70,12 @@ module SolidObjects
|
|
|
66
70
|
|
|
67
71
|
@max_result_bytes: Integer
|
|
68
72
|
|
|
73
|
+
@max_attempts: Integer
|
|
74
|
+
|
|
75
|
+
@retry_delay: Proc
|
|
76
|
+
|
|
77
|
+
@process_heartbeat_interval: Float
|
|
78
|
+
|
|
69
79
|
attr_accessor table_name_prefix: untyped
|
|
70
80
|
|
|
71
81
|
attr_accessor polling_interval: untyped
|
|
@@ -102,6 +112,16 @@ module SolidObjects
|
|
|
102
112
|
|
|
103
113
|
attr_accessor shutdown_timeout: untyped
|
|
104
114
|
|
|
115
|
+
attr_accessor message_retention: untyped
|
|
116
|
+
|
|
117
|
+
attr_accessor message_retention_by_actor_type: untyped
|
|
118
|
+
|
|
119
|
+
attr_accessor instance_retention_by_actor_type: untyped
|
|
120
|
+
|
|
121
|
+
attr_accessor process_retention: untyped
|
|
122
|
+
|
|
123
|
+
attr_accessor prune_batch_size: untyped
|
|
124
|
+
|
|
105
125
|
attr_accessor worker_count: untyped
|
|
106
126
|
|
|
107
127
|
attr_accessor effect_worker_count: untyped
|
|
@@ -36,6 +36,15 @@ module SolidObjects
|
|
|
36
36
|
|
|
37
37
|
attr_reader fixed_connection: untyped
|
|
38
38
|
|
|
39
|
+
# @rbs (untyped) { () -> untyped } -> untyped
|
|
40
|
+
def with_transaction_deadline: (untyped) { () -> untyped } -> untyped
|
|
41
|
+
|
|
42
|
+
# @rbs (untyped) -> void
|
|
43
|
+
def configure_transaction_deadline: (untyped) -> void
|
|
44
|
+
|
|
45
|
+
# @rbs (Exception) -> bool
|
|
46
|
+
def deadline_error?: (Exception) -> bool
|
|
47
|
+
|
|
39
48
|
# @rbs () { (untyped) -> untyped } -> untyped
|
|
40
49
|
def with_connection: () { (untyped) -> untyped } -> untyped
|
|
41
50
|
end
|
|
@@ -11,6 +11,14 @@ module SolidObjects
|
|
|
11
11
|
|
|
12
12
|
# @rbs () -> String
|
|
13
13
|
def current_time_expression: () -> String
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
# @rbs (untyped) { () -> untyped } -> untyped
|
|
18
|
+
def with_transaction_deadline: (untyped) { () -> untyped } -> untyped
|
|
19
|
+
|
|
20
|
+
# @rbs (Exception) -> bool
|
|
21
|
+
def deadline_error?: (Exception) -> bool
|
|
14
22
|
end
|
|
15
23
|
end
|
|
16
24
|
end
|
|
@@ -8,6 +8,14 @@ module SolidObjects
|
|
|
8
8
|
|
|
9
9
|
# @rbs () -> String
|
|
10
10
|
def claim_lock: () -> String
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
# @rbs (untyped) -> void
|
|
15
|
+
def configure_transaction_deadline: (untyped) -> void
|
|
16
|
+
|
|
17
|
+
# @rbs (Exception) -> bool
|
|
18
|
+
def deadline_error?: (Exception) -> bool
|
|
11
19
|
end
|
|
12
20
|
end
|
|
13
21
|
end
|
|
@@ -5,6 +5,14 @@ module SolidObjects
|
|
|
5
5
|
class Sqlite < DatabaseAdapter
|
|
6
6
|
# @rbs () -> String
|
|
7
7
|
def current_time_expression: () -> String
|
|
8
|
+
|
|
9
|
+
private
|
|
10
|
+
|
|
11
|
+
# @rbs (untyped) { () -> untyped } -> untyped
|
|
12
|
+
def with_transaction_deadline: (untyped) { () -> untyped } -> untyped
|
|
13
|
+
|
|
14
|
+
# @rbs (Exception) -> bool
|
|
15
|
+
def deadline_error?: (Exception) -> bool
|
|
8
16
|
end
|
|
9
17
|
end
|
|
10
18
|
end
|
|
@@ -4,6 +4,9 @@ module SolidObjects
|
|
|
4
4
|
class Error < StandardError
|
|
5
5
|
end
|
|
6
6
|
|
|
7
|
+
class NonRetryableError < Error
|
|
8
|
+
end
|
|
9
|
+
|
|
7
10
|
class UnsupportedDatabase < Error
|
|
8
11
|
end
|
|
9
12
|
|
|
@@ -40,7 +43,122 @@ module SolidObjects
|
|
|
40
43
|
class ActorDestroyed < LostActivation
|
|
41
44
|
end
|
|
42
45
|
|
|
46
|
+
class DatabaseDeadlineExceeded < Error
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
class SyncEnqueueTimeout < Error
|
|
50
|
+
@timeout: Numeric
|
|
51
|
+
|
|
52
|
+
@actor_type: String
|
|
53
|
+
|
|
54
|
+
@actor_id: String
|
|
55
|
+
|
|
56
|
+
@message_name: String
|
|
57
|
+
|
|
58
|
+
attr_reader timeout: untyped
|
|
59
|
+
|
|
60
|
+
attr_reader actor_type: untyped
|
|
61
|
+
|
|
62
|
+
attr_reader actor_id: untyped
|
|
63
|
+
|
|
64
|
+
attr_reader message_name: untyped
|
|
65
|
+
|
|
66
|
+
# @rbs (timeout: Numeric, actor_type: String, actor_id: String, message_name: String) -> void
|
|
67
|
+
def initialize: (timeout: Numeric, actor_type: String, actor_id: String, message_name: String) -> void
|
|
68
|
+
end
|
|
69
|
+
|
|
43
70
|
class SyncTimeout < Error
|
|
71
|
+
@timeout: Numeric
|
|
72
|
+
|
|
73
|
+
@actor_type: String
|
|
74
|
+
|
|
75
|
+
@actor_id: String
|
|
76
|
+
|
|
77
|
+
@message_name: String
|
|
78
|
+
|
|
79
|
+
@message_id: Integer
|
|
80
|
+
|
|
81
|
+
@request_id: String
|
|
82
|
+
|
|
83
|
+
@sequence: Integer
|
|
84
|
+
|
|
85
|
+
@status: String
|
|
86
|
+
|
|
87
|
+
@waiting_on: String
|
|
88
|
+
|
|
89
|
+
@activation: Hash[String, untyped]
|
|
90
|
+
|
|
91
|
+
@blocker: Hash[String, untyped]?
|
|
92
|
+
|
|
93
|
+
attr_reader timeout: untyped
|
|
94
|
+
|
|
95
|
+
attr_reader actor_type: untyped
|
|
96
|
+
|
|
97
|
+
attr_reader actor_id: untyped
|
|
98
|
+
|
|
99
|
+
attr_reader message_name: untyped
|
|
100
|
+
|
|
101
|
+
attr_reader message_id: untyped
|
|
102
|
+
|
|
103
|
+
attr_reader request_id: untyped
|
|
104
|
+
|
|
105
|
+
attr_reader sequence: untyped
|
|
106
|
+
|
|
107
|
+
attr_reader status: untyped
|
|
108
|
+
|
|
109
|
+
attr_reader waiting_on: untyped
|
|
110
|
+
|
|
111
|
+
attr_reader activation: untyped
|
|
112
|
+
|
|
113
|
+
attr_reader blocker: untyped
|
|
114
|
+
|
|
115
|
+
# @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
|
|
116
|
+
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
|
|
117
|
+
|
|
118
|
+
# @rbs () -> MessageReference
|
|
119
|
+
def message_reference: () -> MessageReference
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
class SyncInsideTransaction < Error
|
|
123
|
+
@actor_type: String
|
|
124
|
+
|
|
125
|
+
@actor_id: String
|
|
126
|
+
|
|
127
|
+
@message_name: String
|
|
128
|
+
|
|
129
|
+
attr_reader actor_type: untyped
|
|
130
|
+
|
|
131
|
+
attr_reader actor_id: untyped
|
|
132
|
+
|
|
133
|
+
attr_reader message_name: untyped
|
|
134
|
+
|
|
135
|
+
# @rbs (actor_type: String, actor_id: String, message_name: String) -> void
|
|
136
|
+
def initialize: (actor_type: String, actor_id: String, message_name: String) -> void
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
class ApplicationWriteForbidden < NonRetryableError
|
|
140
|
+
@actor_type: String
|
|
141
|
+
|
|
142
|
+
@actor_id: String
|
|
143
|
+
|
|
144
|
+
@message_name: String
|
|
145
|
+
|
|
146
|
+
attr_reader actor_type: untyped
|
|
147
|
+
|
|
148
|
+
attr_reader actor_id: untyped
|
|
149
|
+
|
|
150
|
+
attr_reader message_name: untyped
|
|
151
|
+
|
|
152
|
+
# @rbs (actor_type: String, actor_id: String, message_name: String) -> void
|
|
153
|
+
def initialize: (actor_type: String, actor_id: String, message_name: String) -> void
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
class CommitActionUnavailable < NonRetryableError
|
|
157
|
+
# @rbs (actor_type: String, actor_id: String, message_name: String) -> void
|
|
158
|
+
def initialize: (actor_type: String, actor_id: String, message_name: String) -> void
|
|
159
|
+
end
|
|
160
|
+
|
|
161
|
+
class UnknownCommitAction < NonRetryableError
|
|
44
162
|
end
|
|
45
163
|
|
|
46
164
|
class Rejected < Error
|
|
@@ -21,6 +21,9 @@ module SolidObjects
|
|
|
21
21
|
# @rbs () -> Actor
|
|
22
22
|
def actor: () -> Actor
|
|
23
23
|
|
|
24
|
+
# @rbs (MessageContext) -> untyped
|
|
25
|
+
def invoke_actor: (MessageContext) -> untyped
|
|
26
|
+
|
|
24
27
|
# @rbs (Hash[String, untyped]) -> void
|
|
25
28
|
def ensure_query_did_not_mutate_state!: (Hash[String, untyped]) -> void
|
|
26
29
|
|
|
@@ -30,6 +33,15 @@ module SolidObjects
|
|
|
30
33
|
# @rbs (untyped, Hash[String, untyped]) -> void
|
|
31
34
|
def complete: (untyped, Hash[String, untyped]) -> void
|
|
32
35
|
|
|
36
|
+
# @rbs (Array[Actor::CommitActionIntent]) -> void
|
|
37
|
+
def execute_commit_actions: (Array[Actor::CommitActionIntent]) -> void
|
|
38
|
+
|
|
39
|
+
# @rbs (Actor::CommitActionIntent, Proc, CommitActionContext) -> untyped
|
|
40
|
+
def execute_commit_action: (Actor::CommitActionIntent, Proc, CommitActionContext) -> untyped
|
|
41
|
+
|
|
42
|
+
# @rbs () -> void
|
|
43
|
+
def ensure_application_database_is_shared!: () -> void
|
|
44
|
+
|
|
33
45
|
# @rbs (Message, Instance, Array[Actor::EffectIntent]) -> Array[Effect]
|
|
34
46
|
def enqueue_effects: (Message, Instance, Array[Actor::EffectIntent]) -> Array[Effect]
|
|
35
47
|
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Generated from lib/solid_objects/instance_pruner.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module SolidObjects
|
|
4
|
+
class InstancePruner
|
|
5
|
+
@now: Time
|
|
6
|
+
|
|
7
|
+
@batch_size: Integer
|
|
8
|
+
|
|
9
|
+
# @rbs (?now: Time, ?batch_size: Integer) -> void
|
|
10
|
+
def initialize: (?now: Time, ?batch_size: Integer) -> void
|
|
11
|
+
|
|
12
|
+
# @rbs () -> Integer
|
|
13
|
+
def preview: () -> Integer
|
|
14
|
+
|
|
15
|
+
# @rbs () -> Integer
|
|
16
|
+
def prune: () -> Integer
|
|
17
|
+
|
|
18
|
+
private
|
|
19
|
+
|
|
20
|
+
attr_reader now: untyped
|
|
21
|
+
|
|
22
|
+
attr_reader batch_size: untyped
|
|
23
|
+
|
|
24
|
+
# @rbs () -> Array[ActiveRecord::Relation[Instance]]
|
|
25
|
+
def policy_relations: () -> Array[ActiveRecord::Relation[Instance]]
|
|
26
|
+
|
|
27
|
+
# @rbs () -> ActiveRecord::Relation[Instance]
|
|
28
|
+
def prunable: () -> ActiveRecord::Relation[Instance]
|
|
29
|
+
|
|
30
|
+
# @rbs (ActiveRecord::Relation[Instance]) -> Integer
|
|
31
|
+
def prune_relation: (ActiveRecord::Relation[Instance]) -> Integer
|
|
32
|
+
|
|
33
|
+
# @rbs (Integer, ActiveRecord::Relation[Instance]) -> Integer
|
|
34
|
+
def prune_instance: (Integer, ActiveRecord::Relation[Instance]) -> Integer
|
|
35
|
+
end
|
|
36
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Generated from lib/solid_objects/message_pruner.rb with RBS::Inline
|
|
2
|
+
|
|
3
|
+
module SolidObjects
|
|
4
|
+
class MessagePruner
|
|
5
|
+
@now: Time
|
|
6
|
+
|
|
7
|
+
@batch_size: Integer
|
|
8
|
+
|
|
9
|
+
# @rbs (?now: Time, ?batch_size: Integer) -> void
|
|
10
|
+
def initialize: (?now: Time, ?batch_size: Integer) -> void
|
|
11
|
+
|
|
12
|
+
# @rbs () -> Integer
|
|
13
|
+
def preview: () -> Integer
|
|
14
|
+
|
|
15
|
+
# @rbs () -> Integer
|
|
16
|
+
def prune: () -> Integer
|
|
17
|
+
|
|
18
|
+
private
|
|
19
|
+
|
|
20
|
+
attr_reader now: untyped
|
|
21
|
+
|
|
22
|
+
attr_reader batch_size: untyped
|
|
23
|
+
|
|
24
|
+
# @rbs () -> Array[ActiveRecord::Relation[Message]]
|
|
25
|
+
def policy_relations: () -> Array[ActiveRecord::Relation[Message]]
|
|
26
|
+
|
|
27
|
+
# @rbs () -> ActiveRecord::Relation[Message]
|
|
28
|
+
def prunable: () -> ActiveRecord::Relation[Message]
|
|
29
|
+
|
|
30
|
+
# @rbs (ActiveRecord::Relation[Message]) -> Integer
|
|
31
|
+
def prune_relation: (ActiveRecord::Relation[Message]) -> Integer
|
|
32
|
+
|
|
33
|
+
# @rbs () -> Numeric
|
|
34
|
+
def default_retention: () -> Numeric
|
|
35
|
+
|
|
36
|
+
# @rbs () -> Hash[String, Numeric]
|
|
37
|
+
def retention_overrides: () -> Hash[String, Numeric]
|
|
38
|
+
|
|
39
|
+
# @rbs (Numeric) -> Time
|
|
40
|
+
def retention_cutoff: (Numeric) -> Time
|
|
41
|
+
end
|
|
42
|
+
end
|