pg_eventstore 1.5.0 → 1.6.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 (76) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +3 -0
  3. data/README.md +4 -0
  4. data/docs/subscriptions.md +14 -56
  5. data/exe/pg-eventstore +16 -0
  6. data/lib/pg_eventstore/callbacks.rb +16 -0
  7. data/lib/pg_eventstore/cli/commands/base_command.rb +45 -0
  8. data/lib/pg_eventstore/cli/commands/callback_handlers/start_cmd_handlers.rb +38 -0
  9. data/lib/pg_eventstore/cli/commands/help_command.rb +22 -0
  10. data/lib/pg_eventstore/cli/commands/start_subscriptions_command.rb +96 -0
  11. data/lib/pg_eventstore/cli/commands/stop_subscriptions_command.rb +22 -0
  12. data/lib/pg_eventstore/cli/commands.rb +6 -0
  13. data/lib/pg_eventstore/cli/exit_codes.rb +12 -0
  14. data/lib/pg_eventstore/cli/parser_options/base_options.rb +46 -0
  15. data/lib/pg_eventstore/cli/parser_options/default_options.rb +10 -0
  16. data/lib/pg_eventstore/cli/parser_options/metadata.rb +34 -0
  17. data/lib/pg_eventstore/cli/parser_options/subscription_options.rb +31 -0
  18. data/lib/pg_eventstore/cli/parser_options.rb +6 -0
  19. data/lib/pg_eventstore/cli/parsers/base_parser.rb +33 -0
  20. data/lib/pg_eventstore/cli/parsers/default_parser.rb +24 -0
  21. data/lib/pg_eventstore/cli/parsers/subscription_parser.rb +24 -0
  22. data/lib/pg_eventstore/cli/parsers.rb +5 -0
  23. data/lib/pg_eventstore/cli/try_to_delete_subscriptions_set.rb +75 -0
  24. data/lib/pg_eventstore/cli/try_unlock_subscriptions_set.rb +16 -0
  25. data/lib/pg_eventstore/cli/wait_for_subscriptions_set_shutdown.rb +67 -0
  26. data/lib/pg_eventstore/cli.rb +42 -0
  27. data/lib/pg_eventstore/extensions/options_extension.rb +53 -8
  28. data/lib/pg_eventstore/rspec/has_option_matcher.rb +38 -13
  29. data/lib/pg_eventstore/subscriptions/command_handlers/subscription_feeder_commands.rb +13 -1
  30. data/lib/pg_eventstore/subscriptions/command_handlers/subscription_runners_commands.rb +1 -1
  31. data/lib/pg_eventstore/subscriptions/queries/subscription_command_queries.rb +1 -1
  32. data/lib/pg_eventstore/subscriptions/queries/subscriptions_set_command_queries.rb +3 -1
  33. data/lib/pg_eventstore/subscriptions/subscription_feeder.rb +10 -50
  34. data/lib/pg_eventstore/subscriptions/subscription_feeder_commands/ping.rb +22 -0
  35. data/lib/pg_eventstore/subscriptions/subscription_feeder_commands.rb +1 -0
  36. data/lib/pg_eventstore/subscriptions/subscriptions_lifecycle.rb +7 -2
  37. data/lib/pg_eventstore/subscriptions/subscriptions_manager.rb +44 -10
  38. data/lib/pg_eventstore/subscriptions/subscriptions_set_lifecycle.rb +1 -1
  39. data/lib/pg_eventstore/utils.rb +32 -0
  40. data/lib/pg_eventstore/version.rb +1 -1
  41. data/lib/pg_eventstore/web/views/home/partials/event_filter.erb +1 -1
  42. data/lib/pg_eventstore/web/views/home/partials/events.erb +5 -5
  43. data/lib/pg_eventstore/web/views/home/partials/stream_filter.erb +3 -3
  44. data/lib/pg_eventstore/web/views/layouts/application.erb +3 -3
  45. data/lib/pg_eventstore/web/views/subscriptions/index.erb +6 -6
  46. data/lib/pg_eventstore.rb +5 -2
  47. data/sig/pg_eventstore/callbacks.rbs +4 -0
  48. data/sig/pg_eventstore/cli/commands/base_command.rbs +13 -0
  49. data/sig/pg_eventstore/cli/commands/callback_handlers/start_cmd_handlers.rbs +14 -0
  50. data/sig/pg_eventstore/cli/commands/help_command.rbs +13 -0
  51. data/sig/pg_eventstore/cli/commands/start_subscriptions_command.rbs +28 -0
  52. data/sig/pg_eventstore/cli/commands/stop_subscriptions_command.rbs +11 -0
  53. data/sig/pg_eventstore/cli/exit_codes.rbs +8 -0
  54. data/sig/pg_eventstore/cli/parser_options/base_options.rbs +15 -0
  55. data/sig/pg_eventstore/cli/parser_options/default_options.rbs +8 -0
  56. data/sig/pg_eventstore/cli/parser_options/metadata.rbs +11 -0
  57. data/sig/pg_eventstore/cli/parser_options/subscription_options.rbs +9 -0
  58. data/sig/pg_eventstore/cli/parsers/base_parser.rbs +18 -0
  59. data/sig/pg_eventstore/cli/parsers/default_parser.rbs +9 -0
  60. data/sig/pg_eventstore/cli/parsers/subscription_parser.rbs +9 -0
  61. data/sig/pg_eventstore/cli/try_to_delete_subscriptions_set.rbs +24 -0
  62. data/sig/pg_eventstore/cli/try_unlock_subscriptions_set.rbs +7 -0
  63. data/sig/pg_eventstore/cli/wait_for_subscriptions_set_shutdown.rbs +26 -0
  64. data/sig/pg_eventstore/cli.rbs +10 -0
  65. data/sig/pg_eventstore/extensions/options_extension.rbs +18 -1
  66. data/sig/pg_eventstore/subscriptions/command_handlers/subscription_feeder_commands.rbs +8 -0
  67. data/sig/pg_eventstore/subscriptions/command_handlers/subscription_runners_commands.rbs +7 -1
  68. data/sig/pg_eventstore/subscriptions/queries/subscription_command_queries.rbs +1 -1
  69. data/sig/pg_eventstore/subscriptions/queries/subscriptions_set_command_queries.rbs +1 -1
  70. data/sig/pg_eventstore/subscriptions/subscription_feeder.rbs +10 -11
  71. data/sig/pg_eventstore/subscriptions/subscription_feeder_commands/ping.rbs +11 -0
  72. data/sig/pg_eventstore/subscriptions/subscriptions_lifecycle.rbs +1 -1
  73. data/sig/pg_eventstore/subscriptions/subscriptions_manager.rbs +13 -1
  74. data/sig/pg_eventstore/utils.rbs +2 -0
  75. data/sig/pg_eventstore.rbs +2 -8
  76. metadata +44 -3
@@ -1,12 +1,18 @@
1
1
  module PgEventstore
2
2
  module CommandHandlers
3
3
  class SubscriptionRunnersCommands
4
+ @config_name: Symbol
5
+
6
+ @runners: ::Array[PgEventstore::SubscriptionRunner]
7
+
8
+ @subscriptions_set_id: Integer?
9
+
4
10
  # _@param_ `config_name`
5
11
  #
6
12
  # _@param_ `runners`
7
13
  #
8
14
  # _@param_ `subscriptions_set_id`
9
- def initialize: (Symbol config_name, ::Array[PgEventstore::SubscriptionRunner] runners, Integer subscriptions_set_id) -> void
15
+ def initialize: (Symbol config_name, ::Array[PgEventstore::SubscriptionRunner] runners, Integer? subscriptions_set_id) -> void
10
16
 
11
17
  def process: () -> void
12
18
 
@@ -41,7 +41,7 @@ module PgEventstore
41
41
  # _@param_ `subscription_ids`
42
42
  #
43
43
  # _@param_ `subscriptions_set_id`
44
- def find_commands: (::Array[Integer] subscription_ids, subscriptions_set_id: Integer) -> ::Array[PgEventstore::SubscriptionRunnerCommands::Base]
44
+ def find_commands: (::Array[Integer] subscription_ids, subscriptions_set_id: Integer?) -> ::Array[PgEventstore::SubscriptionRunnerCommands::Base]
45
45
 
46
46
  # _@param_ `id`
47
47
  def delete: (Integer id) -> void
@@ -23,7 +23,7 @@ module PgEventstore
23
23
  def create: (subscriptions_set_id: Integer, command_name: String, data: ::Hash[untyped, untyped]) -> PgEventstore::SubscriptionFeederCommands::Base
24
24
 
25
25
  # _@param_ `subscriptions_set_id`
26
- def find_commands: (Integer subscriptions_set_id) -> ::Array[PgEventstore::SubscriptionFeederCommands::Base]
26
+ def find_commands: (Integer? subscriptions_set_id) -> ::Array[PgEventstore::SubscriptionFeederCommands::Base]
27
27
 
28
28
  # _@param_ `id`
29
29
  def delete: (Integer id) -> void
@@ -2,21 +2,20 @@ module PgEventstore
2
2
  class SubscriptionFeeder
3
3
  extend Forwardable
4
4
 
5
- # _@param_ `config_name`
6
- #
7
- # _@param_ `set_name`
8
- #
9
- # _@param_ `max_retries` — max number of retries of failed SubscriptionsSet
10
- #
11
- # _@param_ `retries_interval` — a delay between retries of failed SubscriptionsSet
5
+ @basic_runner: PgEventstore::BasicRunner
6
+ @commands_handler: PgEventstore::CommandsHandler
7
+ @subscriptions_lifecycle: PgEventstore::SubscriptionsLifecycle
8
+ @subscriptions_set_lifecycle: PgEventstore::SubscriptionsSetLifecycle
9
+
10
+ attr_reader config_name: Symbol
11
+
12
12
  def initialize: (
13
13
  config_name: Symbol,
14
- set_name: String,
15
- max_retries: Integer,
16
- retries_interval: Integer
14
+ subscriptions_set_lifecycle: PgEventstore::SubscriptionsSetLifecycle,
15
+ subscriptions_lifecycle: PgEventstore::SubscriptionsLifecycle
17
16
  ) -> void
18
17
 
19
- def id: () -> Integer
18
+ def id: () -> Integer?
20
19
 
21
20
  # _@param_ `runner`
22
21
  def add: (PgEventstore::SubscriptionRunner runner) -> PgEventstore::SubscriptionRunner
@@ -0,0 +1,11 @@
1
+ module PgEventstore
2
+ module SubscriptionFeederCommands
3
+ class Ping
4
+ def exec_cmd: (PgEventstore::SubscriptionFeeder subscription_feeder) -> void
5
+
6
+ private
7
+
8
+ def queries: -> PgEventstore::SubscriptionsSetQueries
9
+ end
10
+ end
11
+ end
@@ -12,7 +12,7 @@ module PgEventstore
12
12
 
13
13
  attr_reader runners: Array[PgEventstore::SubscriptionRunner]
14
14
 
15
- def initialize: (Symbol config_name, PgEventstore::SubscriptionsSetLifecycle subscriptions_set_lifecycle)-> void
15
+ def initialize: (Symbol config_name, PgEventstore::SubscriptionsSetLifecycle subscriptions_set_lifecycle, ?force_lock: bool)-> void
16
16
 
17
17
  def force_locked?: -> bool
18
18
 
@@ -2,6 +2,13 @@ module PgEventstore
2
2
  class SubscriptionsManager
3
3
  extend Forwardable
4
4
 
5
+ @set_name: String
6
+ @subscription_feeder: PgEventstore::SubscriptionFeeder
7
+ @subscriptions_lifecycle: PgEventstore::SubscriptionsLifecycle
8
+ @subscriptions_set_lifecycle: PgEventstore::SubscriptionsSetLifecycle
9
+
10
+ def self.callbacks: () -> PgEventstore::Callbacks
11
+
5
12
  # _@param_ `config`
6
13
  #
7
14
  # _@param_ `set_name`
@@ -13,9 +20,12 @@ module PgEventstore
13
20
  config: PgEventstore::Config,
14
21
  set_name: String,
15
22
  ?max_retries: Integer?,
16
- ?retries_interval: Integer?
23
+ ?retries_interval: Integer?,
24
+ ?force_lock: bool
17
25
  ) -> void
18
26
 
27
+ def config_name: () -> Symbol
28
+
19
29
  # _@param_ `subscription_name` — subscription's name
20
30
  #
21
31
  # _@param_ `handler` — subscription's handler
@@ -58,6 +68,8 @@ module PgEventstore
58
68
  # _@param_ `middlewares`
59
69
  def select_middlewares: (?::Array[Symbol]? middlewares) -> ::Array[PgEventstore::Middleware]
60
70
 
71
+ def start!: () -> PgEventstore::BasicRunner
72
+
61
73
  def start: () -> PgEventstore::BasicRunner?
62
74
 
63
75
  # Returns the value of attribute config.
@@ -6,6 +6,8 @@ module PgEventstore
6
6
  # _@param_ `object`
7
7
  def self.deep_dup: (untyped object) -> Object
8
8
 
9
+ def self.deprecation_warning: (String message) -> void
10
+
9
11
  # _@param_ `array`
10
12
  #
11
13
  # _@return_ — positional variables, based on array size. Example: "$1, $2, $3"
@@ -12,18 +12,12 @@ module PgEventstore
12
12
  # _@param_ `name`
13
13
  def self.connection: (?Symbol name) -> PgEventstore::Connection
14
14
 
15
- # _@param_ `config_name`
16
- #
17
- # _@param_ `subscription_set`
18
- #
19
- # _@param_ `max_retries` — max number of retries of failed SubscriptionsSet
20
- #
21
- # _@param_ `retries_interval` — a delay between retries of failed SubscriptionsSet
22
15
  def self.subscriptions_manager: (
23
16
  ?Symbol config_name,
24
17
  subscription_set: String,
25
18
  ?max_retries: Integer?,
26
- ?retries_interval: Integer?
19
+ ?retries_interval: Integer?,
20
+ ?force_lock: bool
27
21
  ) -> PgEventstore::SubscriptionsManager
28
22
 
29
23
  # _@param_ `name`
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pg_eventstore
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ivan Dzyzenko
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-10-18 00:00:00.000000000 Z
11
+ date: 2024-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pg
@@ -61,7 +61,8 @@ dependencies:
61
61
  description: EventStore implementation using PostgreSQL
62
62
  email:
63
63
  - ivan.dzyzenko@gmail.com
64
- executables: []
64
+ executables:
65
+ - pg-eventstore
65
66
  extensions: []
66
67
  extra_rdoc_files: []
67
68
  files:
@@ -86,9 +87,30 @@ files:
86
87
  - docs/reading_events.md
87
88
  - docs/subscriptions.md
88
89
  - docs/writing_middleware.md
90
+ - exe/pg-eventstore
89
91
  - lib/pg_eventstore.rb
90
92
  - lib/pg_eventstore/abstract_command.rb
91
93
  - lib/pg_eventstore/callbacks.rb
94
+ - lib/pg_eventstore/cli.rb
95
+ - lib/pg_eventstore/cli/commands.rb
96
+ - lib/pg_eventstore/cli/commands/base_command.rb
97
+ - lib/pg_eventstore/cli/commands/callback_handlers/start_cmd_handlers.rb
98
+ - lib/pg_eventstore/cli/commands/help_command.rb
99
+ - lib/pg_eventstore/cli/commands/start_subscriptions_command.rb
100
+ - lib/pg_eventstore/cli/commands/stop_subscriptions_command.rb
101
+ - lib/pg_eventstore/cli/exit_codes.rb
102
+ - lib/pg_eventstore/cli/parser_options.rb
103
+ - lib/pg_eventstore/cli/parser_options/base_options.rb
104
+ - lib/pg_eventstore/cli/parser_options/default_options.rb
105
+ - lib/pg_eventstore/cli/parser_options/metadata.rb
106
+ - lib/pg_eventstore/cli/parser_options/subscription_options.rb
107
+ - lib/pg_eventstore/cli/parsers.rb
108
+ - lib/pg_eventstore/cli/parsers/base_parser.rb
109
+ - lib/pg_eventstore/cli/parsers/default_parser.rb
110
+ - lib/pg_eventstore/cli/parsers/subscription_parser.rb
111
+ - lib/pg_eventstore/cli/try_to_delete_subscriptions_set.rb
112
+ - lib/pg_eventstore/cli/try_unlock_subscriptions_set.rb
113
+ - lib/pg_eventstore/cli/wait_for_subscriptions_set_shutdown.rb
92
114
  - lib/pg_eventstore/client.rb
93
115
  - lib/pg_eventstore/commands.rb
94
116
  - lib/pg_eventstore/commands/append.rb
@@ -142,6 +164,7 @@ files:
142
164
  - lib/pg_eventstore/subscriptions/subscription_feeder.rb
143
165
  - lib/pg_eventstore/subscriptions/subscription_feeder_commands.rb
144
166
  - lib/pg_eventstore/subscriptions/subscription_feeder_commands/base.rb
167
+ - lib/pg_eventstore/subscriptions/subscription_feeder_commands/ping.rb
145
168
  - lib/pg_eventstore/subscriptions/subscription_feeder_commands/restore.rb
146
169
  - lib/pg_eventstore/subscriptions/subscription_feeder_commands/start_all.rb
147
170
  - lib/pg_eventstore/subscriptions/subscription_feeder_commands/stop.rb
@@ -221,6 +244,23 @@ files:
221
244
  - sig/pg_eventstore.rbs
222
245
  - sig/pg_eventstore/abstract_command.rbs
223
246
  - sig/pg_eventstore/callbacks.rbs
247
+ - sig/pg_eventstore/cli.rbs
248
+ - sig/pg_eventstore/cli/commands/base_command.rbs
249
+ - sig/pg_eventstore/cli/commands/callback_handlers/start_cmd_handlers.rbs
250
+ - sig/pg_eventstore/cli/commands/help_command.rbs
251
+ - sig/pg_eventstore/cli/commands/start_subscriptions_command.rbs
252
+ - sig/pg_eventstore/cli/commands/stop_subscriptions_command.rbs
253
+ - sig/pg_eventstore/cli/exit_codes.rbs
254
+ - sig/pg_eventstore/cli/parser_options/base_options.rbs
255
+ - sig/pg_eventstore/cli/parser_options/default_options.rbs
256
+ - sig/pg_eventstore/cli/parser_options/metadata.rbs
257
+ - sig/pg_eventstore/cli/parser_options/subscription_options.rbs
258
+ - sig/pg_eventstore/cli/parsers/base_parser.rbs
259
+ - sig/pg_eventstore/cli/parsers/default_parser.rbs
260
+ - sig/pg_eventstore/cli/parsers/subscription_parser.rbs
261
+ - sig/pg_eventstore/cli/try_to_delete_subscriptions_set.rbs
262
+ - sig/pg_eventstore/cli/try_unlock_subscriptions_set.rbs
263
+ - sig/pg_eventstore/cli/wait_for_subscriptions_set_shutdown.rbs
224
264
  - sig/pg_eventstore/client.rbs
225
265
  - sig/pg_eventstore/commands/append.rbs
226
266
  - sig/pg_eventstore/commands/event_modifiers/prepare_link_event.rbs
@@ -271,6 +311,7 @@ files:
271
311
  - sig/pg_eventstore/subscriptions/subscription_feeder.rbs
272
312
  - sig/pg_eventstore/subscriptions/subscription_feeder_commands.rbs
273
313
  - sig/pg_eventstore/subscriptions/subscription_feeder_commands/base.rbs
314
+ - sig/pg_eventstore/subscriptions/subscription_feeder_commands/ping.rbs
274
315
  - sig/pg_eventstore/subscriptions/subscription_feeder_commands/restore.rbs
275
316
  - sig/pg_eventstore/subscriptions/subscription_feeder_commands/start_all.rbs
276
317
  - sig/pg_eventstore/subscriptions/subscription_feeder_commands/stop.rbs