pg_eventstore 1.1.3 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (141) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/README.md +4 -3
  4. data/docs/subscriptions.md +25 -2
  5. data/lib/pg_eventstore/abstract_command.rb +2 -0
  6. data/lib/pg_eventstore/callbacks.rb +3 -0
  7. data/lib/pg_eventstore/client.rb +6 -1
  8. data/lib/pg_eventstore/config.rb +1 -1
  9. data/lib/pg_eventstore/connection.rb +9 -1
  10. data/lib/pg_eventstore/errors.rb +45 -26
  11. data/lib/pg_eventstore/event.rb +2 -1
  12. data/lib/pg_eventstore/event_class_resolver.rb +1 -1
  13. data/lib/pg_eventstore/event_deserializer.rb +8 -2
  14. data/lib/pg_eventstore/event_serializer.rb +2 -0
  15. data/lib/pg_eventstore/extensions/callbacks_extension.rb +1 -0
  16. data/lib/pg_eventstore/extensions/options_extension.rb +3 -1
  17. data/lib/pg_eventstore/queries/event_queries.rb +12 -4
  18. data/lib/pg_eventstore/queries/links_resolver.rb +3 -0
  19. data/lib/pg_eventstore/queries/partition_queries.rb +6 -0
  20. data/lib/pg_eventstore/queries/transaction_queries.rb +4 -0
  21. data/lib/pg_eventstore/queries.rb +1 -1
  22. data/lib/pg_eventstore/query_builders/{events_filtering_query.rb → events_filtering.rb} +3 -0
  23. data/lib/pg_eventstore/sql_builder.rb +18 -10
  24. data/lib/pg_eventstore/stream.rb +13 -2
  25. data/lib/pg_eventstore/subscriptions/basic_runner.rb +2 -0
  26. data/lib/pg_eventstore/subscriptions/commands_handler.rb +5 -3
  27. data/lib/pg_eventstore/subscriptions/queries/subscription_command_queries.rb +6 -4
  28. data/lib/pg_eventstore/subscriptions/queries/subscription_queries.rb +4 -2
  29. data/lib/pg_eventstore/subscriptions/queries/subscriptions_set_command_queries.rb +6 -4
  30. data/lib/pg_eventstore/subscriptions/queries/subscriptions_set_queries.rb +3 -0
  31. data/lib/pg_eventstore/subscriptions/runner_state.rb +1 -0
  32. data/lib/pg_eventstore/subscriptions/subscription.rb +19 -17
  33. data/lib/pg_eventstore/subscriptions/subscription_feeder.rb +8 -0
  34. data/lib/pg_eventstore/subscriptions/subscription_feeder_commands/base.rb +4 -4
  35. data/lib/pg_eventstore/subscriptions/subscription_handler_performance.rb +2 -1
  36. data/lib/pg_eventstore/subscriptions/subscription_runner.rb +5 -0
  37. data/lib/pg_eventstore/subscriptions/subscription_runner_commands/base.rb +4 -4
  38. data/lib/pg_eventstore/subscriptions/subscriptions_manager.rb +15 -5
  39. data/lib/pg_eventstore/subscriptions/subscriptions_set.rb +10 -10
  40. data/lib/pg_eventstore/version.rb +2 -1
  41. data/lib/pg_eventstore/web/application.rb +6 -6
  42. data/lib/pg_eventstore/web/paginator/base_collection.rb +15 -1
  43. data/lib/pg_eventstore/web/paginator/event_types_collection.rb +2 -1
  44. data/lib/pg_eventstore/web/paginator/events_collection.rb +7 -4
  45. data/lib/pg_eventstore/web/paginator/helpers.rb +3 -3
  46. data/lib/pg_eventstore/web/paginator/stream_contexts_collection.rb +2 -1
  47. data/lib/pg_eventstore/web/paginator/stream_ids_collection.rb +2 -1
  48. data/lib/pg_eventstore/web/paginator/stream_names_collection.rb +2 -1
  49. data/lib/pg_eventstore/web/subscriptions/set_collection.rb +2 -0
  50. data/lib/pg_eventstore/web/subscriptions/subscriptions.rb +2 -0
  51. data/lib/pg_eventstore/web/subscriptions/subscriptions_set.rb +2 -0
  52. data/lib/pg_eventstore/web/subscriptions/subscriptions_to_set_association.rb +6 -1
  53. data/lib/pg_eventstore.rb +6 -1
  54. data/rbs_collection.lock.yaml +16 -0
  55. data/rbs_collection.yaml +23 -0
  56. data/sig/interfaces/callback.rbs +3 -0
  57. data/sig/interfaces/event_class_resolver.rbs +3 -0
  58. data/sig/interfaces/event_modifier.rbs +3 -0
  59. data/sig/interfaces/restart_terminator.rbs +3 -0
  60. data/sig/interfaces/subscription_handler.rbs +3 -0
  61. data/sig/pg/basic_type_registry.rbs +21 -0
  62. data/sig/pg/connection.rbs +407 -0
  63. data/sig/pg/constants.rbs +153 -0
  64. data/sig/pg_eventstore/abstract_command.rbs +11 -0
  65. data/sig/pg_eventstore/callbacks.rbs +21 -0
  66. data/sig/pg_eventstore/client.rbs +67 -0
  67. data/sig/pg_eventstore/commands/append.rbs +33 -0
  68. data/sig/pg_eventstore/commands/event_modifiers/prepare_link_event.rbs +24 -0
  69. data/sig/pg_eventstore/commands/event_modifiers/prepare_regular_event.rbs +12 -0
  70. data/sig/pg_eventstore/commands/link_to.rbs +17 -0
  71. data/sig/pg_eventstore/commands/multiple.rbs +7 -0
  72. data/sig/pg_eventstore/commands/read.rbs +10 -0
  73. data/sig/pg_eventstore/commands/regular_stream_read_paginated.rbs +32 -0
  74. data/sig/pg_eventstore/commands/system_stream_read_paginated.rbs +30 -0
  75. data/sig/pg_eventstore/config.rbs +51 -0
  76. data/sig/pg_eventstore/connection.rbs +30 -0
  77. data/sig/pg_eventstore/errors.rbs +116 -0
  78. data/sig/pg_eventstore/event.rbs +46 -0
  79. data/sig/pg_eventstore/event_class_resolver.rbs +6 -0
  80. data/sig/pg_eventstore/event_deserializer.rbs +20 -0
  81. data/sig/pg_eventstore/event_serializer.rbs +13 -0
  82. data/sig/pg_eventstore/extensions/callbacks_extension.rbs +23 -0
  83. data/sig/pg_eventstore/extensions/options_extension.rbs +37 -0
  84. data/sig/pg_eventstore/extensions/using_connection_extension.rbs +14 -0
  85. data/sig/pg_eventstore/middleware.rbs +9 -0
  86. data/sig/pg_eventstore/pg_connection.rbs +13 -0
  87. data/sig/pg_eventstore/queries/event_queries.rbs +50 -0
  88. data/sig/pg_eventstore/queries/links_resolver.rbs +19 -0
  89. data/sig/pg_eventstore/queries/partition_queries.rbs +74 -0
  90. data/sig/pg_eventstore/queries/transaction_queries.rbs +21 -0
  91. data/sig/pg_eventstore/queries.rbs +23 -0
  92. data/sig/pg_eventstore/query_builders/events_filtering_query.rbs +62 -0
  93. data/sig/pg_eventstore/sql_builder.rbs +74 -0
  94. data/sig/pg_eventstore/stream.rbs +40 -0
  95. data/sig/pg_eventstore/subscriptions/basic_runner.rbs +37 -0
  96. data/sig/pg_eventstore/subscriptions/command_handlers/subscription_feeder_commands.rbs +16 -0
  97. data/sig/pg_eventstore/subscriptions/command_handlers/subscription_runners_commands.rbs +18 -0
  98. data/sig/pg_eventstore/subscriptions/commands_handler.rbs +25 -0
  99. data/sig/pg_eventstore/subscriptions/events_processor.rbs +34 -0
  100. data/sig/pg_eventstore/subscriptions/extensions/base_command_extension.rbs +20 -0
  101. data/sig/pg_eventstore/subscriptions/extensions/command_class_lookup_extension.rbs +8 -0
  102. data/sig/pg_eventstore/subscriptions/queries/subscription_command_queries.rbs +56 -0
  103. data/sig/pg_eventstore/subscriptions/queries/subscription_queries.rbs +73 -0
  104. data/sig/pg_eventstore/subscriptions/queries/subscriptions_set_command_queries.rbs +39 -0
  105. data/sig/pg_eventstore/subscriptions/queries/subscriptions_set_queries.rbs +36 -0
  106. data/sig/pg_eventstore/subscriptions/runner_state.rbs +16 -0
  107. data/sig/pg_eventstore/subscriptions/subscription.rbs +96 -0
  108. data/sig/pg_eventstore/subscriptions/subscription_feeder.rbs +64 -0
  109. data/sig/pg_eventstore/subscriptions/subscription_feeder_commands/base.rbs +45 -0
  110. data/sig/pg_eventstore/subscriptions/subscription_feeder_commands/restore.rbs +8 -0
  111. data/sig/pg_eventstore/subscriptions/subscription_feeder_commands/start_all.rbs +8 -0
  112. data/sig/pg_eventstore/subscriptions/subscription_feeder_commands/stop.rbs +8 -0
  113. data/sig/pg_eventstore/subscriptions/subscription_feeder_commands/stop_all.rbs +8 -0
  114. data/sig/pg_eventstore/subscriptions/subscription_feeder_commands.rbs +8 -0
  115. data/sig/pg_eventstore/subscriptions/subscription_handler_performance.rbs +12 -0
  116. data/sig/pg_eventstore/subscriptions/subscription_runner.rbs +55 -0
  117. data/sig/pg_eventstore/subscriptions/subscription_runner_commands/base.rbs +47 -0
  118. data/sig/pg_eventstore/subscriptions/subscription_runner_commands/reset_position.rbs +11 -0
  119. data/sig/pg_eventstore/subscriptions/subscription_runner_commands/restore.rbs +8 -0
  120. data/sig/pg_eventstore/subscriptions/subscription_runner_commands/start.rbs +8 -0
  121. data/sig/pg_eventstore/subscriptions/subscription_runner_commands/stop.rbs +8 -0
  122. data/sig/pg_eventstore/subscriptions/subscription_runner_commands.rbs +8 -0
  123. data/sig/pg_eventstore/subscriptions/subscription_runners_feeder.rbs +13 -0
  124. data/sig/pg_eventstore/subscriptions/subscriptions_manager.rbs +62 -0
  125. data/sig/pg_eventstore/subscriptions/subscriptions_set.rbs +72 -0
  126. data/sig/pg_eventstore/utils.rbs +20 -0
  127. data/sig/pg_eventstore/version.rbs +3 -0
  128. data/sig/pg_eventstore/web/paginator/base_collection.rbs +51 -0
  129. data/sig/pg_eventstore/web/paginator/event_types_collection.rbs +15 -0
  130. data/sig/pg_eventstore/web/paginator/events_collection.rbs +31 -0
  131. data/sig/pg_eventstore/web/paginator/helpers.rbs +38 -0
  132. data/sig/pg_eventstore/web/paginator/stream_contexts_collection.rbs +15 -0
  133. data/sig/pg_eventstore/web/paginator/stream_ids_collection.rbs +15 -0
  134. data/sig/pg_eventstore/web/paginator/stream_names_collection.rbs +15 -0
  135. data/sig/pg_eventstore/web/subscriptions/helpers.rbs +48 -0
  136. data/sig/pg_eventstore/web/subscriptions/set_collection.rbs +18 -0
  137. data/sig/pg_eventstore/web/subscriptions/subscriptions.rbs +18 -0
  138. data/sig/pg_eventstore/web/subscriptions/subscriptions_set.rbs +18 -0
  139. data/sig/pg_eventstore/web/subscriptions/subscriptions_to_set_association.rbs +18 -0
  140. data/sig/pg_eventstore.rbs +42 -0
  141. metadata +90 -3
@@ -0,0 +1,56 @@
1
+ module PgEventstore
2
+ class SubscriptionCommandQueries
3
+ # _@param_ `connection`
4
+ def initialize: (PgEventstore::Connection connection) -> void
5
+
6
+ # _@param_ `subscription_id`
7
+ #
8
+ # _@param_ `subscriptions_set_id`
9
+ #
10
+ # _@param_ `command_name`
11
+ #
12
+ # _@param_ `data`
13
+ def find_or_create_by: (
14
+ subscription_id: Integer,
15
+ subscriptions_set_id: Integer,
16
+ command_name: String,
17
+ data: ::Hash[untyped, untyped]
18
+ ) -> PgEventstore::SubscriptionRunnerCommands::Base
19
+
20
+ # _@param_ `subscription_id`
21
+ #
22
+ # _@param_ `subscriptions_set_id`
23
+ #
24
+ # _@param_ `command_name`
25
+ def find_by: (subscription_id: Integer, subscriptions_set_id: Integer, command_name: String) -> PgEventstore::SubscriptionRunnerCommands::Base?
26
+
27
+ # _@param_ `subscription_id`
28
+ #
29
+ # _@param_ `subscriptions_set_id`
30
+ #
31
+ # _@param_ `command_name`
32
+ #
33
+ # _@param_ `data`
34
+ def create: (
35
+ subscription_id: Integer,
36
+ subscriptions_set_id: Integer,
37
+ command_name: String,
38
+ data: ::Hash[untyped, untyped]
39
+ ) -> PgEventstore::SubscriptionRunnerCommands::Base
40
+
41
+ # _@param_ `subscription_ids`
42
+ #
43
+ # _@param_ `subscriptions_set_id`
44
+ def find_commands: (::Array[Integer] subscription_ids, subscriptions_set_id: Integer) -> ::Array[PgEventstore::SubscriptionRunnerCommands::Base]
45
+
46
+ # _@param_ `id`
47
+ def delete: (Integer id) -> void
48
+
49
+ def transaction_queries: () -> PgEventstore::TransactionQueries
50
+
51
+ # _@param_ `hash`
52
+ def deserialize: (::Hash[untyped, untyped] hash) -> PgEventstore::SubscriptionRunnerCommands::Base
53
+
54
+ attr_accessor connection: PgEventstore::Connection
55
+ end
56
+ end
@@ -0,0 +1,73 @@
1
+ module PgEventstore
2
+ class SubscriptionQueries
3
+ # _@param_ `connection`
4
+ def initialize: (PgEventstore::Connection connection) -> void
5
+
6
+ # _@param_ `attrs`
7
+ def find_or_create_by: (::Hash[untyped, untyped] attrs) -> ::Hash[untyped, untyped]
8
+
9
+ # _@param_ `attrs`
10
+ def find_by: (::Hash[untyped, untyped] attrs) -> ::Hash[untyped, untyped]?
11
+
12
+ # _@param_ `attrs`
13
+ def find_all: (::Hash[untyped, untyped] attrs) -> ::Array[::Hash[untyped, untyped]]
14
+
15
+ def set_collection: () -> ::Array[String]
16
+
17
+ # _@param_ `id`
18
+ def find!: (Integer id) -> ::Hash[untyped, untyped]
19
+
20
+ # _@param_ `attrs`
21
+ def create: (::Hash[untyped, untyped] attrs) -> ::Hash[untyped, untyped]
22
+
23
+ # _@param_ `id`
24
+ #
25
+ # _@param_ `attrs`
26
+ #
27
+ # _@param_ `locked_by`
28
+ def update: (Integer id, attrs: ::Hash[untyped, untyped], locked_by: Integer?) -> ::Hash[untyped, untyped]
29
+
30
+ # _@param_ `subscriptions_set_id` — SubscriptionsSet#id
31
+ #
32
+ # _@param_ `subscriptions_ids` — Array of Subscription#id
33
+ def ping_all: (Integer subscriptions_set_id, ::Array[Integer] subscriptions_ids) -> ::Hash[Integer, Time]
34
+
35
+ # _@param_ `query_options` — runner_id/query options association
36
+ #
37
+ # _@return_ — runner_id/events association
38
+ def subscriptions_events: (::Hash[Integer, ::Hash[untyped, untyped]] query_options) -> ::Hash[Integer, Array[::Hash[untyped, untyped]]]
39
+
40
+ # _@param_ `id` — subscription's id
41
+ #
42
+ # _@param_ `lock_id` — id of the subscriptions set which reserves the subscription
43
+ #
44
+ # _@param_ `force` — whether to lock the subscription despite on #locked_by value
45
+ #
46
+ # _@return_ — lock id
47
+ def lock!: (Integer id, Integer lock_id, ?force: bool) -> Integer
48
+
49
+ # _@param_ `id`
50
+ def delete: (Integer id) -> void
51
+
52
+ # _@param_ `id` — runner id
53
+ #
54
+ # _@param_ `options` — query options
55
+ def query_builder: (Integer id, ::Hash[untyped, untyped] options) -> PgEventstore::SQLBuilder
56
+
57
+ # _@param_ `builders`
58
+ def union_builders: (::Array[PgEventstore::SQLBuilder] builders) -> PgEventstore::SQLBuilder
59
+
60
+ def transaction_queries: () -> PgEventstore::TransactionQueries
61
+
62
+ def links_resolver: () -> PgEventstore::LinksResolver
63
+
64
+ # _@param_ `hash`
65
+ def deserialize: (::Hash[untyped, untyped] hash) -> ::Hash[untyped, untyped]
66
+
67
+ # _@param_ `attrs`
68
+ def find_by_attrs_builder: (::Hash[untyped, untyped] attrs) -> PgEventstore::SQLBuilder
69
+
70
+ # Returns the value of attribute connection.
71
+ attr_accessor connection: PgEventstore::Connection
72
+ end
73
+ end
@@ -0,0 +1,39 @@
1
+ module PgEventstore
2
+ class SubscriptionsSetCommandQueries
3
+ # _@param_ `connection`
4
+ def initialize: (PgEventstore::Connection connection) -> void
5
+
6
+ # _@param_ `subscriptions_set_id`
7
+ #
8
+ # _@param_ `command_name`
9
+ #
10
+ # _@param_ `data`
11
+ def find_or_create_by: (subscriptions_set_id: Integer, command_name: String, data: ::Hash[untyped, untyped]) -> PgEventstore::SubscriptionFeederCommands::Base
12
+
13
+ # _@param_ `subscriptions_set_id`
14
+ #
15
+ # _@param_ `command_name`
16
+ def find_by: (subscriptions_set_id: Integer, command_name: String) -> PgEventstore::SubscriptionFeederCommands::Base?
17
+
18
+ # _@param_ `subscriptions_set_id`
19
+ #
20
+ # _@param_ `command_name`
21
+ #
22
+ # _@param_ `data`
23
+ def create: (subscriptions_set_id: Integer, command_name: String, data: ::Hash[untyped, untyped]) -> PgEventstore::SubscriptionFeederCommands::Base
24
+
25
+ # _@param_ `subscriptions_set_id`
26
+ def find_commands: (Integer subscriptions_set_id) -> ::Array[PgEventstore::SubscriptionFeederCommands::Base]
27
+
28
+ # _@param_ `id`
29
+ def delete: (Integer id) -> void
30
+
31
+ # _@param_ `hash`
32
+ def deserialize: (::Hash[untyped, untyped] hash) -> PgEventstore::SubscriptionFeederCommands::Base
33
+
34
+ def transaction_queries: () -> PgEventstore::TransactionQueries
35
+
36
+ # Returns the value of attribute connection.
37
+ attr_accessor connection: PgEventstore::Connection
38
+ end
39
+ end
@@ -0,0 +1,36 @@
1
+ module PgEventstore
2
+ class SubscriptionsSetQueries
3
+ # _@param_ `connection`
4
+ def initialize: (PgEventstore::Connection connection) -> void
5
+
6
+ # _@param_ `attrs`
7
+ def find_all: (::Hash[untyped, untyped] attrs) -> ::Array[::Hash[untyped, untyped]]
8
+
9
+ def set_names: () -> ::Array[String]
10
+
11
+ # The same as #find_all, but returns first result
12
+ def find_by: (::Hash[untyped, untyped] attrs) -> ::Hash[untyped, untyped]?
13
+
14
+ # _@param_ `id`
15
+ def find!: (Integer id) -> ::Hash[untyped, untyped]
16
+
17
+ # _@param_ `attrs`
18
+ def create: (::Hash[untyped, untyped] attrs) -> ::Hash[untyped, untyped]
19
+
20
+ # _@param_ `id`
21
+ #
22
+ # _@param_ `attrs`
23
+ def update: (Integer id, ::Hash[untyped, untyped] attrs) -> ::Hash[untyped, untyped]
24
+
25
+ # _@param_ `id`
26
+ def delete: (Integer id) -> void
27
+
28
+ # _@param_ `hash`
29
+ def deserialize: (::Hash[untyped, untyped] hash) -> ::Hash[untyped, untyped]
30
+
31
+ def transaction_queries: () -> PgEventstore::TransactionQueries
32
+
33
+ # Returns the value of attribute connection.
34
+ attr_accessor connection: PgEventstore::Connection
35
+ end
36
+ end
@@ -0,0 +1,16 @@
1
+ module PgEventstore
2
+ class RunnerState
3
+ include PgEventstore::Extensions::CallbacksExtension
4
+ STATES: ::Hash[Symbol, String]
5
+
6
+ %a{rbs:test:skip} def initialize: () -> void
7
+
8
+ # _@return_ — string representation of the state
9
+ def to_s: () -> String
10
+
11
+ # _@param_ `state`
12
+ def set_state: (String state) -> String
13
+
14
+ def define_callback: () -> void
15
+ end
16
+ end
@@ -0,0 +1,96 @@
1
+ module PgEventstore
2
+ class Subscription
3
+ include PgEventstore::Extensions::UsingConnectionExtension
4
+ include PgEventstore::Extensions::OptionsExtension
5
+
6
+ # _@param_ `subscriptions_set_id` — SubscriptionsSet#id
7
+ #
8
+ # _@param_ `subscriptions`
9
+ def self.ping_all: (Integer subscriptions_set_id, ::Array[PgEventstore::Subscription] subscriptions) -> void
10
+
11
+ def self.subscription_queries: () -> PgEventstore::SubscriptionQueries
12
+
13
+ # _@param_ `attrs`
14
+ def update: (::Hash[untyped, untyped] attrs) -> ::Hash[untyped, untyped]
15
+
16
+ # _@param_ `attrs`
17
+ def assign_attributes: (::Hash[untyped, untyped] attrs) -> ::Hash[untyped, untyped]
18
+
19
+ # _@param_ `lock_id`
20
+ #
21
+ # _@param_ `force`
22
+ def lock!: (Integer lock_id, ?force: bool) -> PgEventstore::Subscription
23
+
24
+ def dup: () -> PgEventstore::Subscription
25
+
26
+ def reload: () -> PgEventstore::Subscription
27
+
28
+ def hash: () -> Integer
29
+
30
+ # _@param_ `another`
31
+ def eql?: (untyped another) -> bool
32
+
33
+ # _@param_ `another`
34
+ def ==: (untyped another) -> bool
35
+
36
+ def reset_runtime_attributes: () -> void
37
+
38
+ def subscription_queries: () -> PgEventstore::SubscriptionQueries
39
+
40
+ def initialize: (**untyped options) -> void
41
+
42
+ def options_hash: () -> ::Hash[untyped, untyped]
43
+
44
+ # _@param_ `opt_name`
45
+ def readonly!: (Symbol opt_name) -> bool
46
+
47
+ # _@param_ `opt_name`
48
+ def readonly?: (Symbol opt_name) -> bool
49
+
50
+ # _@param_ `opt_name`
51
+ def readonly_error: (Symbol opt_name) -> void
52
+
53
+ # _@param_ `options`
54
+ def init_default_values: (::Hash[untyped, untyped] options) -> void
55
+
56
+ attr_accessor id: Integer?
57
+
58
+ attr_accessor set: String?
59
+
60
+ attr_accessor name: String?
61
+
62
+ attr_accessor total_processed_events: Integer?
63
+
64
+ attr_accessor options: ::Hash[untyped, untyped]?
65
+
66
+ attr_accessor current_position: Integer?
67
+
68
+ attr_accessor state: String?
69
+
70
+ attr_accessor average_event_processing_time: Float?
71
+
72
+ attr_accessor restart_count: Integer?
73
+
74
+ attr_accessor max_restarts_number: Integer?
75
+
76
+ attr_accessor time_between_restarts: Integer?
77
+
78
+ attr_accessor last_restarted_at: Time?
79
+
80
+ attr_accessor last_error: { 'class' => String, 'message' => String, 'backtrace' => Array[String] }?
81
+
82
+ attr_accessor last_error_occurred_at: Time?
83
+
84
+ attr_accessor chunk_query_interval: Integer? | Float?
85
+
86
+ attr_accessor last_chunk_fed_at: Time?
87
+
88
+ attr_accessor last_chunk_greatest_position: Integer?
89
+
90
+ attr_accessor locked_by: Integer?
91
+
92
+ attr_accessor created_at: Time?
93
+
94
+ attr_accessor updated_at: Time?
95
+ end
96
+ end
@@ -0,0 +1,64 @@
1
+ module PgEventstore
2
+ class SubscriptionFeeder
3
+ extend Forwardable
4
+ HEARTBEAT_INTERVAL: Integer
5
+
6
+ # _@param_ `config_name`
7
+ #
8
+ # _@param_ `set_name`
9
+ #
10
+ # _@param_ `max_retries` — max number of retries of failed SubscriptionsSet
11
+ #
12
+ # _@param_ `retries_interval` — a delay between retries of failed SubscriptionsSet
13
+ def initialize: (
14
+ config_name: Symbol,
15
+ set_name: String,
16
+ max_retries: Integer,
17
+ retries_interval: Integer
18
+ ) -> void
19
+
20
+ # _@param_ `runner`
21
+ def add: (PgEventstore::SubscriptionRunner runner) -> PgEventstore::SubscriptionRunner
22
+
23
+ def start_all: () -> void
24
+
25
+ def stop_all: () -> void
26
+
27
+ def force_lock!: () -> void
28
+
29
+ def read_only_subscriptions: () -> ::Array[PgEventstore::Subscription]
30
+
31
+ def read_only_subscriptions_set: () -> PgEventstore::SubscriptionsSet?
32
+
33
+ def lock_all: () -> void
34
+
35
+ def subscriptions_set: () -> PgEventstore::SubscriptionsSet
36
+
37
+ def feeder: () -> PgEventstore::SubscriptionRunnersFeeder
38
+
39
+ def attach_runner_callbacks: () -> void
40
+
41
+ def before_runner_started: () -> void
42
+
43
+ # _@param_ `error`
44
+ def after_runner_died: (StandardError error) -> void
45
+
46
+ # _@param_ `_error`
47
+ def restart_runner: (StandardError _error) -> void
48
+
49
+ def update_runner_restarts: () -> void
50
+
51
+ def process_async: () -> void
52
+
53
+ def ping_subscriptions_set: () -> void
54
+
55
+ def ping_subscriptions: () -> void
56
+
57
+ def after_runner_stopped: () -> void
58
+
59
+ # _@param_ `state`
60
+ def update_subscriptions_set_state: (String state) -> void
61
+
62
+ def assert_proper_state!: () -> void
63
+ end
64
+ end
@@ -0,0 +1,45 @@
1
+ module PgEventstore
2
+ module SubscriptionFeederCommands
3
+ class Base
4
+ include PgEventstore::Extensions::OptionsExtension
5
+ include PgEventstore::Extensions::BaseCommandExtension
6
+
7
+ # _@param_ `subscription_feeder`
8
+ def exec_cmd: (PgEventstore::SubscriptionFeeder subscription_feeder) -> void
9
+
10
+ def hash: () -> Integer
11
+
12
+ # _@param_ `another`
13
+ def eql?: (Object another) -> bool
14
+
15
+ # _@param_ `another`
16
+ def ==: (Object another) -> bool
17
+
18
+ def initialize: (**untyped options) -> void
19
+
20
+ def options_hash: () -> ::Hash[untyped, untyped]
21
+
22
+ # _@param_ `opt_name`
23
+ def readonly!: (Symbol opt_name) -> bool
24
+
25
+ # _@param_ `opt_name`
26
+ def readonly?: (Symbol opt_name) -> bool
27
+
28
+ # _@param_ `opt_name`
29
+ def readonly_error: (Symbol opt_name) -> void
30
+
31
+ # _@param_ `options`
32
+ def init_default_values: (::Hash[untyped, untyped] options) -> void
33
+
34
+ attr_accessor id: Integer?
35
+
36
+ attr_accessor name: String
37
+
38
+ attr_accessor subscriptions_set_id: Integer?
39
+
40
+ attr_accessor data: ::Hash[untyped, untyped]
41
+
42
+ attr_accessor created_at: Time?
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,8 @@
1
+ module PgEventstore
2
+ module SubscriptionFeederCommands
3
+ class Restore < PgEventstore::SubscriptionFeederCommands::Base
4
+ # _@param_ `subscription_feeder`
5
+ def exec_cmd: (PgEventstore::SubscriptionFeeder subscription_feeder) -> void
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module PgEventstore
2
+ module SubscriptionFeederCommands
3
+ class StartAll < PgEventstore::SubscriptionFeederCommands::Base
4
+ # _@param_ `subscription_feeder`
5
+ def exec_cmd: (PgEventstore::SubscriptionFeeder subscription_feeder) -> void
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module PgEventstore
2
+ module SubscriptionFeederCommands
3
+ class Stop < PgEventstore::SubscriptionFeederCommands::Base
4
+ # _@param_ `subscription_feeder`
5
+ def exec_cmd: (PgEventstore::SubscriptionFeeder subscription_feeder) -> void
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module PgEventstore
2
+ module SubscriptionFeederCommands
3
+ class StopAll < PgEventstore::SubscriptionFeederCommands::Base
4
+ # _@param_ `subscription_feeder`
5
+ def exec_cmd: (PgEventstore::SubscriptionFeeder subscription_feeder) -> void
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module PgEventstore
2
+ module SubscriptionFeederCommands
3
+ extend PgEventstore::Extensions::CommandClassLookupExtension
4
+
5
+ # _@param_ `cmd_name`
6
+ def self.command_class: ((String | Symbol) cmd_name) -> Class
7
+ end
8
+ end
@@ -0,0 +1,12 @@
1
+ module PgEventstore
2
+ class SubscriptionHandlerPerformance
3
+ extend Forwardable
4
+ TIMINGS_TO_KEEP: Integer
5
+
6
+ def initialize: () -> void
7
+
8
+ def track_exec_time: () { () -> untyped } -> untyped
9
+
10
+ def average_event_processing_time: () -> Float
11
+ end
12
+ end
@@ -0,0 +1,55 @@
1
+ module PgEventstore
2
+ class SubscriptionRunner
3
+ extend Forwardable
4
+ MAX_EVENTS_PER_CHUNK: Integer
5
+ MIN_EVENTS_PER_CHUNK: Integer
6
+ INITIAL_EVENTS_PER_CHUNK: Integer
7
+
8
+ # _@param_ `stats`
9
+ #
10
+ # _@param_ `events_processor`
11
+ #
12
+ # _@param_ `subscription`
13
+ #
14
+ # _@param_ `restart_terminator`
15
+ def initialize: (
16
+ stats: PgEventstore::SubscriptionHandlerPerformance,
17
+ events_processor: PgEventstore::EventsProcessor,
18
+ subscription: PgEventstore::Subscription,
19
+ ?restart_terminator: _RestartTerminator?
20
+ ) -> void
21
+
22
+ def next_chunk_query_opts: () -> ::Hash[untyped, untyped]
23
+
24
+ def time_to_feed?: () -> bool
25
+
26
+ def next_chunk_global_position: () -> Integer
27
+
28
+ def estimate_events_number: () -> Integer
29
+
30
+ def attach_callbacks: () -> void
31
+
32
+ # _@param_ `action`
33
+ def track_exec_time: (Proc action, *untyped args) -> void
34
+
35
+ # _@param_ `current_position`
36
+ def update_subscription_stats: (Integer current_position) -> void
37
+
38
+ # _@param_ `state`
39
+ def update_subscription_state: (String state) -> void
40
+
41
+ def update_subscription_restarts: () -> void
42
+
43
+ # _@param_ `error`
44
+ def update_subscription_error: (StandardError error) -> void
45
+
46
+ # _@param_ `global_position`
47
+ def update_subscription_chunk_stats: (Integer global_position) -> void
48
+
49
+ # _@param_ `_error`
50
+ def restart_subscription: (StandardError _error) -> void
51
+
52
+ # Returns the value of attribute subscription.
53
+ attr_accessor subscription: PgEventstore::Subscription
54
+ end
55
+ end
@@ -0,0 +1,47 @@
1
+ module PgEventstore
2
+ module SubscriptionRunnerCommands
3
+ class Base
4
+ include PgEventstore::Extensions::OptionsExtension
5
+ include PgEventstore::Extensions::BaseCommandExtension
6
+
7
+ # _@param_ `subscription_runner`
8
+ def exec_cmd: (PgEventstore::SubscriptionRunner subscription_runner) -> void
9
+
10
+ def hash: () -> Integer
11
+
12
+ # _@param_ `another`
13
+ def eql?: (Object another) -> bool
14
+
15
+ # _@param_ `another`
16
+ def ==: (Object another) -> bool
17
+
18
+ def initialize: (**untyped options) -> void
19
+
20
+ def options_hash: () -> ::Hash[untyped, untyped]
21
+
22
+ # _@param_ `opt_name`
23
+ def readonly!: (Symbol opt_name) -> bool
24
+
25
+ # _@param_ `opt_name`
26
+ def readonly?: (Symbol opt_name) -> bool
27
+
28
+ # _@param_ `opt_name`
29
+ def readonly_error: (Symbol opt_name) -> void
30
+
31
+ # _@param_ `options`
32
+ def init_default_values: (::Hash[untyped, untyped] options) -> void
33
+
34
+ attr_accessor id: Integer?
35
+
36
+ attr_accessor name: String
37
+
38
+ attr_accessor subscription_id: Integer?
39
+
40
+ attr_accessor subscriptions_set_id: Integer?
41
+
42
+ attr_accessor data: ::Hash[untyped, untyped]
43
+
44
+ attr_accessor created_at: Time?
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,11 @@
1
+ module PgEventstore
2
+ module SubscriptionRunnerCommands
3
+ class ResetPosition < PgEventstore::SubscriptionRunnerCommands::Base
4
+ # _@param_ `data`
5
+ def self.parse_data: (::Hash[untyped, untyped] data) -> ::Hash[untyped, untyped]
6
+
7
+ # _@param_ `subscription_runner`
8
+ def exec_cmd: (PgEventstore::SubscriptionRunner subscription_runner) -> void
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,8 @@
1
+ module PgEventstore
2
+ module SubscriptionRunnerCommands
3
+ class Restore < PgEventstore::SubscriptionRunnerCommands::Base
4
+ # _@param_ `subscription_runner`
5
+ def exec_cmd: (PgEventstore::SubscriptionRunner subscription_runner) -> void
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module PgEventstore
2
+ module SubscriptionRunnerCommands
3
+ class Start < PgEventstore::SubscriptionRunnerCommands::Base
4
+ # _@param_ `subscription_runner`
5
+ def exec_cmd: (PgEventstore::SubscriptionRunner subscription_runner) -> void
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module PgEventstore
2
+ module SubscriptionRunnerCommands
3
+ class Stop < PgEventstore::SubscriptionRunnerCommands::Base
4
+ # _@param_ `subscription_runner`
5
+ def exec_cmd: (PgEventstore::SubscriptionRunner subscription_runner) -> void
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ module PgEventstore
2
+ module SubscriptionRunnerCommands
3
+ extend PgEventstore::Extensions::CommandClassLookupExtension
4
+
5
+ # _@param_ `cmd_name`
6
+ def self.command_class: ((String | Symbol) cmd_name) -> Class
7
+ end
8
+ end
@@ -0,0 +1,13 @@
1
+ module PgEventstore
2
+ class SubscriptionRunnersFeeder
3
+ # _@param_ `config_name`
4
+ def initialize: (Symbol config_name) -> void
5
+
6
+ # _@param_ `runners`
7
+ def feed: (::Array[PgEventstore::SubscriptionRunner] runners) -> void
8
+
9
+ def connection: () -> PgEventstore::Connection
10
+
11
+ def subscription_queries: () -> PgEventstore::SubscriptionQueries
12
+ end
13
+ end