pg_eventstore 1.1.2 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (143) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +6 -0
  3. data/README.md +7 -29
  4. data/docs/admin_ui.md +35 -0
  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 +4 -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 +6 -4
  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 +12 -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/web/views/layouts/application.erb +12 -12
  54. data/lib/pg_eventstore.rb +6 -1
  55. data/pg_eventstore.gemspec +1 -1
  56. data/rbs_collection.lock.yaml +16 -0
  57. data/rbs_collection.yaml +23 -0
  58. data/sig/interfaces/callback.rbs +3 -0
  59. data/sig/interfaces/event_class_resolver.rbs +3 -0
  60. data/sig/interfaces/event_modifier.rbs +3 -0
  61. data/sig/interfaces/restart_terminator.rbs +3 -0
  62. data/sig/interfaces/subscription_handler.rbs +3 -0
  63. data/sig/pg/basic_type_registry.rbs +21 -0
  64. data/sig/pg/connection.rbs +407 -0
  65. data/sig/pg/constants.rbs +153 -0
  66. data/sig/pg_eventstore/abstract_command.rbs +11 -0
  67. data/sig/pg_eventstore/callbacks.rbs +21 -0
  68. data/sig/pg_eventstore/client.rbs +67 -0
  69. data/sig/pg_eventstore/commands/append.rbs +33 -0
  70. data/sig/pg_eventstore/commands/event_modifiers/prepare_link_event.rbs +24 -0
  71. data/sig/pg_eventstore/commands/event_modifiers/prepare_regular_event.rbs +12 -0
  72. data/sig/pg_eventstore/commands/link_to.rbs +17 -0
  73. data/sig/pg_eventstore/commands/multiple.rbs +7 -0
  74. data/sig/pg_eventstore/commands/read.rbs +10 -0
  75. data/sig/pg_eventstore/commands/regular_stream_read_paginated.rbs +32 -0
  76. data/sig/pg_eventstore/commands/system_stream_read_paginated.rbs +30 -0
  77. data/sig/pg_eventstore/config.rbs +51 -0
  78. data/sig/pg_eventstore/connection.rbs +30 -0
  79. data/sig/pg_eventstore/errors.rbs +116 -0
  80. data/sig/pg_eventstore/event.rbs +46 -0
  81. data/sig/pg_eventstore/event_class_resolver.rbs +6 -0
  82. data/sig/pg_eventstore/event_deserializer.rbs +20 -0
  83. data/sig/pg_eventstore/event_serializer.rbs +13 -0
  84. data/sig/pg_eventstore/extensions/callbacks_extension.rbs +23 -0
  85. data/sig/pg_eventstore/extensions/options_extension.rbs +37 -0
  86. data/sig/pg_eventstore/extensions/using_connection_extension.rbs +14 -0
  87. data/sig/pg_eventstore/middleware.rbs +9 -0
  88. data/sig/pg_eventstore/pg_connection.rbs +13 -0
  89. data/sig/pg_eventstore/queries/event_queries.rbs +50 -0
  90. data/sig/pg_eventstore/queries/links_resolver.rbs +19 -0
  91. data/sig/pg_eventstore/queries/partition_queries.rbs +74 -0
  92. data/sig/pg_eventstore/queries/transaction_queries.rbs +21 -0
  93. data/sig/pg_eventstore/queries.rbs +23 -0
  94. data/sig/pg_eventstore/query_builders/events_filtering_query.rbs +62 -0
  95. data/sig/pg_eventstore/sql_builder.rbs +74 -0
  96. data/sig/pg_eventstore/stream.rbs +40 -0
  97. data/sig/pg_eventstore/subscriptions/basic_runner.rbs +37 -0
  98. data/sig/pg_eventstore/subscriptions/command_handlers/subscription_feeder_commands.rbs +16 -0
  99. data/sig/pg_eventstore/subscriptions/command_handlers/subscription_runners_commands.rbs +18 -0
  100. data/sig/pg_eventstore/subscriptions/commands_handler.rbs +25 -0
  101. data/sig/pg_eventstore/subscriptions/events_processor.rbs +34 -0
  102. data/sig/pg_eventstore/subscriptions/extensions/base_command_extension.rbs +20 -0
  103. data/sig/pg_eventstore/subscriptions/extensions/command_class_lookup_extension.rbs +8 -0
  104. data/sig/pg_eventstore/subscriptions/queries/subscription_command_queries.rbs +56 -0
  105. data/sig/pg_eventstore/subscriptions/queries/subscription_queries.rbs +73 -0
  106. data/sig/pg_eventstore/subscriptions/queries/subscriptions_set_command_queries.rbs +39 -0
  107. data/sig/pg_eventstore/subscriptions/queries/subscriptions_set_queries.rbs +36 -0
  108. data/sig/pg_eventstore/subscriptions/runner_state.rbs +16 -0
  109. data/sig/pg_eventstore/subscriptions/subscription.rbs +96 -0
  110. data/sig/pg_eventstore/subscriptions/subscription_feeder.rbs +64 -0
  111. data/sig/pg_eventstore/subscriptions/subscription_feeder_commands/base.rbs +45 -0
  112. data/sig/pg_eventstore/subscriptions/subscription_feeder_commands/restore.rbs +8 -0
  113. data/sig/pg_eventstore/subscriptions/subscription_feeder_commands/start_all.rbs +8 -0
  114. data/sig/pg_eventstore/subscriptions/subscription_feeder_commands/stop.rbs +8 -0
  115. data/sig/pg_eventstore/subscriptions/subscription_feeder_commands/stop_all.rbs +8 -0
  116. data/sig/pg_eventstore/subscriptions/subscription_feeder_commands.rbs +8 -0
  117. data/sig/pg_eventstore/subscriptions/subscription_handler_performance.rbs +12 -0
  118. data/sig/pg_eventstore/subscriptions/subscription_runner.rbs +55 -0
  119. data/sig/pg_eventstore/subscriptions/subscription_runner_commands/base.rbs +47 -0
  120. data/sig/pg_eventstore/subscriptions/subscription_runner_commands/reset_position.rbs +11 -0
  121. data/sig/pg_eventstore/subscriptions/subscription_runner_commands/restore.rbs +8 -0
  122. data/sig/pg_eventstore/subscriptions/subscription_runner_commands/start.rbs +8 -0
  123. data/sig/pg_eventstore/subscriptions/subscription_runner_commands/stop.rbs +8 -0
  124. data/sig/pg_eventstore/subscriptions/subscription_runner_commands.rbs +8 -0
  125. data/sig/pg_eventstore/subscriptions/subscription_runners_feeder.rbs +13 -0
  126. data/sig/pg_eventstore/subscriptions/subscriptions_manager.rbs +60 -0
  127. data/sig/pg_eventstore/subscriptions/subscriptions_set.rbs +72 -0
  128. data/sig/pg_eventstore/utils.rbs +20 -0
  129. data/sig/pg_eventstore/version.rbs +3 -0
  130. data/sig/pg_eventstore/web/paginator/base_collection.rbs +51 -0
  131. data/sig/pg_eventstore/web/paginator/event_types_collection.rbs +15 -0
  132. data/sig/pg_eventstore/web/paginator/events_collection.rbs +31 -0
  133. data/sig/pg_eventstore/web/paginator/helpers.rbs +38 -0
  134. data/sig/pg_eventstore/web/paginator/stream_contexts_collection.rbs +15 -0
  135. data/sig/pg_eventstore/web/paginator/stream_ids_collection.rbs +15 -0
  136. data/sig/pg_eventstore/web/paginator/stream_names_collection.rbs +15 -0
  137. data/sig/pg_eventstore/web/subscriptions/helpers.rbs +48 -0
  138. data/sig/pg_eventstore/web/subscriptions/set_collection.rbs +18 -0
  139. data/sig/pg_eventstore/web/subscriptions/subscriptions.rbs +18 -0
  140. data/sig/pg_eventstore/web/subscriptions/subscriptions_set.rbs +18 -0
  141. data/sig/pg_eventstore/web/subscriptions/subscriptions_to_set_association.rbs +18 -0
  142. data/sig/pg_eventstore.rbs +42 -0
  143. metadata +91 -3
@@ -0,0 +1,23 @@
1
+ module PgEventstore
2
+ class Queries
3
+ include PgEventstore::Extensions::OptionsExtension
4
+
5
+ def initialize: (**untyped options) -> void
6
+
7
+ def options_hash: () -> ::Hash[untyped, untyped]
8
+
9
+ def readonly!: (Symbol opt_name) -> bool
10
+
11
+ def readonly?: (Symbol opt_name) -> bool
12
+
13
+ def readonly_error: (Symbol opt_name) -> void
14
+
15
+ def init_default_values: (::Hash[untyped, untyped] options) -> void
16
+
17
+ attr_accessor events: PgEventstore::EventQueries?
18
+
19
+ attr_accessor partitions: PgEventstore::PartitionQueries?
20
+
21
+ attr_accessor transactions: PgEventstore::TransactionQueries?
22
+ end
23
+ end
@@ -0,0 +1,62 @@
1
+ module PgEventstore
2
+ module QueryBuilders
3
+ # @!visibility private
4
+ class EventsFiltering
5
+ DEFAULT_LIMIT: Integer
6
+ SQL_DIRECTIONS: Hash[String | Symbol, String]
7
+ SUBSCRIPTIONS_OPTIONS: ::Array[Symbol]
8
+
9
+ # _@param_ `options`
10
+ def self.subscriptions_events_filtering: (::Hash[untyped, untyped] options) -> PgEventstore::QueryBuilders::EventsFiltering
11
+
12
+ # _@param_ `options`
13
+ def self.all_stream_filtering: (::Hash[untyped, untyped] options) -> PgEventstore::QueryBuilders::EventsFiltering
14
+
15
+ # _@param_ `stream`
16
+ #
17
+ # _@param_ `options`
18
+ def self.specific_stream_filtering: (PgEventstore::Stream stream, ::Hash[untyped, untyped] options) -> PgEventstore::QueryBuilders::EventsFiltering
19
+
20
+ def initialize: () -> void
21
+
22
+ # _@param_ `context`
23
+ #
24
+ # _@param_ `stream_name`
25
+ #
26
+ # _@param_ `stream_id`
27
+ def add_stream_attrs: (?context: String?, ?stream_name: String?, ?stream_id: String?) -> void
28
+
29
+ # _@param_ `event_types`
30
+ def add_event_types: (::Array[String]? event_types) -> void
31
+
32
+ # _@param_ `revision`
33
+ #
34
+ # _@param_ `direction`
35
+ def add_revision: (Integer? revision, (String | Symbol)? direction) -> void
36
+
37
+ # _@param_ `position`
38
+ #
39
+ # _@param_ `direction`
40
+ def add_global_position: (Integer? position, (String | Symbol)? direction) -> void
41
+
42
+ # _@param_ `direction`
43
+ def add_stream_direction: ((String | Symbol)? direction) -> void
44
+
45
+ # _@param_ `direction`
46
+ def add_all_stream_direction: ((String | Symbol)? direction) -> void
47
+
48
+ # _@param_ `limit`
49
+ def add_limit: (Integer? limit) -> void
50
+
51
+ def to_sql_builder: () -> PgEventstore::SQLBuilder
52
+
53
+ def to_exec_params: () -> ::Array[untyped]
54
+
55
+ # _@param_ `stream_attrs`
56
+ def correct_stream_filter?: (::Hash[untyped, untyped] stream_attrs) -> bool
57
+
58
+ # _@param_ `direction`
59
+ def direction_operator: ((String | Symbol)? direction) -> String
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,74 @@
1
+ module PgEventstore
2
+ class SQLBuilder
3
+ def initialize: () -> void
4
+
5
+ # _@param_ `sql`
6
+ def select: (String sql) -> self
7
+
8
+ def unselect: () -> self
9
+
10
+ # _@param_ `sql`
11
+ #
12
+ # _@param_ `arguments` — positional values
13
+ def where: (String sql, *untyped arguments) -> self
14
+
15
+ # _@param_ `sql`
16
+ #
17
+ # _@param_ `arguments` — positional values
18
+ def where_or: (String sql, *Object arguments) -> self
19
+
20
+ # _@param_ `table_name`
21
+ def from: (String table_name) -> self
22
+
23
+ # _@param_ `sql`
24
+ #
25
+ # _@param_ `arguments`
26
+ def join: (String sql, *Object arguments) -> self
27
+
28
+ # _@param_ `sql`
29
+ def order: (String sql) -> self
30
+
31
+ def remove_order: () -> self
32
+
33
+ # _@param_ `limit`
34
+ def limit: (Integer limit) -> self
35
+
36
+ def remove_limit: () -> self
37
+
38
+ # _@param_ `offset`
39
+ def offset: (Integer offset) -> self
40
+
41
+ # _@param_ `another_builder`
42
+ def union: (PgEventstore::SQLBuilder another_builder) -> self
43
+
44
+ # _@param_ `sql`
45
+ def group: (String sql) -> self
46
+
47
+ def remove_group: () -> self
48
+
49
+ def to_exec_params: () -> ::Array[(String | ::Array[untyped])]
50
+
51
+ def positional_values: () -> ::Array[Object]
52
+
53
+ # _@param_ `val`
54
+ def positional_values_size=: (Integer val) -> Integer
55
+
56
+ def _to_exec_params: () -> ::Array[(String | ::Array[untyped])]
57
+
58
+ def single_query_sql: () -> String
59
+
60
+ def union_query_sql: () -> String
61
+
62
+ def select_sql: () -> String
63
+
64
+ # _@param_ `join_pattern` — "OR"/"AND"
65
+ def where_sql: (String join_pattern) -> String
66
+
67
+ def join_sql: () -> String
68
+
69
+ def order_sql: () -> String
70
+
71
+ # _@param_ `sql`
72
+ def extract_positional_args: (String sql, *untyped arguments) -> String
73
+ end
74
+ end
@@ -0,0 +1,40 @@
1
+ module PgEventstore
2
+ class Stream
3
+ SYSTEM_STREAM_PREFIX: String
4
+ NON_EXISTING_STREAM_REVISION: Integer
5
+
6
+ def self.all_stream: () -> PgEventstore::Stream
7
+
8
+ # _@param_ `context`
9
+ #
10
+ # _@param_ `stream_name`
11
+ #
12
+ # _@param_ `stream_id`
13
+ def initialize: (context: String, stream_name: String, stream_id: String) -> void
14
+
15
+ def all_stream?: () -> bool
16
+
17
+ def system?: () -> bool
18
+
19
+ def deconstruct: () -> ::Array[untyped]
20
+
21
+ # _@param_ `keys`
22
+ def deconstruct_keys: (::Array[Symbol]? keys) -> ::Hash[Symbol, String]
23
+
24
+ def to_hash: () -> ::Hash[untyped, untyped]
25
+
26
+ def hash: () -> Integer
27
+
28
+ # _@param_ `another`
29
+ def eql?: (untyped another) -> bool
30
+
31
+ # _@param_ `other_stream`
32
+ def ==: (untyped other_stream) -> bool
33
+
34
+ attr_accessor context: String
35
+
36
+ attr_accessor stream_name: String
37
+
38
+ attr_accessor stream_id: String
39
+ end
40
+ end
@@ -0,0 +1,37 @@
1
+ module PgEventstore
2
+ class BasicRunner
3
+ include PgEventstore::Extensions::CallbacksExtension
4
+ extend Forwardable
5
+
6
+ # _@param_ `run_interval` — seconds. Determines how often to run async task. Async task is determined by :after_runner_stopped callback
7
+ #
8
+ # _@param_ `async_shutdown_time` — seconds. Determines how long to wait for the async shutdown to wait for the runner to finish.
9
+ %a{rbs:test:skip} def initialize: ((Integer | Float) run_interval, (Integer | Float) async_shutdown_time) -> void
10
+
11
+ def start: () -> self
12
+
13
+ def stop: () -> self
14
+
15
+ def stop_async: () -> self
16
+
17
+ def restore: () -> self
18
+
19
+ def wait_for_finish: () -> self
20
+
21
+ def state: () -> String
22
+
23
+ # _@param_ `state`
24
+ def within_state: (Symbol state) { () -> untyped } -> untyped
25
+
26
+ def synchronize: () { () -> untyped } -> untyped
27
+
28
+ def _start: () -> void
29
+
30
+ def delegate_change_state_cbx: () -> void
31
+
32
+ # _@param_ `state`
33
+ def change_state: (String state) -> void
34
+
35
+ def define_callback: () -> void
36
+ end
37
+ end
@@ -0,0 +1,16 @@
1
+ module PgEventstore
2
+ module CommandHandlers
3
+ class SubscriptionFeederCommands
4
+ # _@param_ `config_name`
5
+ #
6
+ # _@param_ `subscription_feeder`
7
+ def initialize: (Symbol config_name, PgEventstore::SubscriptionFeeder subscription_feeder) -> void
8
+
9
+ def process: () -> void
10
+
11
+ def queries: () -> PgEventstore::SubscriptionsSetCommandQueries
12
+
13
+ def connection: () -> PgEventstore::Connection
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,18 @@
1
+ module PgEventstore
2
+ module CommandHandlers
3
+ class SubscriptionRunnersCommands
4
+ # _@param_ `config_name`
5
+ #
6
+ # _@param_ `runners`
7
+ #
8
+ # _@param_ `subscriptions_set_id`
9
+ def initialize: (Symbol config_name, ::Array[PgEventstore::SubscriptionRunner] runners, Integer subscriptions_set_id) -> void
10
+
11
+ def process: () -> void
12
+
13
+ def queries: () -> PgEventstore::SubscriptionCommandQueries
14
+
15
+ def connection: () -> PgEventstore::Connection
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,25 @@
1
+ module PgEventstore
2
+ class CommandsHandler
3
+ extend Forwardable
4
+ RESTART_DELAY: Integer
5
+ PULL_INTERVAL: Integer
6
+
7
+ # _@param_ `config_name`
8
+ #
9
+ # _@param_ `subscription_feeder`
10
+ #
11
+ # _@param_ `runners`
12
+ def initialize: (Symbol config_name, PgEventstore::SubscriptionFeeder subscription_feeder, ::Array[PgEventstore::SubscriptionRunner] runners) -> void
13
+
14
+ def attach_runner_callbacks: () -> untyped
15
+
16
+ def process_async: () -> untyped
17
+
18
+ # _@param_ `error`
19
+ def after_runner_died: (StandardError error) -> void
20
+
21
+ def subscription_feeder_commands: () -> PgEventstore::CommandHandlers::SubscriptionFeederCommands
22
+
23
+ def subscription_runners_commands: () -> PgEventstore::CommandHandlers::SubscriptionRunnersCommands
24
+ end
25
+ end
@@ -0,0 +1,34 @@
1
+ module PgEventstore
2
+ class EventsProcessor
3
+ include PgEventstore::Extensions::CallbacksExtension
4
+ extend Forwardable
5
+
6
+ # _@param_ `handler`
7
+ %a{rbs:test:skip} def initialize: (_SubscriptionHandler handler) -> void
8
+
9
+ # _@param_ `raw_events`
10
+ def feed: (::Array[::Hash[untyped, untyped]] raw_events) -> void
11
+
12
+ def events_left_in_chunk: () -> Integer
13
+
14
+ def clear_chunk: () -> void
15
+
16
+ # _@param_ `raw_event`
17
+ def process_event: (::Hash[untyped, untyped] raw_event) -> void
18
+
19
+ def attach_runner_callbacks: () -> void
20
+
21
+ def process_async: () -> void
22
+
23
+ def after_runner_died: (StandardError error) -> void
24
+
25
+ def before_runner_restored: () -> void
26
+
27
+ def change_state: (*untyped args, **untyped kwargs) -> void
28
+
29
+ # _@param_ `raw_event`
30
+ def global_position: (::Hash[untyped, untyped] raw_event) -> Integer
31
+
32
+ def define_callback: () -> void
33
+ end
34
+ end
@@ -0,0 +1,20 @@
1
+ module PgEventstore
2
+ module Extensions
3
+ module BaseCommandExtension
4
+ def self.included: (untyped klass) -> untyped
5
+
6
+ def hash: () -> Integer
7
+
8
+ # _@param_ `another`
9
+ def eql?: (Object another) -> bool
10
+
11
+ # _@param_ `another`
12
+ def ==: (Object another) -> bool
13
+
14
+ module ClassMethods
15
+ # _@param_ `data`
16
+ def parse_data: (::Hash[untyped, untyped] data) -> ::Hash[untyped, untyped]
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,8 @@
1
+ module PgEventstore
2
+ module Extensions
3
+ module CommandClassLookupExtension
4
+ # _@param_ `cmd_name`
5
+ def command_class: ((String | Symbol) cmd_name) -> Class
6
+ end
7
+ end
8
+ end
@@ -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