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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +7 -29
- data/docs/admin_ui.md +35 -0
- data/lib/pg_eventstore/abstract_command.rb +2 -0
- data/lib/pg_eventstore/callbacks.rb +3 -0
- data/lib/pg_eventstore/client.rb +6 -1
- data/lib/pg_eventstore/config.rb +1 -1
- data/lib/pg_eventstore/connection.rb +9 -1
- data/lib/pg_eventstore/errors.rb +45 -26
- data/lib/pg_eventstore/event.rb +2 -1
- data/lib/pg_eventstore/event_class_resolver.rb +1 -1
- data/lib/pg_eventstore/event_deserializer.rb +8 -2
- data/lib/pg_eventstore/event_serializer.rb +2 -0
- data/lib/pg_eventstore/extensions/callbacks_extension.rb +1 -0
- data/lib/pg_eventstore/extensions/options_extension.rb +3 -1
- data/lib/pg_eventstore/queries/event_queries.rb +12 -4
- data/lib/pg_eventstore/queries/links_resolver.rb +3 -0
- data/lib/pg_eventstore/queries/partition_queries.rb +6 -0
- data/lib/pg_eventstore/queries/transaction_queries.rb +4 -0
- data/lib/pg_eventstore/queries.rb +1 -1
- data/lib/pg_eventstore/query_builders/{events_filtering_query.rb → events_filtering.rb} +3 -0
- data/lib/pg_eventstore/sql_builder.rb +18 -10
- data/lib/pg_eventstore/stream.rb +13 -2
- data/lib/pg_eventstore/subscriptions/basic_runner.rb +2 -0
- data/lib/pg_eventstore/subscriptions/commands_handler.rb +5 -3
- data/lib/pg_eventstore/subscriptions/queries/subscription_command_queries.rb +6 -4
- data/lib/pg_eventstore/subscriptions/queries/subscription_queries.rb +4 -2
- data/lib/pg_eventstore/subscriptions/queries/subscriptions_set_command_queries.rb +6 -4
- data/lib/pg_eventstore/subscriptions/queries/subscriptions_set_queries.rb +3 -0
- data/lib/pg_eventstore/subscriptions/runner_state.rb +1 -0
- data/lib/pg_eventstore/subscriptions/subscription.rb +19 -17
- data/lib/pg_eventstore/subscriptions/subscription_feeder.rb +4 -0
- data/lib/pg_eventstore/subscriptions/subscription_feeder_commands/base.rb +4 -4
- data/lib/pg_eventstore/subscriptions/subscription_handler_performance.rb +2 -1
- data/lib/pg_eventstore/subscriptions/subscription_runner.rb +5 -0
- data/lib/pg_eventstore/subscriptions/subscription_runner_commands/base.rb +4 -4
- data/lib/pg_eventstore/subscriptions/subscriptions_manager.rb +6 -4
- data/lib/pg_eventstore/subscriptions/subscriptions_set.rb +10 -10
- data/lib/pg_eventstore/version.rb +2 -1
- data/lib/pg_eventstore/web/application.rb +12 -6
- data/lib/pg_eventstore/web/paginator/base_collection.rb +15 -1
- data/lib/pg_eventstore/web/paginator/event_types_collection.rb +2 -1
- data/lib/pg_eventstore/web/paginator/events_collection.rb +7 -4
- data/lib/pg_eventstore/web/paginator/helpers.rb +3 -3
- data/lib/pg_eventstore/web/paginator/stream_contexts_collection.rb +2 -1
- data/lib/pg_eventstore/web/paginator/stream_ids_collection.rb +2 -1
- data/lib/pg_eventstore/web/paginator/stream_names_collection.rb +2 -1
- data/lib/pg_eventstore/web/subscriptions/set_collection.rb +2 -0
- data/lib/pg_eventstore/web/subscriptions/subscriptions.rb +2 -0
- data/lib/pg_eventstore/web/subscriptions/subscriptions_set.rb +2 -0
- data/lib/pg_eventstore/web/subscriptions/subscriptions_to_set_association.rb +6 -1
- data/lib/pg_eventstore/web/views/layouts/application.erb +12 -12
- data/lib/pg_eventstore.rb +6 -1
- data/pg_eventstore.gemspec +1 -1
- data/rbs_collection.lock.yaml +16 -0
- data/rbs_collection.yaml +23 -0
- data/sig/interfaces/callback.rbs +3 -0
- data/sig/interfaces/event_class_resolver.rbs +3 -0
- data/sig/interfaces/event_modifier.rbs +3 -0
- data/sig/interfaces/restart_terminator.rbs +3 -0
- data/sig/interfaces/subscription_handler.rbs +3 -0
- data/sig/pg/basic_type_registry.rbs +21 -0
- data/sig/pg/connection.rbs +407 -0
- data/sig/pg/constants.rbs +153 -0
- data/sig/pg_eventstore/abstract_command.rbs +11 -0
- data/sig/pg_eventstore/callbacks.rbs +21 -0
- data/sig/pg_eventstore/client.rbs +67 -0
- data/sig/pg_eventstore/commands/append.rbs +33 -0
- data/sig/pg_eventstore/commands/event_modifiers/prepare_link_event.rbs +24 -0
- data/sig/pg_eventstore/commands/event_modifiers/prepare_regular_event.rbs +12 -0
- data/sig/pg_eventstore/commands/link_to.rbs +17 -0
- data/sig/pg_eventstore/commands/multiple.rbs +7 -0
- data/sig/pg_eventstore/commands/read.rbs +10 -0
- data/sig/pg_eventstore/commands/regular_stream_read_paginated.rbs +32 -0
- data/sig/pg_eventstore/commands/system_stream_read_paginated.rbs +30 -0
- data/sig/pg_eventstore/config.rbs +51 -0
- data/sig/pg_eventstore/connection.rbs +30 -0
- data/sig/pg_eventstore/errors.rbs +116 -0
- data/sig/pg_eventstore/event.rbs +46 -0
- data/sig/pg_eventstore/event_class_resolver.rbs +6 -0
- data/sig/pg_eventstore/event_deserializer.rbs +20 -0
- data/sig/pg_eventstore/event_serializer.rbs +13 -0
- data/sig/pg_eventstore/extensions/callbacks_extension.rbs +23 -0
- data/sig/pg_eventstore/extensions/options_extension.rbs +37 -0
- data/sig/pg_eventstore/extensions/using_connection_extension.rbs +14 -0
- data/sig/pg_eventstore/middleware.rbs +9 -0
- data/sig/pg_eventstore/pg_connection.rbs +13 -0
- data/sig/pg_eventstore/queries/event_queries.rbs +50 -0
- data/sig/pg_eventstore/queries/links_resolver.rbs +19 -0
- data/sig/pg_eventstore/queries/partition_queries.rbs +74 -0
- data/sig/pg_eventstore/queries/transaction_queries.rbs +21 -0
- data/sig/pg_eventstore/queries.rbs +23 -0
- data/sig/pg_eventstore/query_builders/events_filtering_query.rbs +62 -0
- data/sig/pg_eventstore/sql_builder.rbs +74 -0
- data/sig/pg_eventstore/stream.rbs +40 -0
- data/sig/pg_eventstore/subscriptions/basic_runner.rbs +37 -0
- data/sig/pg_eventstore/subscriptions/command_handlers/subscription_feeder_commands.rbs +16 -0
- data/sig/pg_eventstore/subscriptions/command_handlers/subscription_runners_commands.rbs +18 -0
- data/sig/pg_eventstore/subscriptions/commands_handler.rbs +25 -0
- data/sig/pg_eventstore/subscriptions/events_processor.rbs +34 -0
- data/sig/pg_eventstore/subscriptions/extensions/base_command_extension.rbs +20 -0
- data/sig/pg_eventstore/subscriptions/extensions/command_class_lookup_extension.rbs +8 -0
- data/sig/pg_eventstore/subscriptions/queries/subscription_command_queries.rbs +56 -0
- data/sig/pg_eventstore/subscriptions/queries/subscription_queries.rbs +73 -0
- data/sig/pg_eventstore/subscriptions/queries/subscriptions_set_command_queries.rbs +39 -0
- data/sig/pg_eventstore/subscriptions/queries/subscriptions_set_queries.rbs +36 -0
- data/sig/pg_eventstore/subscriptions/runner_state.rbs +16 -0
- data/sig/pg_eventstore/subscriptions/subscription.rbs +96 -0
- data/sig/pg_eventstore/subscriptions/subscription_feeder.rbs +64 -0
- data/sig/pg_eventstore/subscriptions/subscription_feeder_commands/base.rbs +45 -0
- data/sig/pg_eventstore/subscriptions/subscription_feeder_commands/restore.rbs +8 -0
- data/sig/pg_eventstore/subscriptions/subscription_feeder_commands/start_all.rbs +8 -0
- data/sig/pg_eventstore/subscriptions/subscription_feeder_commands/stop.rbs +8 -0
- data/sig/pg_eventstore/subscriptions/subscription_feeder_commands/stop_all.rbs +8 -0
- data/sig/pg_eventstore/subscriptions/subscription_feeder_commands.rbs +8 -0
- data/sig/pg_eventstore/subscriptions/subscription_handler_performance.rbs +12 -0
- data/sig/pg_eventstore/subscriptions/subscription_runner.rbs +55 -0
- data/sig/pg_eventstore/subscriptions/subscription_runner_commands/base.rbs +47 -0
- data/sig/pg_eventstore/subscriptions/subscription_runner_commands/reset_position.rbs +11 -0
- data/sig/pg_eventstore/subscriptions/subscription_runner_commands/restore.rbs +8 -0
- data/sig/pg_eventstore/subscriptions/subscription_runner_commands/start.rbs +8 -0
- data/sig/pg_eventstore/subscriptions/subscription_runner_commands/stop.rbs +8 -0
- data/sig/pg_eventstore/subscriptions/subscription_runner_commands.rbs +8 -0
- data/sig/pg_eventstore/subscriptions/subscription_runners_feeder.rbs +13 -0
- data/sig/pg_eventstore/subscriptions/subscriptions_manager.rbs +60 -0
- data/sig/pg_eventstore/subscriptions/subscriptions_set.rbs +72 -0
- data/sig/pg_eventstore/utils.rbs +20 -0
- data/sig/pg_eventstore/version.rbs +3 -0
- data/sig/pg_eventstore/web/paginator/base_collection.rbs +51 -0
- data/sig/pg_eventstore/web/paginator/event_types_collection.rbs +15 -0
- data/sig/pg_eventstore/web/paginator/events_collection.rbs +31 -0
- data/sig/pg_eventstore/web/paginator/helpers.rbs +38 -0
- data/sig/pg_eventstore/web/paginator/stream_contexts_collection.rbs +15 -0
- data/sig/pg_eventstore/web/paginator/stream_ids_collection.rbs +15 -0
- data/sig/pg_eventstore/web/paginator/stream_names_collection.rbs +15 -0
- data/sig/pg_eventstore/web/subscriptions/helpers.rbs +48 -0
- data/sig/pg_eventstore/web/subscriptions/set_collection.rbs +18 -0
- data/sig/pg_eventstore/web/subscriptions/subscriptions.rbs +18 -0
- data/sig/pg_eventstore/web/subscriptions/subscriptions_set.rbs +18 -0
- data/sig/pg_eventstore/web/subscriptions/subscriptions_to_set_association.rbs +18 -0
- data/sig/pg_eventstore.rbs +42 -0
- metadata +91 -3
@@ -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,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,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
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module PgEventstore
|
2
|
+
class SubscriptionsManager
|
3
|
+
extend Forwardable
|
4
|
+
|
5
|
+
# _@param_ `config`
|
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
|
12
|
+
def initialize: (
|
13
|
+
config: PgEventstore::Config,
|
14
|
+
set_name: String,
|
15
|
+
?max_retries: Integer?,
|
16
|
+
?retries_interval: Integer?
|
17
|
+
) -> void
|
18
|
+
|
19
|
+
# _@param_ `subscription_name` — subscription's name
|
20
|
+
#
|
21
|
+
# _@param_ `handler` — subscription's handler
|
22
|
+
#
|
23
|
+
# _@param_ `options` — request options
|
24
|
+
#
|
25
|
+
# _@param_ `middlewares` — provide a list of middleware names to override a config's middlewares
|
26
|
+
#
|
27
|
+
# _@param_ `pull_interval` — an interval in seconds to determine how often to query new events of the given subscription.
|
28
|
+
#
|
29
|
+
# _@param_ `max_retries` — max number of retries of failed Subscription
|
30
|
+
#
|
31
|
+
# _@param_ `retries_interval` — a delay between retries of failed Subscription
|
32
|
+
#
|
33
|
+
# _@param_ `restart_terminator` — a callable object which, when called - accepts PgEventstore::Subscription object to determine whether restarts should be stopped(true - stops restarts, false - continues restarts)
|
34
|
+
def subscribe: (
|
35
|
+
String subscription_name,
|
36
|
+
handler: _SubscriptionHandler,
|
37
|
+
?options: ::Hash[untyped, untyped],
|
38
|
+
?middlewares: ::Array[Symbol]?,
|
39
|
+
?pull_interval: Integer | Float,
|
40
|
+
?max_retries: Integer,
|
41
|
+
?retries_interval: Integer | Float,
|
42
|
+
?restart_terminator: _RestartTerminator?
|
43
|
+
) -> void
|
44
|
+
|
45
|
+
def subscriptions: () -> ::Array[PgEventstore::Subscription]
|
46
|
+
|
47
|
+
def subscriptions_set: () -> PgEventstore::SubscriptionsSet?
|
48
|
+
|
49
|
+
# _@param_ `middlewares`
|
50
|
+
#
|
51
|
+
# _@param_ `handler`
|
52
|
+
def create_event_handler: (::Array[Symbol]? middlewares, untyped handler) -> Proc
|
53
|
+
|
54
|
+
# _@param_ `middlewares`
|
55
|
+
def select_middlewares: (?::Array[Symbol]? middlewares) -> ::Array[PgEventstore::Middleware]
|
56
|
+
|
57
|
+
# Returns the value of attribute config.
|
58
|
+
attr_accessor config: PgEventstore::Config
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
module PgEventstore
|
2
|
+
class SubscriptionsSet
|
3
|
+
include PgEventstore::Extensions::UsingConnectionExtension
|
4
|
+
include PgEventstore::Extensions::OptionsExtension
|
5
|
+
|
6
|
+
# _@param_ `attrs`
|
7
|
+
def self.create: (::Hash[untyped, untyped] attrs) -> PgEventstore::SubscriptionsSet
|
8
|
+
|
9
|
+
def self.subscriptions_set_queries: () -> PgEventstore::SubscriptionsSetQueries
|
10
|
+
|
11
|
+
# _@param_ `attrs`
|
12
|
+
def assign_attributes: (::Hash[untyped, untyped] attrs) -> ::Hash[untyped, untyped]
|
13
|
+
|
14
|
+
# _@param_ `attrs`
|
15
|
+
def update: (::Hash[untyped, untyped] attrs) -> ::Hash[untyped, untyped]
|
16
|
+
|
17
|
+
def delete: () -> void
|
18
|
+
|
19
|
+
# Dup the current object without assigned connection
|
20
|
+
def dup: () -> PgEventstore::SubscriptionsSet
|
21
|
+
|
22
|
+
def reload: () -> PgEventstore::SubscriptionsSet
|
23
|
+
|
24
|
+
def hash: () -> Integer
|
25
|
+
|
26
|
+
# _@param_ `another`
|
27
|
+
def eql?: (untyped another) -> bool
|
28
|
+
|
29
|
+
# _@param_ `another`
|
30
|
+
def ==: (untyped another) -> bool
|
31
|
+
|
32
|
+
def subscriptions_set_queries: () -> PgEventstore::SubscriptionsSetQueries
|
33
|
+
|
34
|
+
def initialize: (**untyped options) -> void
|
35
|
+
|
36
|
+
def options_hash: () -> ::Hash[untyped, untyped]
|
37
|
+
|
38
|
+
# _@param_ `opt_name`
|
39
|
+
def readonly!: (Symbol opt_name) -> bool
|
40
|
+
|
41
|
+
# _@param_ `opt_name`
|
42
|
+
def readonly?: (Symbol opt_name) -> bool
|
43
|
+
|
44
|
+
# _@param_ `opt_name`
|
45
|
+
def readonly_error: (Symbol opt_name) -> void
|
46
|
+
|
47
|
+
# _@param_ `options`
|
48
|
+
def init_default_values: (::Hash[untyped, untyped] options) -> void
|
49
|
+
|
50
|
+
attr_accessor id: Integer?
|
51
|
+
|
52
|
+
attr_accessor name: String?
|
53
|
+
|
54
|
+
attr_accessor state: String?
|
55
|
+
|
56
|
+
attr_accessor restart_count: Integer?
|
57
|
+
|
58
|
+
attr_accessor max_restarts_number: Integer?
|
59
|
+
|
60
|
+
attr_accessor time_between_restarts: Integer?
|
61
|
+
|
62
|
+
attr_accessor last_restarted_at: Time?
|
63
|
+
|
64
|
+
attr_accessor last_error: { 'class' => String, 'message' => String, 'backtrace' => Array[String] }?
|
65
|
+
|
66
|
+
attr_accessor last_error_occurred_at: Time?
|
67
|
+
|
68
|
+
attr_accessor created_at: Time?
|
69
|
+
|
70
|
+
attr_accessor updated_at: Time?
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module PgEventstore
|
2
|
+
class Utils
|
3
|
+
# _@param_ `object`
|
4
|
+
def self.deep_transform_keys: (untyped object) { (untyped key) -> untyped } -> Object
|
5
|
+
|
6
|
+
# _@param_ `object`
|
7
|
+
def self.deep_dup: (untyped object) -> Object
|
8
|
+
|
9
|
+
# _@param_ `array`
|
10
|
+
#
|
11
|
+
# _@return_ — positional variables, based on array size. Example: "$1, $2, $3"
|
12
|
+
def self.positional_vars: (::Array[untyped] array) -> String
|
13
|
+
|
14
|
+
# _@param_ `error`
|
15
|
+
def self.error_info: (StandardError error) -> ::Hash[untyped, untyped]
|
16
|
+
|
17
|
+
# _@param_ `str`
|
18
|
+
def self.underscore_str: (String str) -> String
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
module PgEventstore
|
2
|
+
module Web
|
3
|
+
module Paginator
|
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
|
+
def initialize: (
|
15
|
+
Symbol config_name,
|
16
|
+
starting_id: (String | Integer)?,
|
17
|
+
per_page: Integer,
|
18
|
+
order: Symbol,
|
19
|
+
?options: ::Hash[untyped, untyped]
|
20
|
+
) -> void
|
21
|
+
|
22
|
+
def collection: () -> ::Array[untyped]
|
23
|
+
|
24
|
+
def count: () -> Integer
|
25
|
+
|
26
|
+
def next_page_starting_id: () -> (String | Integer)?
|
27
|
+
|
28
|
+
def prev_page_starting_id: () -> (String | Integer)?
|
29
|
+
|
30
|
+
def total_count: () -> Integer
|
31
|
+
|
32
|
+
def connection: () -> PgEventstore::Connection
|
33
|
+
|
34
|
+
# Returns the value of attribute config_name.
|
35
|
+
attr_accessor config_name: Symbol
|
36
|
+
|
37
|
+
# Returns the value of attribute starting_id.
|
38
|
+
attr_accessor starting_id: (String | Integer)?
|
39
|
+
|
40
|
+
# Returns the value of attribute per_page.
|
41
|
+
attr_accessor per_page: Integer
|
42
|
+
|
43
|
+
# Returns the value of attribute order.
|
44
|
+
attr_accessor order: Symbol
|
45
|
+
|
46
|
+
# Returns the value of attribute options.
|
47
|
+
attr_accessor options: ::Hash[untyped, untyped]
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module PgEventstore
|
2
|
+
module Web
|
3
|
+
module Paginator
|
4
|
+
class EventTypesCollection < PgEventstore::Web::Paginator::BaseCollection
|
5
|
+
PER_PAGE: Integer
|
6
|
+
|
7
|
+
def collection: () -> ::Array[::Hash[String, String]]
|
8
|
+
|
9
|
+
def next_page_starting_id: () -> String?
|
10
|
+
|
11
|
+
def direction_operator: () -> String
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module PgEventstore
|
2
|
+
module Web
|
3
|
+
module Paginator
|
4
|
+
class EventsCollection < PgEventstore::Web::Paginator::BaseCollection
|
5
|
+
SQL_DIRECTIONS: ::Hash[String, Symbol]
|
6
|
+
PER_PAGE: ::Hash[String, Integer]
|
7
|
+
MAX_NUMBER_TO_COUNT: Integer
|
8
|
+
|
9
|
+
def collection: () -> ::Array[PgEventstore::Event]
|
10
|
+
|
11
|
+
def next_page_starting_id: () -> Integer?
|
12
|
+
|
13
|
+
def prev_page_starting_id: () -> Integer?
|
14
|
+
|
15
|
+
def total_count: () -> Integer
|
16
|
+
|
17
|
+
# _@param_ `event`
|
18
|
+
def event_global_position: (PgEventstore::Event event) -> Integer?
|
19
|
+
|
20
|
+
# _@param_ `sql_builder`
|
21
|
+
def estimate_count: (PgEventstore::SQLBuilder sql_builder) -> Integer
|
22
|
+
|
23
|
+
# _@param_ `sql_builder`
|
24
|
+
def regular_count: (PgEventstore::SQLBuilder sql_builder) -> Integer
|
25
|
+
|
26
|
+
# _@param_ `sql_builder`
|
27
|
+
def global_position: (PgEventstore::SQLBuilder sql_builder) -> Integer?
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module PgEventstore
|
2
|
+
module Web
|
3
|
+
module Paginator
|
4
|
+
module Helpers
|
5
|
+
# _@param_ `collection`
|
6
|
+
def previous_page_link: (PgEventstore::Web::Paginator::BaseCollection collection) -> String
|
7
|
+
|
8
|
+
# _@param_ `collection`
|
9
|
+
def next_page_link: (PgEventstore::Web::Paginator::BaseCollection collection) -> String
|
10
|
+
|
11
|
+
def first_page_link: () -> String
|
12
|
+
|
13
|
+
# _@param_ `per_page` — string representation of items per page. E.g. "10", "20", etc.
|
14
|
+
def per_page_url: (String per_page) -> String
|
15
|
+
|
16
|
+
# _@param_ `order` — "asc"/"desc"
|
17
|
+
def sort_url: (String order) -> String
|
18
|
+
|
19
|
+
# _@param_ `number` — total number of events by the current filter
|
20
|
+
def total_count: (Integer number) -> String
|
21
|
+
|
22
|
+
# _@param_ `number`
|
23
|
+
#
|
24
|
+
# _@param_ `delimiter`
|
25
|
+
def number_with_delimiter: (Integer number, ?delimiter: String) -> String
|
26
|
+
|
27
|
+
# _@param_ `event`
|
28
|
+
def stream_path: (PgEventstore::Event event) -> String
|
29
|
+
|
30
|
+
# _@param_ `starting_id`
|
31
|
+
def build_starting_id_link: ((String | Integer)? starting_id) -> String
|
32
|
+
|
33
|
+
# _@param_ `params`
|
34
|
+
def build_path: ((::Hash[untyped, untyped] | ::Array[untyped]) params) -> String
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module PgEventstore
|
2
|
+
module Web
|
3
|
+
module Paginator
|
4
|
+
class StreamContextsCollection < PgEventstore::Web::Paginator::BaseCollection
|
5
|
+
PER_PAGE: Integer
|
6
|
+
|
7
|
+
def collection: () -> ::Array[::Hash[String, String]]
|
8
|
+
|
9
|
+
def next_page_starting_id: () -> String?
|
10
|
+
|
11
|
+
def direction_operator: () -> String
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module PgEventstore
|
2
|
+
module Web
|
3
|
+
module Paginator
|
4
|
+
class StreamIdsCollection < PgEventstore::Web::Paginator::BaseCollection
|
5
|
+
PER_PAGE: Integer
|
6
|
+
|
7
|
+
def collection: () -> ::Array[::Hash[String, String]]
|
8
|
+
|
9
|
+
def next_page_starting_id: () -> String?
|
10
|
+
|
11
|
+
def direction_operator: () -> String
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|