solid_objects 0.4.2 → 0.5.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 (47) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -0
  3. data/README.md +62 -10
  4. data/app/assets/javascripts/solid_objects/component_refresh.js +124 -0
  5. data/app/controllers/solid_objects/components_controller.rb +2 -7
  6. data/app/helpers/solid_objects/actor_helper.rb +8 -1
  7. data/docs/adr/0009-realtime-updates.md +18 -1
  8. data/docs/architecture.md +34 -18
  9. data/docs/authorization.md +24 -0
  10. data/docs/correctness.md +19 -8
  11. data/docs/operations.md +6 -0
  12. data/docs/realtime.md +78 -13
  13. data/docs/roadmap.md +6 -5
  14. data/examples/application/app/views/chat_rooms/show.html.erb +3 -1
  15. data/lib/solid_objects/activation.rb +9 -5
  16. data/lib/solid_objects/actor_registry.rb +6 -1
  17. data/lib/solid_objects/actor_view.rb +40 -13
  18. data/lib/solid_objects/application_actor_loader.rb +53 -0
  19. data/lib/solid_objects/caller_process.rb +6 -4
  20. data/lib/solid_objects/cli.rb +2 -0
  21. data/lib/solid_objects/client.rb +26 -20
  22. data/lib/solid_objects/component_registration.rb +61 -16
  23. data/lib/solid_objects/component_renderer.rb +14 -17
  24. data/lib/solid_objects/component_subscriptions.rb +7 -7
  25. data/lib/solid_objects/component_token.rb +70 -2
  26. data/lib/solid_objects/database_adapter.rb +10 -0
  27. data/lib/solid_objects/database_adapters/sqlite.rb +51 -2
  28. data/lib/solid_objects/dom_identity.rb +12 -3
  29. data/lib/solid_objects/engine.rb +7 -0
  30. data/lib/solid_objects/process_registry.rb +21 -14
  31. data/lib/solid_objects/sync_diagnostics.rb +57 -3
  32. data/lib/solid_objects/synchronous_invocation.rb +45 -13
  33. data/lib/solid_objects/turbo_stream_renderer.rb +14 -5
  34. data/lib/solid_objects/version.rb +1 -1
  35. data/sig/generated/lib/solid_objects/actor_registry.rbs +3 -0
  36. data/sig/generated/lib/solid_objects/actor_view.rbs +10 -4
  37. data/sig/generated/lib/solid_objects/application_actor_loader.rbs +30 -0
  38. data/sig/generated/lib/solid_objects/component_registration.rbs +34 -10
  39. data/sig/generated/lib/solid_objects/component_renderer.rbs +4 -8
  40. data/sig/generated/lib/solid_objects/component_token.rbs +24 -2
  41. data/sig/generated/lib/solid_objects/database_adapter.rbs +8 -2
  42. data/sig/generated/lib/solid_objects/database_adapters/sqlite.rbs +13 -0
  43. data/sig/generated/lib/solid_objects/dom_identity.rbs +5 -2
  44. data/sig/generated/lib/solid_objects/sync_diagnostics.rbs +9 -0
  45. data/sig/generated/lib/solid_objects/synchronous_invocation.rbs +9 -0
  46. data/sig/generated/lib/solid_objects/turbo_stream_renderer.rbs +3 -0
  47. metadata +4 -1
@@ -32,5 +32,8 @@ module SolidObjects
32
32
 
33
33
  # @rbs (untyped) -> void
34
34
  def validate_actor_class!: (untyped) -> void
35
+
36
+ # @rbs (Class, Class) -> bool
37
+ def reload_of?: (Class, Class) -> bool
35
38
  end
36
39
  end
@@ -22,8 +22,8 @@ module SolidObjects
22
22
  # @rbs (Symbol | String) -> untyped
23
23
  def value: (Symbol | String) -> untyped
24
24
 
25
- # @rbs (Symbol | String, ?observes: Symbol | String | Array[Symbol | String]?, ?partial: String?) -> untyped
26
- def component: (Symbol | String, ?observes: Symbol | String | Array[Symbol | String]?, ?partial: String?) -> untyped
25
+ # @rbs (Symbol | String, ?observes: Symbol | String | Array[Symbol | String]?, ?partial: String?, ?key: untyped, ?locals: Hash[untyped, untyped], ?refresh: String | Symbol) -> untyped
26
+ def component: (Symbol | String, ?observes: Symbol | String | Array[Symbol | String]?, ?partial: String?, ?key: untyped, ?locals: Hash[untyped, untyped], ?refresh: String | Symbol) -> untyped
27
27
 
28
28
  # @rbs () -> Array[String]
29
29
  def component_tokens: () -> Array[String]
@@ -31,6 +31,9 @@ module SolidObjects
31
31
  # @rbs () -> Array[String]
32
32
  def scalar_observable_names: () -> Array[String]
33
33
 
34
+ # @rbs () -> bool
35
+ def morph_components?: () -> bool
36
+
34
37
  # @rbs () -> State
35
38
  def state: () -> State
36
39
 
@@ -73,8 +76,11 @@ module SolidObjects
73
76
  # @rbs (Array[String]) -> void
74
77
  def validate_dependencies!: (Array[String]) -> void
75
78
 
76
- # @rbs (String) -> void
77
- def ensure_unique_component!: (String) -> void
79
+ # @rbs (ComponentRegistration) -> void
80
+ def ensure_unique_component!: (ComponentRegistration) -> void
81
+
82
+ # @rbs (key: untyped, locals: Hash[untyped, untyped], refresh: String | Symbol) -> void
83
+ def validate_static_options!: (key: untyped, locals: Hash[untyped, untyped], refresh: String | Symbol) -> void
78
84
 
79
85
  # @rbs () -> Proc | ComponentPathResolver
80
86
  def component_path_resolver: () -> Proc
@@ -0,0 +1,30 @@
1
+ # Generated from lib/solid_objects/application_actor_loader.rb with RBS::Inline
2
+
3
+ module SolidObjects
4
+ class ApplicationActorLoader
5
+ @application: untyped
6
+
7
+ @autoloader: untyped
8
+
9
+ # @rbs (?application: untyped, ?autoloader: untyped) -> void
10
+ def initialize: (?application: untyped, ?autoloader: untyped) -> void
11
+
12
+ # @rbs () -> void
13
+ def call: () -> void
14
+
15
+ # @rbs () -> void
16
+ def install: () -> void
17
+
18
+ private
19
+
20
+ attr_reader application: untyped
21
+
22
+ attr_reader autoloader: untyped
23
+
24
+ # @rbs () -> Array[String]
25
+ def actor_directories: () -> Array[String]
26
+
27
+ # @rbs () -> Array[Class]
28
+ def current_actor_classes: () -> Array[Class]
29
+ end
30
+ end
@@ -2,26 +2,38 @@
2
2
 
3
3
  module SolidObjects
4
4
  class ComponentRegistration
5
- @reference: Reference
5
+ @token: String
6
6
 
7
- @component_name: String
7
+ @refresh_path: String
8
8
 
9
- @dependencies: Array[String]
9
+ @revision: Integer
10
10
 
11
11
  @instance_id: Integer
12
12
 
13
- @revision: Integer
13
+ @refresh_method: String
14
14
 
15
- @refresh_path: String
15
+ @locals: Hash[String, untyped]
16
16
 
17
- @token: String
17
+ @dependencies: Array[String]
18
+
19
+ @component_key: String | Integer?
20
+
21
+ @component_name: String
22
+
23
+ @reference: Reference
18
24
 
19
25
  attr_reader reference: untyped
20
26
 
21
27
  attr_reader component_name: untyped
22
28
 
29
+ attr_reader component_key: untyped
30
+
23
31
  attr_reader dependencies: untyped
24
32
 
33
+ attr_reader locals: untyped
34
+
35
+ attr_reader refresh_method: untyped
36
+
25
37
  attr_reader instance_id: untyped
26
38
 
27
39
  attr_reader revision: untyped
@@ -30,21 +42,33 @@ module SolidObjects
30
42
 
31
43
  attr_reader token: untyped
32
44
 
33
- # @rbs (reference: Reference, component_name: String, dependencies: Array[String], instance_id: Integer, revision: Integer, refresh_path: String, token: String) -> void
34
- def initialize: (reference: Reference, component_name: String, dependencies: Array[String], instance_id: Integer, revision: Integer, refresh_path: String, token: String) -> void
45
+ # @rbs (reference: Reference, component_name: String, component_key: String | Integer?, dependencies: Array[String], locals: Hash[String, untyped], refresh_method: String, instance_id: Integer, revision: Integer, refresh_path: String, token: String) -> void
46
+ def initialize: (reference: Reference, component_name: String, component_key: String | Integer?, dependencies: Array[String], locals: Hash[String, untyped], refresh_method: String, instance_id: Integer, revision: Integer, refresh_path: String, token: String) -> void
35
47
 
36
- # @rbs (reference: Reference, component_name: String, dependencies: Array[String], snapshot: ActorSnapshot, refresh_path: String) -> ComponentRegistration
37
- def self.issue: (reference: Reference, component_name: String, dependencies: Array[String], snapshot: ActorSnapshot, refresh_path: String) -> ComponentRegistration
48
+ # @rbs (reference: Reference, component_name: String, component_key: untyped, dependencies: Array[String], locals: Hash[untyped, untyped], refresh_method: String | Symbol, snapshot: ActorSnapshot, refresh_path: String) -> ComponentRegistration
49
+ def self.issue: (reference: Reference, component_name: String, component_key: untyped, dependencies: Array[String], locals: Hash[untyped, untyped], refresh_method: String | Symbol, snapshot: ActorSnapshot, refresh_path: String) -> ComponentRegistration
38
50
 
39
51
  # @rbs (String) -> ComponentRegistration
40
52
  def self.from_token: (String) -> ComponentRegistration
41
53
 
54
+ # @rbs (Hash[String, untyped], token: String) -> ComponentRegistration
55
+ private def self.build: (Hash[String, untyped], token: String) -> ComponentRegistration
56
+
42
57
  # @rbs (Reference, Array[String]) -> void
43
58
  private def self.validate_dependencies!: (Reference, Array[String]) -> void
44
59
 
45
60
  # @rbs () -> Array[Integer]
46
61
  def revision_key: () -> Array[Integer]
47
62
 
63
+ # @rbs () -> String
64
+ def dom_id: () -> String
65
+
66
+ # @rbs () -> bool
67
+ def morph?: () -> bool
68
+
69
+ # @rbs () -> Hash[String, untyped]
70
+ def authorization_arguments: () -> Hash[String, untyped]
71
+
48
72
  # @rbs (Integer, Integer) -> String
49
73
  def refresh_url: (Integer, Integer) -> String
50
74
  end
@@ -4,16 +4,14 @@ module SolidObjects
4
4
  class ComponentRenderer
5
5
  @snapshot: ActorSnapshot
6
6
 
7
- @component_name: String
8
-
9
- @dependencies: Array[String]
7
+ @registration: ComponentRegistration
10
8
 
11
9
  @view_context: untyped
12
10
 
13
11
  @authorization_context: untyped
14
12
 
15
- # @rbs (snapshot: ActorSnapshot, component_name: String, dependencies: Array[String], view_context: untyped, authorization_context: untyped) -> void
16
- def initialize: (snapshot: ActorSnapshot, component_name: String, dependencies: Array[String], view_context: untyped, authorization_context: untyped) -> void
13
+ # @rbs (snapshot: ActorSnapshot, registration: ComponentRegistration, view_context: untyped, authorization_context: untyped) -> void
14
+ def initialize: (snapshot: ActorSnapshot, registration: ComponentRegistration, view_context: untyped, authorization_context: untyped) -> void
17
15
 
18
16
  # @rbs () -> untyped
19
17
  def call: () -> untyped
@@ -22,9 +20,7 @@ module SolidObjects
22
20
 
23
21
  attr_reader snapshot: untyped
24
22
 
25
- attr_reader component_name: untyped
26
-
27
- attr_reader dependencies: untyped
23
+ attr_reader registration: untyped
28
24
 
29
25
  attr_reader view_context: untyped
30
26
 
@@ -8,8 +8,18 @@ module SolidObjects
8
8
 
9
9
  MAXIMUM_DEPENDENCIES: ::Integer
10
10
 
11
- # @rbs (reference: Reference, component_name: String, dependencies: Array[String], instance_id: Integer, revision: Integer, refresh_path: String) -> String
12
- def self?.generate: (reference: Reference, component_name: String, dependencies: Array[String], instance_id: Integer, revision: Integer, refresh_path: String) -> String
11
+ MAXIMUM_LOCALS: ::Integer
12
+
13
+ MAXIMUM_COMPONENT_KEY_BYTES: ::Integer
14
+
15
+ REFRESH_METHODS: untyped
16
+
17
+ RESERVED_LOCALS: untyped
18
+
19
+ RUBY_KEYWORDS: untyped
20
+
21
+ # @rbs (reference: Reference, component_name: String, dependencies: Array[String], instance_id: Integer, revision: Integer, refresh_path: String, ?component_key: untyped, ?locals: Hash[untyped, untyped], ?refresh_method: String | Symbol) -> String
22
+ def self?.generate: (reference: Reference, component_name: String, dependencies: Array[String], instance_id: Integer, revision: Integer, refresh_path: String, ?component_key: untyped, ?locals: Hash[untyped, untyped], ?refresh_method: String | Symbol) -> String
13
23
 
14
24
  # @rbs (String) -> Hash[String, untyped]
15
25
  def self?.verify: (String) -> Hash[String, untyped]
@@ -17,12 +27,24 @@ module SolidObjects
17
27
  # @rbs (Hash[String, untyped]) -> Hash[String, untyped]
18
28
  def self?.validate_payload!: (Hash[String, untyped]) -> Hash[String, untyped]
19
29
 
30
+ # @rbs (Hash[String, untyped]?) -> void
31
+ def self?.apply_defaults!: (Hash[String, untyped]?) -> void
32
+
20
33
  # @rbs (String) -> void
21
34
  def self?.validate_component_name!: (String) -> void
22
35
 
36
+ # @rbs (untyped) -> void
37
+ def self?.validate_component_key!: (untyped) -> void
38
+
23
39
  # @rbs (Array[untyped]) -> void
24
40
  def self?.validate_dependencies!: (Array[untyped]) -> void
25
41
 
42
+ # @rbs (Hash[untyped, untyped]) -> void
43
+ def self?.validate_locals!: (Hash[untyped, untyped]) -> void
44
+
45
+ # @rbs (String) -> void
46
+ def self?.validate_refresh_method!: (String) -> void
47
+
26
48
  # @rbs (Integer, Integer) -> void
27
49
  def self?.validate_revision!: (Integer, Integer) -> void
28
50
 
@@ -5,10 +5,10 @@ module SolidObjects
5
5
  # @rbs (untyped) -> DatabaseAdapter
6
6
  def self.for: (untyped) -> DatabaseAdapter
7
7
 
8
- @connection_pool: untyped
9
-
10
8
  @fixed_connection: untyped
11
9
 
10
+ @connection_pool: untyped
11
+
12
12
  # @rbs (untyped) -> void
13
13
  def initialize: (untyped) -> void
14
14
 
@@ -24,6 +24,12 @@ module SolidObjects
24
24
  # @rbs () -> Time
25
25
  def database_now: () -> Time
26
26
 
27
+ # @rbs () { () -> untyped } -> untyped
28
+ def with_lock_retry: () { () -> untyped } -> untyped
29
+
30
+ # @rbs () { () -> untyped } -> untyped
31
+ def with_lock_probe: () { () -> untyped } -> untyped
32
+
27
33
  # @rbs () { () -> untyped } -> untyped
28
34
  def transaction: () { () -> untyped } -> untyped
29
35
 
@@ -5,12 +5,22 @@ module SolidObjects
5
5
  class Sqlite < DatabaseAdapter
6
6
  LOCK_RETRY_INTERVAL: ::Float
7
7
 
8
+ LOCK_RETRY_MUTEX: untyped
9
+
10
+ LOCK_RETRY_CONDITION: untyped
11
+
8
12
  # @rbs () -> String
9
13
  def current_time_expression: () -> String
10
14
 
11
15
  # @rbs () { () -> untyped } -> untyped
12
16
  def transaction: () { () -> untyped } -> untyped
13
17
 
18
+ # @rbs () { () -> untyped } -> untyped
19
+ def with_lock_retry: () { () -> untyped } -> untyped
20
+
21
+ # @rbs () { () -> untyped } -> untyped
22
+ def with_lock_probe: () { () -> untyped } -> untyped
23
+
14
24
  private
15
25
 
16
26
  # @rbs (untyped) { () -> untyped } -> untyped
@@ -18,6 +28,9 @@ module SolidObjects
18
28
 
19
29
  # @rbs (Exception) -> bool
20
30
  def deadline_error?: (Exception) -> bool
31
+
32
+ # @rbs () -> void
33
+ def wait_before_retry: () -> void
21
34
  end
22
35
  end
23
36
  end
@@ -8,13 +8,16 @@ module SolidObjects
8
8
  # @rbs (Reference, Symbol | String) -> String
9
9
  def self?.observable: (Reference, Symbol | String) -> String
10
10
 
11
- # @rbs (Reference, Symbol | String) -> String
12
- def self?.component: (Reference, Symbol | String) -> String
11
+ # @rbs (Reference, Symbol | String, ?key: String | Integer?) -> String
12
+ def self?.component: (Reference, Symbol | String, ?key: String | Integer?) -> String
13
13
 
14
14
  # @rbs (Reference) -> String
15
15
  def self?.identity_digest: (Reference) -> String
16
16
 
17
17
  # @rbs (Symbol | String) -> String
18
18
  def self?.normalized_name: (Symbol | String) -> String
19
+
20
+ # @rbs (String | Integer) -> String
21
+ def self?.component_key_digest: (String | Integer) -> String
19
22
  end
20
23
  end
@@ -5,8 +5,17 @@ module SolidObjects
5
5
  # @rbs (Message, timeout: Numeric) -> SyncTimeout
6
6
  def call: (Message, timeout: Numeric) -> SyncTimeout
7
7
 
8
+ # @rbs (Message, timeout: Numeric) -> SyncTimeout
9
+ def database_contention: (Message, timeout: Numeric) -> SyncTimeout
10
+
11
+ # @rbs (MessageReference, timeout: Numeric) -> SyncTimeout
12
+ def database_contention_for: (MessageReference, timeout: Numeric) -> SyncTimeout
13
+
8
14
  private
9
15
 
16
+ # @rbs (Message, timeout: Numeric, status: String, waiting_on: String, activation: Hash[String, untyped], blocker: Hash[String, untyped]?) -> SyncTimeout
17
+ def build_error: (Message, timeout: Numeric, status: String, waiting_on: String, activation: Hash[String, untyped], blocker: Hash[String, untyped]?) -> SyncTimeout
18
+
10
19
  # @rbs (Message) -> String
11
20
  def message_status: (Message) -> String
12
21
 
@@ -13,6 +13,9 @@ module SolidObjects
13
13
  # @rbs (MessageReference) -> Message
14
14
  def load_message: (MessageReference) -> Message
15
15
 
16
+ # @rbs (MessageReference) -> Message?
17
+ def load_message_at_deadline: (MessageReference) -> Message?
18
+
16
19
  # @rbs (Message) -> untyped
17
20
  def completed_result: (Message) -> untyped
18
21
 
@@ -25,6 +28,12 @@ module SolidObjects
25
28
  # @rbs (Numeric) -> void
26
29
  def wait: (Numeric) -> void
27
30
 
31
+ # @rbs (Message, timeout: Numeric) -> SyncTimeout
32
+ def diagnose_timeout: (Message, timeout: Numeric) -> SyncTimeout
33
+
34
+ # @rbs (Message?, MessageReference, timeout: Numeric) -> SyncTimeout
35
+ def contention_timeout: (Message?, MessageReference, timeout: Numeric) -> SyncTimeout
36
+
28
37
  # @rbs () -> Float
29
38
  def monotonic_now: () -> Float
30
39
  end
@@ -20,5 +20,8 @@ module SolidObjects
20
20
 
21
21
  # @rbs (untyped) -> String
22
22
  def self?.display_value: (untyped) -> String
23
+
24
+ # @rbs (ComponentRegistration, Integer, Integer) -> String
25
+ def self?.morph_component_refresh: (ComponentRegistration, Integer, Integer) -> String
23
26
  end
24
27
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solid_objects
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucas Carlson
@@ -262,6 +262,7 @@ files:
262
262
  - MIT-LICENSE
263
263
  - README.md
264
264
  - Rakefile
265
+ - app/assets/javascripts/solid_objects/component_refresh.js
265
266
  - app/controllers/solid_objects/application_controller.rb
266
267
  - app/controllers/solid_objects/components_controller.rb
267
268
  - app/controllers/solid_objects/dead_letters_controller.rb
@@ -346,6 +347,7 @@ files:
346
347
  - lib/solid_objects/actor_registry.rb
347
348
  - lib/solid_objects/actor_snapshot.rb
348
349
  - lib/solid_objects/actor_view.rb
350
+ - lib/solid_objects/application_actor_loader.rb
349
351
  - lib/solid_objects/application_write_guard.rb
350
352
  - lib/solid_objects/broadcast_executor.rb
351
353
  - lib/solid_objects/caller_process.rb
@@ -415,6 +417,7 @@ files:
415
417
  - sig/generated/lib/solid_objects/actor_registry.rbs
416
418
  - sig/generated/lib/solid_objects/actor_snapshot.rbs
417
419
  - sig/generated/lib/solid_objects/actor_view.rbs
420
+ - sig/generated/lib/solid_objects/application_actor_loader.rbs
418
421
  - sig/generated/lib/solid_objects/application_write_guard.rbs
419
422
  - sig/generated/lib/solid_objects/broadcast_executor.rbs
420
423
  - sig/generated/lib/solid_objects/caller_process.rbs