pg_eventstore 1.5.0 → 1.7.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 (94) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/README.md +49 -0
  4. data/db/migrations/7_support_reading_streams_system_stream.sql +2 -0
  5. data/docs/reading_events.md +16 -1
  6. data/docs/subscriptions.md +14 -56
  7. data/exe/pg-eventstore +16 -0
  8. data/lib/pg_eventstore/callbacks.rb +16 -0
  9. data/lib/pg_eventstore/cli/commands/base_command.rb +45 -0
  10. data/lib/pg_eventstore/cli/commands/callback_handlers/start_cmd_handlers.rb +38 -0
  11. data/lib/pg_eventstore/cli/commands/help_command.rb +22 -0
  12. data/lib/pg_eventstore/cli/commands/start_subscriptions_command.rb +96 -0
  13. data/lib/pg_eventstore/cli/commands/stop_subscriptions_command.rb +22 -0
  14. data/lib/pg_eventstore/cli/commands.rb +6 -0
  15. data/lib/pg_eventstore/cli/exit_codes.rb +12 -0
  16. data/lib/pg_eventstore/cli/parser_options/base_options.rb +46 -0
  17. data/lib/pg_eventstore/cli/parser_options/default_options.rb +10 -0
  18. data/lib/pg_eventstore/cli/parser_options/metadata.rb +34 -0
  19. data/lib/pg_eventstore/cli/parser_options/subscription_options.rb +31 -0
  20. data/lib/pg_eventstore/cli/parser_options.rb +6 -0
  21. data/lib/pg_eventstore/cli/parsers/base_parser.rb +33 -0
  22. data/lib/pg_eventstore/cli/parsers/default_parser.rb +24 -0
  23. data/lib/pg_eventstore/cli/parsers/subscription_parser.rb +24 -0
  24. data/lib/pg_eventstore/cli/parsers.rb +5 -0
  25. data/lib/pg_eventstore/cli/try_to_delete_subscriptions_set.rb +75 -0
  26. data/lib/pg_eventstore/cli/try_unlock_subscriptions_set.rb +16 -0
  27. data/lib/pg_eventstore/cli/wait_for_subscriptions_set_shutdown.rb +67 -0
  28. data/lib/pg_eventstore/cli.rb +42 -0
  29. data/lib/pg_eventstore/commands/read.rb +1 -1
  30. data/lib/pg_eventstore/extensions/options_extension.rb +53 -8
  31. data/lib/pg_eventstore/queries/event_queries.rb +1 -10
  32. data/lib/pg_eventstore/query_builders/events_filtering.rb +27 -0
  33. data/lib/pg_eventstore/rspec/has_option_matcher.rb +42 -41
  34. data/lib/pg_eventstore/stream.rb +8 -0
  35. data/lib/pg_eventstore/subscriptions/command_handlers/subscription_feeder_commands.rb +13 -1
  36. data/lib/pg_eventstore/subscriptions/command_handlers/subscription_runners_commands.rb +1 -1
  37. data/lib/pg_eventstore/subscriptions/queries/subscription_command_queries.rb +1 -1
  38. data/lib/pg_eventstore/subscriptions/queries/subscriptions_set_command_queries.rb +3 -1
  39. data/lib/pg_eventstore/subscriptions/subscription_feeder.rb +10 -50
  40. data/lib/pg_eventstore/subscriptions/subscription_feeder_commands/ping.rb +22 -0
  41. data/lib/pg_eventstore/subscriptions/subscription_feeder_commands.rb +1 -0
  42. data/lib/pg_eventstore/subscriptions/subscriptions_lifecycle.rb +7 -2
  43. data/lib/pg_eventstore/subscriptions/subscriptions_manager.rb +44 -10
  44. data/lib/pg_eventstore/subscriptions/subscriptions_set_lifecycle.rb +1 -1
  45. data/lib/pg_eventstore/utils.rb +32 -0
  46. data/lib/pg_eventstore/version.rb +1 -1
  47. data/lib/pg_eventstore/web/application.rb +12 -2
  48. data/lib/pg_eventstore/web/paginator/events_collection.rb +18 -5
  49. data/lib/pg_eventstore/web/public/javascripts/pg_eventstore.js +24 -2
  50. data/lib/pg_eventstore/web/views/home/dashboard.erb +9 -0
  51. data/lib/pg_eventstore/web/views/home/partials/event_filter.erb +1 -1
  52. data/lib/pg_eventstore/web/views/home/partials/events.erb +9 -6
  53. data/lib/pg_eventstore/web/views/home/partials/stream_filter.erb +3 -3
  54. data/lib/pg_eventstore/web/views/home/partials/system_stream_filter.erb +15 -0
  55. data/lib/pg_eventstore/web/views/layouts/application.erb +3 -3
  56. data/lib/pg_eventstore/web/views/subscriptions/index.erb +6 -6
  57. data/lib/pg_eventstore.rb +5 -2
  58. data/sig/pg_eventstore/callbacks.rbs +4 -0
  59. data/sig/pg_eventstore/cli/commands/base_command.rbs +13 -0
  60. data/sig/pg_eventstore/cli/commands/callback_handlers/start_cmd_handlers.rbs +14 -0
  61. data/sig/pg_eventstore/cli/commands/help_command.rbs +13 -0
  62. data/sig/pg_eventstore/cli/commands/start_subscriptions_command.rbs +28 -0
  63. data/sig/pg_eventstore/cli/commands/stop_subscriptions_command.rbs +11 -0
  64. data/sig/pg_eventstore/cli/exit_codes.rbs +8 -0
  65. data/sig/pg_eventstore/cli/parser_options/base_options.rbs +15 -0
  66. data/sig/pg_eventstore/cli/parser_options/default_options.rbs +8 -0
  67. data/sig/pg_eventstore/cli/parser_options/metadata.rbs +11 -0
  68. data/sig/pg_eventstore/cli/parser_options/subscription_options.rbs +9 -0
  69. data/sig/pg_eventstore/cli/parsers/base_parser.rbs +18 -0
  70. data/sig/pg_eventstore/cli/parsers/default_parser.rbs +9 -0
  71. data/sig/pg_eventstore/cli/parsers/subscription_parser.rbs +9 -0
  72. data/sig/pg_eventstore/cli/try_to_delete_subscriptions_set.rbs +24 -0
  73. data/sig/pg_eventstore/cli/try_unlock_subscriptions_set.rbs +7 -0
  74. data/sig/pg_eventstore/cli/wait_for_subscriptions_set_shutdown.rbs +26 -0
  75. data/sig/pg_eventstore/cli.rbs +10 -0
  76. data/sig/pg_eventstore/extensions/options_extension.rbs +18 -1
  77. data/sig/pg_eventstore/queries/event_queries.rbs +0 -5
  78. data/sig/pg_eventstore/query_builders/events_filtering_query.rbs +6 -0
  79. data/sig/pg_eventstore/stream.rbs +3 -0
  80. data/sig/pg_eventstore/subscriptions/command_handlers/subscription_feeder_commands.rbs +8 -0
  81. data/sig/pg_eventstore/subscriptions/command_handlers/subscription_runners_commands.rbs +7 -1
  82. data/sig/pg_eventstore/subscriptions/queries/subscription_command_queries.rbs +1 -1
  83. data/sig/pg_eventstore/subscriptions/queries/subscriptions_set_command_queries.rbs +1 -1
  84. data/sig/pg_eventstore/subscriptions/subscription_feeder.rbs +10 -11
  85. data/sig/pg_eventstore/subscriptions/subscription_feeder_commands/ping.rbs +11 -0
  86. data/sig/pg_eventstore/subscriptions/subscriptions_lifecycle.rbs +1 -1
  87. data/sig/pg_eventstore/subscriptions/subscriptions_manager.rbs +13 -1
  88. data/sig/pg_eventstore/utils.rbs +2 -0
  89. data/sig/pg_eventstore/web/application.rbs +27 -0
  90. data/sig/pg_eventstore/web/paginator/base_collection.rbs +0 -9
  91. data/sig/pg_eventstore/web/paginator/event_types_collection.rbs +9 -0
  92. data/sig/pg_eventstore/web/paginator/events_collection.rbs +3 -1
  93. data/sig/pg_eventstore.rbs +2 -8
  94. metadata +47 -3
@@ -24,7 +24,7 @@
24
24
  <% @set_collection.names.each do |set_name| %>
25
25
  <li class="nav-item">
26
26
  <a class="nav-link <%= "active bg-dark text-white" if @current_set == set_name %>" href="<%= subscriptions_state ? subscriptions_state_url(state: subscriptions_state, set_name: set_name) : subscriptions_url(set_name: set_name) %>">
27
- <%= set_name %>
27
+ <%= h set_name %>
28
28
  </a>
29
29
  </li>
30
30
  <% end %>
@@ -86,7 +86,7 @@
86
86
  </a>
87
87
  <% end %>
88
88
  <% if PgEventstore::RunnerState::STATES.values_at(:running, :dead).include?(subscriptions_set.state) %>
89
- <a class="btn btn-warning" data-confirm="You are about to stop SubscriptionsSet#<%= subscriptions_set.id %>. This will also delete it and will result in stopping all related Subscriptions. Continue?" data-confirm-title="Stop SubscriptionsSet" data-method="post" href="<%= subscriptions_set_cmd_url(subscriptions_set.id, subscriptions_set_cmd('Stop')) %>" data-toggle="tooltip" title="This action will delete Subscriptions Set and release all related Subscriptions.">
89
+ <a class="btn btn-warning" data-confirm="You are about to stop SubscriptionsSet#<%= subscriptions_set.id %>. This will also delete it and will result in stopping all related Subscriptions. If you used pg_eventstore CLI to start subscriptions - the related process will also be stopped. Continue?" data-confirm-title="Stop SubscriptionsSet" data-method="post" href="<%= subscriptions_set_cmd_url(subscriptions_set.id, subscriptions_set_cmd('Stop')) %>" data-toggle="tooltip" title="This action will delete Subscriptions Set and release all related Subscriptions.">
90
90
  Stop
91
91
  </a>
92
92
  <% end %>
@@ -98,7 +98,7 @@
98
98
  <% if subscriptions_set.last_error %>
99
99
  <tr class="collapse" id="last-set-error-<%= subscriptions_set.id %>">
100
100
  <td colspan="9">
101
- <pre><%= JSON.pretty_generate(subscriptions_set.last_error) %></pre>
101
+ <pre><%= h JSON.pretty_generate(subscriptions_set.last_error) %></pre>
102
102
  </td>
103
103
  </tr>
104
104
  <% end %>
@@ -151,7 +151,7 @@
151
151
  <% subscriptions.each do |subscription| %>
152
152
  <tr>
153
153
  <td><%= subscription.id %></td>
154
- <td><%= subscription.name %></td>
154
+ <td><%= h subscription.name %></td>
155
155
  <td><%= subscription.total_processed_events %></td>
156
156
  <td>
157
157
  <a data-toggle="collapse" href="#options-<%= subscription.id %>" aria-controls="options-<%= subscription.id %>" role="button" aria-expanded="false" class="d-inline-block text-nowrap">
@@ -209,13 +209,13 @@
209
209
  </tr>
210
210
  <tr class="collapse" id="options-<%= subscription.id %>">
211
211
  <td colspan="16">
212
- <pre><%= JSON.pretty_generate(subscription.options) %></pre>
212
+ <pre><%= h JSON.pretty_generate(subscription.options) %></pre>
213
213
  </td>
214
214
  </tr>
215
215
  <% if subscription.last_error %>
216
216
  <tr class="collapse" id="last-error-<%= subscription.id %>">
217
217
  <td colspan="16">
218
- <pre><%= JSON.pretty_generate(subscription.last_error) %></pre>
218
+ <pre><%= h JSON.pretty_generate(subscription.last_error) %></pre>
219
219
  </td>
220
220
  </tr>
221
221
  <% end %>
data/lib/pg_eventstore.rb CHANGED
@@ -74,13 +74,16 @@ module PgEventstore
74
74
  # @param subscription_set [String]
75
75
  # @param max_retries [Integer, nil] max number of retries of failed SubscriptionsSet
76
76
  # @param retries_interval [Integer, nil] a delay between retries of failed SubscriptionsSet
77
+ # @param force_lock [Boolean] whether to force-lock subscriptions
77
78
  # @return [PgEventstore::SubscriptionsManager]
78
- def subscriptions_manager(config_name = :default, subscription_set:, max_retries: nil, retries_interval: nil)
79
+ def subscriptions_manager(config_name = :default, subscription_set:, max_retries: nil, retries_interval: nil,
80
+ force_lock: false)
79
81
  SubscriptionsManager.new(
80
82
  config: config(config_name),
81
83
  set_name: subscription_set,
82
84
  max_retries: max_retries,
83
- retries_interval: retries_interval
85
+ retries_interval: retries_interval,
86
+ force_lock: force_lock
84
87
  )
85
88
  end
86
89
 
@@ -2,6 +2,8 @@ module PgEventstore
2
2
  class Callbacks
3
3
  def initialize: () -> void
4
4
 
5
+ def clear: -> void
6
+
5
7
  # _@param_ `action` — an object, that represents your action. In most cases you want to use a symbol there
6
8
  #
7
9
  # _@param_ `filter` — callback filter. Supported values are :before, :after and :around
@@ -9,6 +11,8 @@ module PgEventstore
9
11
  # _@param_ `callback`
10
12
  def define_callback: (untyped action, Symbol filter, _Callback callback) -> void
11
13
 
14
+ def remove_callback: (untyped action, Symbol filter, _Callback callback) -> void
15
+
12
16
  # _@param_ `action` — an action to run
13
17
  def run_callbacks: (untyped action, *untyped args, **untyped kwargs) ?{ () -> untyped } -> untyped
14
18
 
@@ -0,0 +1,13 @@
1
+ module PgEventstore
2
+ module CLI
3
+ module Commands
4
+ class BaseCommand
5
+ attr_reader options: PgEventstore::CLI::ParserOptions::BaseOptions
6
+
7
+ %a{rbs:test:skip} def initialize: (PgEventstore::CLI::ParserOptions::BaseOptions options) -> untyped
8
+
9
+ def call: -> Integer
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,14 @@
1
+ module PgEventstore
2
+ module CLI
3
+ module Commands
4
+ module CallbackHandlers
5
+ class StartCmdHandlers
6
+ def self.handle_start_up: (Proc action, PgEventstore::SubscriptionsManager manager) -> void
7
+
8
+ def self.register_managers: (Set[PgEventstore::SubscriptionsManager] subscription_managers,
9
+ PgEventstore::SubscriptionsManager manager) -> void
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,13 @@
1
+ module PgEventstore
2
+ module CLI
3
+ module Commands
4
+ class HelpCommand
5
+ attr_reader options: PgEventstore::CLI::ParserOptions::BaseOptions
6
+
7
+ def initialize: (PgEventstore::CLI::ParserOptions::BaseOptions options) -> void
8
+
9
+ %a{rbs:test:skip} def call: -> Integer
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,28 @@
1
+ module PgEventstore
2
+ module CLI
3
+ module Commands
4
+ class StartSubscriptionsCommand
5
+ KEEP_ALIVE_INTERVAL: Integer
6
+
7
+ @running: bool
8
+ @subscription_managers: Set[PgEventstore::SubscriptionsManager]
9
+
10
+ def initialize: (PgEventstore::CLI::ParserOptions::BaseOptions options) -> void
11
+
12
+ %a{rbs:test:skip} def call: -> Integer
13
+
14
+ private
15
+
16
+ def attach_callbacks: -> void
17
+
18
+ def keep_process_alive: -> void
19
+
20
+ def persist_pid: -> void
21
+
22
+ def running_subscriptions?: -> bool
23
+
24
+ def setup_killsig: -> void
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,11 @@
1
+ module PgEventstore
2
+ module CLI
3
+ module Commands
4
+ class StopSubscriptionsCommand
5
+ %a{rbs:test:skip} def call: -> Integer
6
+
7
+ def initialize: (PgEventstore::CLI::ParserOptions::BaseOptions options) -> void
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,8 @@
1
+ module PgEventstore
2
+ module CLI
3
+ module ExitCodes
4
+ ERROR: Integer
5
+ SUCCESS: Integer
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,15 @@
1
+ module PgEventstore
2
+ module CLI
3
+ module ParserOptions
4
+ class BaseOptions
5
+ include PgEventstore::Extensions::OptionsExtension
6
+
7
+ def attach_parser_handlers: (OptionParser parser) -> void
8
+
9
+ def option: (Symbol option) -> PgEventstore::Extensions::OptionsExtension::Option
10
+
11
+ def to_parser_opts: (Symbol option) -> Array[String]
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,8 @@
1
+ module PgEventstore
2
+ module CLI
3
+ module ParserOptions
4
+ class DefaultOptions
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,11 @@
1
+ module PgEventstore
2
+ module CLI
3
+ module ParserOptions
4
+ class Metadata
5
+ include PgEventstore::Extensions::OptionsExtension
6
+
7
+ def to_parser_opts: -> Array[String]
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,9 @@
1
+ module PgEventstore
2
+ module CLI
3
+ module ParserOptions
4
+ class SubscriptionOptions
5
+ def attach_parser_handlers: (OptionParser parser) -> void
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,18 @@
1
+ module PgEventstore
2
+ module CLI
3
+ module Parsers
4
+ class BaseParser
5
+ @parser: OptionParser
6
+
7
+ def self.banner: -> String
8
+
9
+ attr_reader args: Array[String]
10
+ attr_reader options: PgEventstore::CLI::ParserOptions::BaseOptions
11
+
12
+ def initialize: (Array[String] args, PgEventstore::CLI::ParserOptions::BaseOptions options) -> void
13
+
14
+ def parse: -> [Array[String], PgEventstore::CLI::ParserOptions::BaseOptions]
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,9 @@
1
+ module PgEventstore
2
+ module CLI
3
+ module Parsers
4
+ class DefaultParser
5
+ def self.banner: -> String
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module PgEventstore
2
+ module CLI
3
+ module Parsers
4
+ class SubscriptionParser
5
+ def self.banner: -> String
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,24 @@
1
+ module PgEventstore
2
+ module CLI
3
+ class TryToDeleteSubscriptionsSet
4
+ def self.try_to_delete: (Symbol config_name, Integer subscriptions_set_id) -> bool
5
+
6
+ attr_reader config_name: Symbol
7
+ attr_reader subscriptions_set_id: Integer
8
+
9
+ def initialize: (Symbol config_name, Integer subscriptions_set_id) -> void
10
+
11
+ def try_to_delete: -> bool
12
+
13
+ private
14
+
15
+ def config: -> PgEventstore::Config
16
+
17
+ def connection: -> PgEventstore::Connection
18
+
19
+ def subscriptions_set_commands_queries: -> PgEventstore::SubscriptionsSetCommandQueries
20
+
21
+ def subscriptions_set_queries: -> PgEventstore::SubscriptionsSetQueries
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,7 @@
1
+ module PgEventstore
2
+ module CLI
3
+ class TryUnlockSubscriptionsSet
4
+ def self.try_unlock: (Symbol config_name, Integer subscriptions_set_id) -> bool
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,26 @@
1
+ module PgEventstore
2
+ module CLI
3
+ class WaitForSubscriptionsSetShutdown
4
+ SHUTDOWN_CHECK_INTERVAL: Float
5
+
6
+ def self.wait_for_shutdown: (Symbol config_name, Integer subscriptions_set_id) -> bool
7
+
8
+ attr_reader config_name: Symbol
9
+ attr_reader subscriptions_set_id: Integer
10
+
11
+ def initialize: (Symbol config_name, Integer subscriptions_set_id) -> void
12
+
13
+ def wait_for_shutdown: -> bool
14
+
15
+ private
16
+
17
+ def config: -> PgEventstore::Config
18
+
19
+ def connection: -> PgEventstore::Connection
20
+
21
+ def find_set!: -> PgEventstore::SubscriptionsSet
22
+
23
+ def subscriptions_set_queries: -> PgEventstore::SubscriptionsSetQueries
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,10 @@
1
+ module PgEventstore
2
+ module CLI
3
+ COMMANDS: Hash[Array[String], singleton(PgEventstore::CLI::Commands::BaseCommand)]
4
+ OPTIONS_PARSER: Hash[String, [singleton(PgEventstore::CLI::Parsers::BaseParser), singleton(PgEventstore::CLI::ParserOptions::BaseOptions)]]
5
+
6
+ def self.callbacks: -> PgEventstore::Callbacks
7
+
8
+ def self.execute: (Array[String] args) -> void
9
+ end
10
+ end
@@ -1,6 +1,23 @@
1
1
  module PgEventstore
2
2
  module Extensions
3
3
  module OptionsExtension
4
+ class Option
5
+ attr_reader name: Symbol
6
+ attr_reader metadata: untyped?
7
+
8
+ def initialize: (Symbol name, ?untyped? metadata) -> untyped
9
+
10
+ def ==: (untyped other_option) -> bool
11
+
12
+ def eql?: (untyped other_option) -> bool
13
+
14
+ def hash: () -> Integer
15
+ end
16
+
17
+ class Options
18
+ def []: (Symbol option) -> PgEventstore::Extensions::OptionsExtension::Option?
19
+ end
20
+
4
21
  def self.included: (untyped klass) -> untyped
5
22
 
6
23
  def initialize: (**untyped options) -> void
@@ -25,7 +42,7 @@ module PgEventstore
25
42
  # _@param_ `opt_name` — option name
26
43
  #
27
44
  # _@param_ `blk` — provide define value using block. It will be later evaluated in the context of your object to determine the default value of the option
28
- def option: (Symbol opt_name) ?{ () -> untyped } -> Symbol
45
+ def option: (Symbol opt_name, ?metadata: untyped?) ?{ () -> untyped } -> Symbol
29
46
 
30
47
  def inherited: (untyped klass) -> untyped
31
48
 
@@ -31,11 +31,6 @@ module PgEventstore
31
31
  # _@param_ `events`
32
32
  def prepared_statements: (PgEventstore::Stream stream, ::Array[PgEventstore::Event] events) -> ::Array[(::Array[String] | ::Array[Object])]
33
33
 
34
- # _@param_ `stream`
35
- #
36
- # _@param_ `options`
37
- def events_filtering: (PgEventstore::Stream stream, ::Hash[untyped, untyped] options) -> PgEventstore::QueryBuilders::EventsFiltering
38
-
39
34
  def links_resolver: () -> PgEventstore::LinksResolver
40
35
 
41
36
  # Returns the value of attribute connection.
@@ -6,6 +6,10 @@ module PgEventstore
6
6
  SQL_DIRECTIONS: Hash[String | Symbol, String]
7
7
  SUBSCRIPTIONS_OPTIONS: ::Array[Symbol]
8
8
 
9
+ @sql_builder: PgEventstore::SQLBuilder
10
+
11
+ def self.events_filtering: (PgEventstore::Stream stream, ::Hash[untyped, untyped] options) -> PgEventstore::QueryBuilders::EventsFiltering
12
+
9
13
  # _@param_ `options`
10
14
  def self.subscriptions_events_filtering: (::Hash[untyped, untyped] options) -> PgEventstore::QueryBuilders::EventsFiltering
11
15
 
@@ -17,6 +21,8 @@ module PgEventstore
17
21
  # _@param_ `options`
18
22
  def self.specific_stream_filtering: (PgEventstore::Stream stream, ::Hash[untyped, untyped] options) -> PgEventstore::QueryBuilders::EventsFiltering
19
23
 
24
+ def self.system_stream_filtering: (PgEventstore::Stream stream, Hash[untyped, untyped] options) -> PgEventstore::QueryBuilders::EventsFiltering
25
+
20
26
  def initialize: () -> void
21
27
 
22
28
  # _@param_ `context`
@@ -1,10 +1,13 @@
1
1
  module PgEventstore
2
2
  class Stream
3
+ KNOWN_SYSTEM_STREAMS: Array[String]
3
4
  SYSTEM_STREAM_PREFIX: String
4
5
  NON_EXISTING_STREAM_REVISION: Integer
5
6
 
6
7
  def self.all_stream: () -> PgEventstore::Stream
7
8
 
9
+ def self.system_stream: (String) -> PgEventstore::Stream
10
+
8
11
  # _@param_ `context`
9
12
  #
10
13
  # _@param_ `stream_name`
@@ -1,6 +1,10 @@
1
1
  module PgEventstore
2
2
  module CommandHandlers
3
3
  class SubscriptionFeederCommands
4
+ @config_name: Symbol
5
+
6
+ @subscription_feeder: PgEventstore::SubscriptionFeeder
7
+
4
8
  # _@param_ `config_name`
5
9
  #
6
10
  # _@param_ `subscription_feeder`
@@ -11,6 +15,10 @@ module PgEventstore
11
15
  def queries: () -> PgEventstore::SubscriptionsSetCommandQueries
12
16
 
13
17
  def connection: () -> PgEventstore::Connection
18
+
19
+ private
20
+
21
+ def commands: () -> Array[PgEventstore::SubscriptionFeederCommands::Base]
14
22
  end
15
23
  end
16
24
  end
@@ -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"
@@ -0,0 +1,27 @@
1
+ module PgEventstore
2
+ module Web
3
+ class Application
4
+ def asset_url: (String path) -> String
5
+
6
+ def connection: -> PgEventstore::Connection
7
+
8
+ def current_config: -> Symbol
9
+
10
+ def current_config=: (untyped val) -> void
11
+
12
+ def events_filter: -> Array[String]?
13
+
14
+ def h: (String text) -> String
15
+
16
+ def paginated_json_response: (PgEventstore::Web::Paginator::BaseCollection collection) -> void
17
+
18
+ def redirect_back_url: (fallback_url: String) -> String
19
+
20
+ def resolve_link_tos?: -> bool
21
+
22
+ def streams_filter: -> Array[Hash[untyped, untyped]]?
23
+
24
+ def system_stream: -> String?
25
+ end
26
+ end
27
+ end
@@ -2,15 +2,6 @@ module PgEventstore
2
2
  module Web
3
3
  module Paginator
4
4
  class BaseCollection
5
- # _@param_ `config_name`
6
- #
7
- # _@param_ `starting_id`
8
- #
9
- # _@param_ `per_page`
10
- #
11
- # _@param_ `order` — :asc or :desc
12
- #
13
- # _@param_ `options` — additional options to filter the collection
14
5
  def initialize: (
15
6
  Symbol config_name,
16
7
  starting_id: (String | Integer)?,
@@ -4,6 +4,15 @@ module PgEventstore
4
4
  class EventTypesCollection < PgEventstore::Web::Paginator::BaseCollection
5
5
  PER_PAGE: Integer
6
6
 
7
+ def initialize: (
8
+ Symbol config_name,
9
+ starting_id: (String | Integer)?,
10
+ per_page: Integer,
11
+ order: Symbol,
12
+ ?options: ::Hash[untyped, untyped],
13
+ ?system_stream: String?
14
+ ) -> void
15
+
7
16
  def collection: () -> ::Array[::Hash[String, String]]
8
17
 
9
18
  def next_page_starting_id: () -> String?