pgbus 0.18.2 → 0.19.1

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 (109) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +345 -142
  3. data/README.md +49 -0
  4. data/app/controllers/pgbus/deploy_tasks_controller.rb +38 -0
  5. data/app/controllers/pgbus/frontends_controller.rb +10 -8
  6. data/app/helpers/pgbus/application_helper.rb +4 -3
  7. data/app/helpers/pgbus/deploy_tasks_helper.rb +77 -0
  8. data/app/helpers/pgbus/processes_helper.rb +1 -1
  9. data/app/models/pgbus/deploy_task.rb +104 -0
  10. data/app/models/pgbus/deploy_task_run.rb +45 -0
  11. data/app/models/pgbus/job_stat.rb +4 -0
  12. data/app/models/pgbus/processed_event.rb +3 -1
  13. data/app/models/pgbus/stream_queue.rb +34 -3
  14. data/app/models/pgbus/stream_stat.rb +3 -0
  15. data/app/views/layouts/pgbus/application.html.erb +2 -0
  16. data/app/views/pgbus/deploy_tasks/_rollover_banner.html.erb +25 -0
  17. data/app/views/pgbus/deploy_tasks/_tasks_table.html.erb +71 -0
  18. data/app/views/pgbus/deploy_tasks/index.html.erb +6 -0
  19. data/app/views/pgbus/deploy_tasks/show.html.erb +134 -0
  20. data/config/i18n-tasks.yml +2 -0
  21. data/config/locales/da.yml +97 -0
  22. data/config/locales/de.yml +97 -0
  23. data/config/locales/en.yml +97 -0
  24. data/config/locales/es.yml +97 -0
  25. data/config/locales/fi.yml +97 -0
  26. data/config/locales/fr.yml +97 -0
  27. data/config/locales/it.yml +97 -0
  28. data/config/locales/ja.yml +97 -0
  29. data/config/locales/nb.yml +97 -0
  30. data/config/locales/nl.yml +97 -0
  31. data/config/locales/pt.yml +97 -0
  32. data/config/locales/sv.yml +97 -0
  33. data/config/routes.rb +7 -0
  34. data/lib/generators/pgbus/add_deploy_tasks_generator.rb +51 -0
  35. data/lib/generators/pgbus/templates/add_deploy_tasks_tables.rb.erb +43 -0
  36. data/lib/generators/pgbus/templates/deploy_tasks.yml.erb +42 -0
  37. data/lib/generators/pgbus/templates/migration.rb.erb +43 -0
  38. data/lib/pgbus/active_job/current_attributes.rb +3 -1
  39. data/lib/pgbus/batch.rb +17 -9
  40. data/lib/pgbus/cli.rb +3 -0
  41. data/lib/pgbus/client/read_after.rb +10 -1
  42. data/lib/pgbus/client.rb +54 -9
  43. data/lib/pgbus/concurrency.rb +3 -0
  44. data/lib/pgbus/configuration/deploy_settings.rb +46 -0
  45. data/lib/pgbus/configuration.rb +87 -9
  46. data/lib/pgbus/current_attributes.rb +3 -1
  47. data/lib/pgbus/dedup_cache.rb +15 -7
  48. data/lib/pgbus/deploy/revision.rb +59 -0
  49. data/lib/pgbus/deploy/rollover.rb +65 -0
  50. data/lib/pgbus/deploy/runner.rb +259 -0
  51. data/lib/pgbus/deploy/task.rb +105 -0
  52. data/lib/pgbus/engine.rb +28 -0
  53. data/lib/pgbus/event_bus/handler.rb +16 -4
  54. data/lib/pgbus/execution_pools/async_pool.rb +23 -2
  55. data/lib/pgbus/execution_pools/thread_pool.rb +22 -0
  56. data/lib/pgbus/execution_pools.rb +26 -0
  57. data/lib/pgbus/generators/migration_detector.rb +11 -0
  58. data/lib/pgbus/instrumentation.rb +3 -0
  59. data/lib/pgbus/integrations/appsignal/probe.rb +17 -9
  60. data/lib/pgbus/integrations/appsignal/subscriber.rb +30 -18
  61. data/lib/pgbus/integrations/appsignal.rb +26 -16
  62. data/lib/pgbus/mcp/rack_app.rb +1 -1
  63. data/lib/pgbus/mcp/server.rb +2 -1
  64. data/lib/pgbus/mcp/tools/deploy_tasks_tool.rb +86 -0
  65. data/lib/pgbus/mcp.rb +1 -0
  66. data/lib/pgbus/metrics/subscriber.rb +35 -21
  67. data/lib/pgbus/outbox/poller.rb +1 -0
  68. data/lib/pgbus/process/consumer.rb +2 -1
  69. data/lib/pgbus/process/consumer_priority.rb +1 -1
  70. data/lib/pgbus/process/dispatcher.rb +18 -1
  71. data/lib/pgbus/process/heartbeat.rb +7 -2
  72. data/lib/pgbus/process/lifecycle.rb +5 -5
  73. data/lib/pgbus/process/notify_listener.rb +32 -18
  74. data/lib/pgbus/process/supervisor.rb +35 -3
  75. data/lib/pgbus/process/wake_pipe.rb +4 -1
  76. data/lib/pgbus/process/worker.rb +5 -2
  77. data/lib/pgbus/recurring/scheduler.rb +54 -20
  78. data/lib/pgbus/retry_backoff.rb +3 -0
  79. data/lib/pgbus/shareable.rb +70 -0
  80. data/lib/pgbus/streams/broadcastable_override.rb +3 -0
  81. data/lib/pgbus/streams/presence.rb +6 -7
  82. data/lib/pgbus/streams.rb +38 -27
  83. data/lib/pgbus/testing.rb +19 -3
  84. data/lib/pgbus/uniqueness.rb +3 -0
  85. data/lib/pgbus/version.rb +1 -1
  86. data/lib/pgbus/visibility_heartbeat.rb +51 -34
  87. data/lib/pgbus/web/authentication.rb +19 -2
  88. data/lib/pgbus/web/data_source/deploy_task_list.rb +114 -0
  89. data/lib/pgbus/web/data_source/list_counts.rb +10 -7
  90. data/lib/pgbus/web/data_source.rb +1 -0
  91. data/lib/pgbus/web/deploy_task_state.rb +51 -0
  92. data/lib/pgbus/web/health_server.rb +4 -1
  93. data/lib/pgbus/web/process_activity.rb +1 -1
  94. data/lib/pgbus/web/streamer/heartbeat.rb +4 -1
  95. data/lib/pgbus/web/streamer/hub_client.rb +4 -1
  96. data/lib/pgbus/web/streamer/listener.rb +10 -1
  97. data/lib/pgbus/web/streamer/master_hub.rb +11 -5
  98. data/lib/pgbus/web/streamer/master_hub_boot.rb +3 -1
  99. data/lib/pgbus/web/streamer/outbound_pump.rb +4 -1
  100. data/lib/pgbus/web/streamer/peer_close_watcher.rb +4 -1
  101. data/lib/pgbus/web/streamer/stream_event_dispatcher.rb +13 -1
  102. data/lib/pgbus.rb +92 -30
  103. data/sig/pgbus/active_job/adapter.rbs +57 -0
  104. data/sig/pgbus/client.rbs +78 -0
  105. data/sig/pgbus/configuration.rbs +326 -0
  106. data/sig/pgbus/streams/stream.rbs +25 -0
  107. data/sig/pgbus/streams.rbs +22 -0
  108. data/sig/pgbus.rbs +73 -0
  109. metadata +27 -1
@@ -0,0 +1,78 @@
1
+ # The PGMQ client (Pgbus.client). Generated from reflection, untyped; always go
2
+ # through it rather than PGMQ directly. spec/pgbus/rbs_spec.rb fails when a
3
+ # public method is missing here.
4
+ module Pgbus
5
+ class Client
6
+ def archive_batch: (untyped queue_name, untyped msg_ids, ?prefixed: untyped) -> untyped
7
+ def archive_message: (untyped queue_name, untyped msg_id, ?prefixed: untyped) -> untyped
8
+ def bind_topic: (untyped pattern, untyped queue_name) -> untyped
9
+ def close: () -> untyped
10
+ def config: () -> untyped
11
+ def configured_queues: () -> untyped
12
+ def connection_health: () -> untyped
13
+ def convert_archive_partitioned: (untyped queue_name, ?partition_interval: untyped, ?retention_interval: untyped, ?leading_partition: untyped) -> untyped
14
+ def create_fifo_index: (untyped queue_name) -> untyped
15
+ def create_fifo_indexes_all: () -> untyped
16
+ def dead_letter_physical_name: (untyped queue_name) -> untyped
17
+ def delete_batch: (untyped queue_name, untyped msg_ids, ?prefixed: untyped) -> untyped
18
+ def delete_message: (untyped queue_name, untyped msg_id, ?prefixed: untyped) -> untyped
19
+ def drop_queue: (untyped queue_name, ?prefixed: untyped) -> untyped
20
+ def ensure_all_queues: () -> untyped
21
+ def ensure_dead_letter_queue: (untyped name) -> untyped
22
+ def ensure_fair_index: (untyped queue_name) -> untyped
23
+ def ensure_queue: (untyped name) -> untyped
24
+ def ensure_stream_queue: (untyped stream_name) -> untyped
25
+ def in_recovery?: () -> bool
26
+ def list_notify_insert_throttles: () -> untyped
27
+ def list_queues: () -> untyped
28
+ def message_archived?: (untyped queue_name, msg_id: untyped) -> bool
29
+ def message_exists?: (untyped queue_name, ?msg_id: untyped, ?uniqueness_key: untyped) -> bool
30
+ def message_in_queue?: (untyped queue_name, msg_id: untyped) -> bool
31
+ def message_with_job_id?: (untyped queue_name, job_id: untyped) -> bool
32
+ def metrics: (?untyped queue_name) -> untyped
33
+ def move_to_dead_letter: (untyped queue_name, untyped message, ?headers: untyped) -> untyped
34
+ def notify_enabled?: (untyped queue_name) -> bool
35
+ def notify_stream: (untyped stream_name, untyped payload) -> untyped
36
+ def oldest_claimable_ages: (?untyped queue_name) -> untyped
37
+ def pgmq: () -> untyped
38
+ def pgmq_installed?: () -> bool
39
+ def pgmq_schema_version: () -> untyped
40
+ def physical_queue_names: (untyped logical_name) -> untyped
41
+ def ping: () -> untyped
42
+ def pool_stats: () -> untyped
43
+ def publish_to_topic: (untyped routing_key, untyped payload, ?headers: untyped, ?delay: untyped) -> untyped
44
+ def purge_archive: (untyped queue_name, older_than: untyped, ?batch_size: untyped) -> untyped
45
+ def purge_queue: (untyped queue_name, ?prefixed: untyped) -> untyped
46
+ def read_after: (untyped stream_name, after_id: untyped, ?limit: untyped) -> untyped
47
+ def read_batch: (untyped queue_name, qty: untyped, ?vt: untyped) -> untyped
48
+ def read_batch_fair: (untyped queue_name, qty: untyped, ?vt: untyped) -> untyped
49
+ def read_batch_prioritized: (untyped queue_name, qty: untyped, ?vt: untyped) -> untyped
50
+ def read_batch_prioritized_fair: (untyped queue_name, qty: untyped, ?vt: untyped) -> untyped
51
+ def read_grouped: (untyped queue_name, qty: untyped, ?vt: untyped) -> untyped
52
+ def read_grouped_head: (untyped queue_name, qty: untyped, ?vt: untyped) -> untyped
53
+ def read_grouped_rr: (untyped queue_name, qty: untyped, ?vt: untyped) -> untyped
54
+ def read_message: (untyped queue_name, ?vt: untyped) -> untyped
55
+ def read_multi: (untyped queue_names, qty: untyped, ?vt: untyped, ?limit: untyped) -> untyped
56
+ def read_with_poll: (untyped queue_name, qty: untyped, ?vt: untyped, ?max_poll_seconds: untyped, ?poll_interval_ms: untyped) -> untyped
57
+ def reload: () -> untyped
58
+ def resize_streams_pool: (untyped new_size) -> untyped
59
+ def send_batch: (untyped queue_name, untyped payloads, ?headers: untyped, ?delay: untyped, ?priority: untyped) -> untyped
60
+ def send_message: (untyped queue_name, untyped payload, ?headers: untyped, ?delay: untyped, ?priority: untyped) -> untyped
61
+ def send_stream_message: (untyped stream_name, untyped payload, ?headers: untyped, ?delay: untyped) -> untyped
62
+ def set_visibility_timeout: (untyped queue_name, untyped msg_id, vt: untyped, ?prefixed: untyped) -> untyped
63
+ def shared_connection?: () -> bool
64
+ def stream_current_msg_id: (untyped stream_name) -> untyped
65
+ def stream_oldest_msg_id: (untyped stream_name) -> untyped
66
+ def streams_pool_stats: () -> untyped
67
+ def streams_swap_stats: () -> untyped
68
+ def synchronizing?: () -> bool
69
+ def target_queue: (untyped queue_name, ?untyped priority) -> untyped
70
+ def transaction: () ?{ (*untyped) -> untyped } -> untyped
71
+ def uniqueness_keys_present: (untyped lock_keys) -> untyped
72
+ def update_notify_insert: (untyped queue_name, throttle_interval_ms: untyped) -> untyped
73
+ def verify_connection!: () -> untyped
74
+ def wait_for_notify: (untyped queue_name, ?timeout: untyped) ?{ (*untyped) -> untyped } -> untyped
75
+ def self.load_pgmq_gem!: () -> untyped
76
+ def self.pgmq_install_mutex: () -> untyped
77
+ end
78
+ end
@@ -0,0 +1,326 @@
1
+ # The configuration (Pgbus.configure yields it). Generated from reflection:
2
+ # the setting readers carry the type of their default, the rest are untyped;
3
+ # the duration readers are Numeric? (an Integer, Float or Duration's seconds,
4
+ # or nil where the setting is off).
5
+ # spec/pgbus/rbs_spec.rb fails when a public method is missing here.
6
+ module Pgbus
7
+ class Configuration
8
+ def allowed_global_id_models: () -> untyped
9
+ def allowed_global_id_models=: (untyped) -> untyped
10
+ def app_revision: () -> untyped
11
+ def app_revision=: (untyped) -> untyped
12
+ def apply_log_format!: () -> void
13
+ def appsignal_enabled: () -> bool
14
+ def appsignal_enabled=: (untyped) -> untyped
15
+ def appsignal_probe_enabled: () -> bool
16
+ def appsignal_probe_enabled=: (untyped) -> untyped
17
+ def archive_retention: () -> Numeric?
18
+ def archive_retention=: (untyped value) -> untyped
19
+ def base_controller_class: () -> String
20
+ def base_controller_class=: (untyped) -> untyped
21
+ def batch_retention: () -> Numeric?
22
+ def batch_retention=: (untyped value) -> untyped
23
+ def batch_stall_threshold: () -> Numeric?
24
+ def batch_stall_threshold=: (untyped value) -> untyped
25
+ def batch_sweep_interval: () -> Numeric?
26
+ def batch_sweep_interval=: (untyped value) -> untyped
27
+ def capsule: (untyped name, queues: untyped, threads: untyped, **untyped options) -> untyped
28
+ def capsule_named: (untyped name) -> untyped
29
+ def circuit_breaker_enabled: () -> bool
30
+ def circuit_breaker_enabled=: (untyped) -> untyped
31
+ def connection_guc_mode: () -> Symbol
32
+ def connection_guc_mode=: (untyped mode) -> untyped
33
+ def connection_options: () -> untyped
34
+ def connection_params: () -> untyped
35
+ def connection_params=: (untyped) -> untyped
36
+ def connects_to: () -> untyped
37
+ def connects_to=: (untyped) -> untyped
38
+ def current_attributes: () -> untyped
39
+ def current_attributes=: (untyped value) -> untyped
40
+ def dashboard_filter_parameters: () -> untyped
41
+ def dashboard_filter_parameters=: (untyped value) -> untyped
42
+ def dashboard_filter_sensitive: () -> untyped
43
+ def dashboard_filter_sensitive=: (untyped value) -> untyped
44
+ def database_url: () -> untyped
45
+ def database_url=: (untyped) -> untyped
46
+ def dead_letter_queue_name: (untyped name) -> untyped
47
+ def default_priority: () -> Integer
48
+ def default_priority=: (untyped) -> untyped
49
+ def default_queue: () -> String
50
+ def default_queue=: (untyped) -> untyped
51
+ def deploy_task_run_retention: () -> Numeric?
52
+ def deploy_task_run_retention=: (untyped value) -> untyped
53
+ def deploy_tasks: () -> untyped
54
+ def deploy_tasks=: (untyped) -> untyped
55
+ def deploy_tasks_enabled: () -> bool
56
+ def deploy_tasks_enabled=: (untyped) -> untyped
57
+ def deploy_tasks_files: () -> untyped
58
+ def deploy_tasks_files=: (untyped) -> untyped
59
+ def dispatch_interval: () -> Float
60
+ def dispatch_interval=: (untyped) -> untyped
61
+ def doctor_on_boot: () -> untyped
62
+ def doctor_on_boot=: (untyped mode) -> untyped
63
+ def drain_timeout: () -> Integer
64
+ def drain_timeout=: (untyped) -> untyped
65
+ def eager_validation: () -> bool
66
+ def eager_validation=: (untyped) -> untyped
67
+ def effective_visibility_heartbeat_interval: () -> untyped
68
+ def error_reporters: () -> Array[untyped]
69
+ def error_reporters=: (untyped) -> untyped
70
+ def event_consumers: () -> untyped
71
+ def event_consumers=: (untyped value) -> untyped
72
+ def event_fair_share: () -> untyped
73
+ def event_fair_share=: (untyped callable) -> untyped
74
+ def execution_mode: () -> Symbol
75
+ def execution_mode=: (untyped) -> untyped
76
+ def execution_mode_for: (untyped worker_config) -> untyped
77
+ def fair_share: () -> untyped
78
+ def fair_share=: (untyped callable) -> untyped
79
+ def finalize!: () -> untyped
80
+ def finalized?: () -> bool
81
+ def group_mode: () -> untyped
82
+ def group_mode=: (untyped mode) -> untyped
83
+ def health_bind: () -> String
84
+ def health_bind=: (untyped) -> untyped
85
+ def health_port: () -> untyped
86
+ def health_port=: (untyped) -> untyped
87
+ def idempotency_ttl: () -> Numeric?
88
+ def idempotency_ttl=: (untyped value) -> untyped
89
+ def immediate_shutdown_grace: () -> Integer
90
+ def immediate_shutdown_grace=: (untyped) -> untyped
91
+ def insights_default_minutes: () -> Integer
92
+ def insights_default_minutes=: (untyped) -> untyped
93
+ def listen_notify: () -> bool
94
+ def listen_notify=: (untyped) -> untyped
95
+ def log_format: () -> Symbol
96
+ def log_format=: (untyped format) -> untyped
97
+ def logger: () -> untyped
98
+ def logger=: (untyped) -> untyped
99
+ def max_jobs_per_worker: () -> untyped
100
+ def max_jobs_per_worker=: (untyped) -> untyped
101
+ def max_memory_mb: () -> untyped
102
+ def max_memory_mb=: (untyped) -> untyped
103
+ def max_retries: () -> Integer
104
+ def max_retries=: (untyped) -> untyped
105
+ def max_worker_lifetime: () -> untyped
106
+ def max_worker_lifetime=: (untyped) -> untyped
107
+ def metrics_backend: () -> untyped
108
+ def metrics_backend=: (untyped) -> untyped
109
+ def metrics_enabled: () -> bool
110
+ def metrics_enabled=: (untyped) -> untyped
111
+ def notify_presence_change: (untyped stream_name, untyped change) -> untyped
112
+ def outbox_batch_size: () -> Integer
113
+ def outbox_batch_size=: (untyped) -> untyped
114
+ def outbox_enabled: () -> bool
115
+ def outbox_enabled=: (untyped) -> untyped
116
+ def outbox_poll_interval: () -> Float
117
+ def outbox_poll_interval=: (untyped) -> untyped
118
+ def outbox_retention: () -> Numeric?
119
+ def outbox_retention=: (untyped value) -> untyped
120
+ def pgmq_schema_mode: () -> Symbol
121
+ def pgmq_schema_mode=: (untyped mode) -> untyped
122
+ def polling_interval: () -> Float
123
+ def polling_interval=: (untyped) -> untyped
124
+ def pool_size: () -> untyped
125
+ def pool_size=: (untyped) -> untyped
126
+ def pool_timeout: () -> Integer
127
+ def pool_timeout=: (untyped) -> untyped
128
+ def prefetch_limit: () -> untyped
129
+ def prefetch_limit=: (untyped) -> untyped
130
+ def presence_member_for: (untyped context) -> untyped
131
+ def presence_min_ttl: () -> untyped
132
+ def presence_ttl_for: (untyped stream_name) -> untyped
133
+ def priority_levels: () -> untyped
134
+ def priority_levels=: (untyped) -> untyped
135
+ def priority_queue_name: (untyped name, untyped priority) -> untyped
136
+ def priority_queue_names: (untyped name) -> untyped
137
+ def processes_for: (untyped entry) -> untyped
138
+ def queue_name: (untyped name) -> untyped
139
+ def queue_prefix: () -> String
140
+ def queue_prefix=: (untyped) -> untyped
141
+ def read_ahead: () -> Integer
142
+ def read_ahead=: (untyped value) -> untyped
143
+ def read_ahead_for: (untyped entry) -> untyped
144
+ def read_timeout: () -> Integer
145
+ def read_timeout=: (untyped) -> untyped
146
+ def recurring_enabled: () -> bool
147
+ def recurring_enabled=: (untyped) -> untyped
148
+ def recurring_execution_retention: () -> Numeric?
149
+ def recurring_execution_retention=: (untyped value) -> untyped
150
+ def recurring_schedule_interval: () -> Float
151
+ def recurring_schedule_interval=: (untyped) -> untyped
152
+ def recurring_tasks: () -> untyped
153
+ def recurring_tasks=: (untyped) -> untyped
154
+ def recurring_tasks_file: () -> untyped
155
+ def recurring_tasks_file=: (untyped) -> untyped
156
+ def recurring_tasks_files: () -> untyped
157
+ def recurring_tasks_files=: (untyped) -> untyped
158
+ def recycle_limit_for: (untyped entry, untyped key) -> untyped
159
+ def require_primary: () -> bool
160
+ def require_primary=: (untyped) -> untyped
161
+ def resolved_pool_size: () -> untyped
162
+ def retry_backoff: () -> Integer
163
+ def retry_backoff=: (untyped) -> untyped
164
+ def retry_backoff_jitter: () -> Float
165
+ def retry_backoff_jitter=: (untyped) -> untyped
166
+ def retry_backoff_max: () -> Integer
167
+ def retry_backoff_max=: (untyped) -> untyped
168
+ def return_to_app_url: () -> untyped
169
+ def return_to_app_url=: (untyped) -> untyped
170
+ def role_enabled?: (untyped role) -> bool
171
+ def roles: () -> untyped
172
+ def roles=: (untyped value) -> untyped
173
+ def shutdown_timeout: () -> Integer
174
+ def shutdown_timeout=: (untyped) -> untyped
175
+ def skip_recurring: () -> untyped
176
+ def skip_recurring=: (untyped value) -> untyped
177
+ def stall_threshold: () -> Integer
178
+ def stall_threshold=: (untyped) -> untyped
179
+ def stats_enabled: () -> bool
180
+ def stats_enabled=: (untyped) -> untyped
181
+ def stats_flush_interval: () -> Integer
182
+ def stats_flush_interval=: (untyped) -> untyped
183
+ def stats_flush_size: () -> Integer
184
+ def stats_flush_size=: (untyped) -> untyped
185
+ def stats_retention: () -> Numeric?
186
+ def stats_retention=: (untyped value) -> untyped
187
+ def statsd_host: () -> String
188
+ def statsd_host=: (untyped) -> untyped
189
+ def statsd_port: () -> Integer
190
+ def statsd_port=: (untyped) -> untyped
191
+ def stream_durable?: (untyped name) -> bool
192
+ def stream_presence?: (untyped name) -> bool
193
+ def streams_application_name: () -> String
194
+ def streams_application_name=: (untyped) -> untyped
195
+ def streams_authorize: () -> untyped
196
+ def streams_authorize=: (untyped) -> untyped
197
+ def streams_broadcast_queue: () -> untyped
198
+ def streams_broadcast_queue=: (untyped) -> untyped
199
+ def streams_connection_options: () -> untyped
200
+ def streams_database_url: () -> untyped
201
+ def streams_database_url=: (untyped) -> untyped
202
+ def streams_default_broadcast_mode: () -> Symbol
203
+ def streams_default_broadcast_mode=: (untyped mode) -> untyped
204
+ def streams_default_retention: () -> Integer
205
+ def streams_default_retention=: (untyped) -> untyped
206
+ def streams_dispatch_queue_limit: () -> Integer
207
+ def streams_dispatch_queue_limit=: (untyped) -> untyped
208
+ def streams_durable_patterns: () -> Array[untyped]
209
+ def streams_durable_patterns=: (untyped) -> untyped
210
+ def streams_enabled: () -> bool
211
+ def streams_enabled=: (untyped) -> untyped
212
+ def streams_falcon_streaming_body: () -> bool
213
+ def streams_falcon_streaming_body=: (untyped) -> untyped
214
+ def streams_fanout_write_deadline_ms: () -> Integer
215
+ def streams_fanout_write_deadline_ms=: (untyped) -> untyped
216
+ def streams_heartbeat_interval: () -> Integer
217
+ def streams_heartbeat_interval=: (untyped) -> untyped
218
+ def streams_host: () -> untyped
219
+ def streams_host=: (untyped) -> untyped
220
+ def streams_idle_timeout: () -> Integer
221
+ def streams_idle_timeout=: (untyped) -> untyped
222
+ def streams_listen_health_check_ms: () -> Integer
223
+ def streams_listen_health_check_ms=: (untyped) -> untyped
224
+ def streams_listen_scope: () -> Symbol
225
+ def streams_listen_scope=: (untyped scope) -> untyped
226
+ def streams_max_connections: () -> Integer
227
+ def streams_max_connections=: (untyped) -> untyped
228
+ def streams_orphan_sweep_interval: () -> Integer
229
+ def streams_orphan_sweep_interval=: (untyped) -> untyped
230
+ def streams_orphan_threshold: () -> Integer
231
+ def streams_orphan_threshold=: (untyped) -> untyped
232
+ def streams_path: () -> untyped
233
+ def streams_path=: (untyped) -> untyped
234
+ def streams_peer_close_interval: () -> Float
235
+ def streams_peer_close_interval=: (untyped) -> untyped
236
+ def streams_pool_autoscale: () -> bool
237
+ def streams_pool_autoscale=: (untyped) -> untyped
238
+ def streams_pool_autoscale_interval: () -> Float
239
+ def streams_pool_autoscale_interval=: (untyped) -> untyped
240
+ def streams_pool_connection_options: () -> untyped
241
+ def streams_pool_database_url: () -> untyped
242
+ def streams_pool_database_url=: (untyped) -> untyped
243
+ def streams_pool_host: () -> untyped
244
+ def streams_pool_host=: (untyped) -> untyped
245
+ def streams_pool_max: () -> untyped
246
+ def streams_pool_max=: (untyped) -> untyped
247
+ def streams_pool_port: () -> untyped
248
+ def streams_pool_port=: (untyped) -> untyped
249
+ def streams_pool_size: () -> Integer
250
+ def streams_pool_size=: (untyped) -> untyped
251
+ def streams_pool_timeout: () -> Integer
252
+ def streams_pool_timeout=: (untyped) -> untyped
253
+ def streams_port: () -> untyped
254
+ def streams_port=: (untyped) -> untyped
255
+ def streams_presence_member: () -> untyped
256
+ def streams_presence_member=: (untyped) -> untyped
257
+ def streams_presence_on_change: () -> untyped
258
+ def streams_presence_on_change=: (untyped) -> untyped
259
+ def streams_presence_patterns: () -> Array[untyped]
260
+ def streams_presence_patterns=: (untyped) -> untyped
261
+ def streams_presence_ttl: () -> untyped
262
+ def streams_presence_ttl=: (untyped) -> untyped
263
+ def streams_retention: () -> Hash[untyped, untyped]
264
+ def streams_retention=: (untyped) -> untyped
265
+ def streams_signed_name_secret: () -> untyped
266
+ def streams_signed_name_secret=: (untyped) -> untyped
267
+ def streams_stats_enabled: () -> bool
268
+ def streams_stats_enabled=: (untyped) -> untyped
269
+ def streams_test_mode: () -> bool
270
+ def streams_test_mode=: (untyped) -> untyped
271
+ def streams_write_deadline_ms: () -> Integer
272
+ def streams_write_deadline_ms=: (untyped) -> untyped
273
+ def streams_writer_buffer_limit: () -> Integer
274
+ def streams_writer_buffer_limit=: (untyped) -> untyped
275
+ def streams_writer_threads: () -> Integer
276
+ def streams_writer_threads=: (untyped) -> untyped
277
+ def validate!: () -> untyped
278
+ def validate_capsule_processes!: () -> untyped
279
+ def validate_fair_share!: () -> untyped
280
+ def validate_job_path_gaps!: () -> untyped
281
+ def validate_metrics_backend!: () -> untyped
282
+ def validate_processes!: (untyped value) -> untyped
283
+ def validate_read_ahead!: () -> untyped
284
+ def validate_shutdown_timeout!: () -> untyped
285
+ def validate_streams!: () -> untyped
286
+ def validate_streams_autoscale!: () -> untyped
287
+ def validate_visibility_heartbeat!: () -> untyped
288
+ def visibility_heartbeat: () -> bool
289
+ def visibility_heartbeat=: (untyped) -> untyped
290
+ def visibility_heartbeat_interval: () -> Numeric?
291
+ def visibility_heartbeat_interval=: (untyped value) -> untyped
292
+ def visibility_timeout: () -> Numeric?
293
+ def visibility_timeout=: (untyped value) -> untyped
294
+ def warn_read_ahead_without_heartbeat: (untyped settings) -> untyped
295
+ def web_auth: () -> untyped
296
+ def web_auth=: (untyped) -> untyped
297
+ def web_data_source: () -> untyped
298
+ def web_data_source=: (untyped) -> untyped
299
+ def web_filter_parameters: () -> untyped
300
+ def web_filter_parameters=: (untyped) -> untyped
301
+ def web_filter_sensitive: () -> bool
302
+ def web_filter_sensitive=: (untyped) -> untyped
303
+ def web_live_updates: () -> bool
304
+ def web_live_updates=: (untyped) -> untyped
305
+ def web_per_page: () -> Integer
306
+ def web_per_page=: (untyped) -> untyped
307
+ def web_refresh_interval: () -> Integer
308
+ def web_refresh_interval=: (untyped) -> untyped
309
+ def worker_notify_connection_options: () -> untyped
310
+ def worker_notify_database_url: () -> untyped
311
+ def worker_notify_database_url=: (untyped) -> untyped
312
+ def worker_notify_host: () -> untyped
313
+ def worker_notify_host=: (untyped) -> untyped
314
+ def worker_notify_port: () -> untyped
315
+ def worker_notify_port=: (untyped) -> untyped
316
+ def worker_notify_scope: () -> Symbol
317
+ def worker_notify_scope=: (untyped scope) -> untyped
318
+ def worker_notify_wakeup: () -> untyped
319
+ def worker_notify_wakeup=: (untyped) -> untyped
320
+ def worker_notify_wakeup?: () -> bool
321
+ def workers: () -> Array[untyped]
322
+ def workers=: (untyped value) -> untyped
323
+ def zombie_detection: () -> bool
324
+ def zombie_detection=: (untyped) -> untyped
325
+ end
326
+ end
@@ -0,0 +1,25 @@
1
+ module Pgbus
2
+ module Streams
3
+ # A handle on one logical stream: Pgbus.stream(name).broadcast(html).
4
+ class Stream
5
+ # nil when a streamable's to_param returns nil (an unsaved record).
6
+ def self.name_from: (untyped streamables) -> String?
7
+ def self.validate_name_length!: (String name, untyped streamables) -> void
8
+
9
+ def initialize: (untyped streamables, ?client: Pgbus::Client, ?durable: bool) -> void
10
+ def name: () -> String
11
+ def durable?: () -> bool
12
+
13
+ # The msg_id when sent at once; nil when deferred to after_commit, or
14
+ # when coalesced.
15
+ def broadcast: (String payload, ?visible_to: Symbol?, ?durable: bool?, ?exclude: String?, ?event: String?,
16
+ ?coalesce: (bool | Numeric)?, ?target: String?) -> Integer?
17
+ def broadcast_render: (target: String, ?action: Symbol, ?renderable: untyped, ?visible_to: Symbol?, ?durable: bool?,
18
+ ?exclude: String?, ?event: String?, ?coalesce: (bool | Numeric)?) -> Integer?
19
+ def current_msg_id: () -> Integer
20
+ def read_after: (after_id: Integer, ?limit: Integer) -> Array[untyped]
21
+ def ensure!: () -> self
22
+ def presence: () -> untyped
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,22 @@
1
+ module Pgbus
2
+ # Streams: broadcasting rendered updates over PGMQ (Pgbus.stream).
3
+ module Streams
4
+ DEFAULT_SSE_EVENT: String
5
+
6
+ class StreamNameTooLong < ArgumentError
7
+ end
8
+
9
+ class PayloadTooLarge < Pgbus::Error
10
+ end
11
+
12
+ def self.filters: () -> untyped
13
+ def self.coalescer: () -> untyped
14
+ def self.reset_filters!: () -> untyped
15
+ def self.reset_coalescer!: () -> untyped
16
+
17
+ # The Turbo patches, installed by the engine when turbo-rails is loaded.
18
+ def self.install_turbo_broadcastable_patch!: () -> void
19
+ def self.install_turbo_stream_override!: () -> void
20
+ def self.install_broadcast_queue!: (String? queue_name) -> void
21
+ end
22
+ end
data/sig/pgbus.rbs ADDED
@@ -0,0 +1,73 @@
1
+ # The public surface of pgbus (issue #527). `bundle exec rbs validate` checks
2
+ # these files; spec/pgbus/rbs_spec.rb checks they cover the public methods.
3
+ module Pgbus
4
+ VERSION: String
5
+ DEAD_LETTER_SUFFIX: String
6
+ DATABASE_TASK_PREFIXES: Array[String]
7
+
8
+ class Error < StandardError
9
+ end
10
+
11
+ class ConfigurationError < Error
12
+ end
13
+
14
+ class SerializationError < Error
15
+ end
16
+
17
+ class QueueNotFoundError < Error
18
+ end
19
+
20
+ class DeadLetterError < Error
21
+ end
22
+
23
+ class ConcurrencyLimitExceeded < Error
24
+ end
25
+
26
+ class JobNotUnique < Error
27
+ end
28
+
29
+ class SchemaNotReady < Error
30
+ end
31
+
32
+ class ReadTimeoutError < Error
33
+ end
34
+
35
+ class EnqueueError < Error
36
+ end
37
+
38
+ class CurrentAttributesError < Error
39
+ end
40
+
41
+ class ExecutionPoolError < Error
42
+ end
43
+
44
+ class ConnectionCircuitOpenError < Error
45
+ end
46
+
47
+ module Process
48
+ class ReplicaConnectionError < Error
49
+ end
50
+ end
51
+
52
+ def self.configuration: () -> Configuration
53
+ def self.configure: () { (Configuration) -> void } -> Configuration
54
+ def self.finalize!: () -> Configuration
55
+ def self.client: () -> Client
56
+ def self.stream: (untyped streamables, ?durable: bool?) -> Streams::Stream
57
+ def self.stream_key: (*untyped parts, ?digest_bits: Integer) -> String
58
+ def self.stream_key!: (String key) -> String
59
+ def self.stream_name_budget: () -> Integer
60
+ # delay: seconds, as a Numeric or an ActiveSupport::Duration (1.hour).
61
+ def self.publish: (String routing_key, untyped payload, ?headers: Hash[String, untyped]?, ?delay: Numeric | _ToI) -> untyped
62
+ def self.publish_later: (String routing_key, untyped payload, delay: Numeric | _ToI, ?headers: Hash[String, untyped]?) -> untyped
63
+ def self.reset!: () -> void
64
+ def self.reset_client!: () -> void
65
+ def self.stopping: () -> bool
66
+ def self.stopping=: (boolish value) -> bool
67
+ def self.logger: () -> untyped
68
+ def self.logger=: (untyped value) -> untyped
69
+ def self.database_task?: () -> bool
70
+ def self.loader: () -> untyped
71
+ def self.models_loader: () -> untyped
72
+ def self.teardown_models_loader!: () -> void
73
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pgbus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.2
4
+ version: 0.19.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson
@@ -134,6 +134,7 @@ files:
134
134
  - app/controllers/pgbus/batches_controller.rb
135
135
  - app/controllers/pgbus/dashboard_controller.rb
136
136
  - app/controllers/pgbus/dead_letter_controller.rb
137
+ - app/controllers/pgbus/deploy_tasks_controller.rb
137
138
  - app/controllers/pgbus/events_controller.rb
138
139
  - app/controllers/pgbus/frontends_controller.rb
139
140
  - app/controllers/pgbus/insights_controller.rb
@@ -159,6 +160,7 @@ files:
159
160
  - app/helpers/pgbus/application_helper.rb
160
161
  - app/helpers/pgbus/button_helper.rb
161
162
  - app/helpers/pgbus/dashboard_helper.rb
163
+ - app/helpers/pgbus/deploy_tasks_helper.rb
162
164
  - app/helpers/pgbus/events_helper.rb
163
165
  - app/helpers/pgbus/insights_helper.rb
164
166
  - app/helpers/pgbus/processes_helper.rb
@@ -167,6 +169,8 @@ files:
167
169
  - app/models/pgbus/batch_entry.rb
168
170
  - app/models/pgbus/batch_execution.rb
169
171
  - app/models/pgbus/blocked_execution.rb
172
+ - app/models/pgbus/deploy_task.rb
173
+ - app/models/pgbus/deploy_task_run.rb
170
174
  - app/models/pgbus/job_stat.rb
171
175
  - app/models/pgbus/outbox_entry.rb
172
176
  - app/models/pgbus/process_entry.rb
@@ -194,6 +198,10 @@ files:
194
198
  - app/views/pgbus/dead_letter/_row.html.erb
195
199
  - app/views/pgbus/dead_letter/index.html.erb
196
200
  - app/views/pgbus/dead_letter/show.html.erb
201
+ - app/views/pgbus/deploy_tasks/_rollover_banner.html.erb
202
+ - app/views/pgbus/deploy_tasks/_tasks_table.html.erb
203
+ - app/views/pgbus/deploy_tasks/index.html.erb
204
+ - app/views/pgbus/deploy_tasks/show.html.erb
197
205
  - app/views/pgbus/events/_list.html.erb
198
206
  - app/views/pgbus/events/_processed_table.html.erb
199
207
  - app/views/pgbus/events/_replay.html.erb
@@ -246,6 +254,7 @@ files:
246
254
  - lib/active_job/queue_adapters/pgbus_adapter.rb
247
255
  - lib/generators/pgbus/add_batch_callback_jobs_generator.rb
248
256
  - lib/generators/pgbus/add_batch_executions_generator.rb
257
+ - lib/generators/pgbus/add_deploy_tasks_generator.rb
249
258
  - lib/generators/pgbus/add_failed_events_index_generator.rb
250
259
  - lib/generators/pgbus/add_job_stats_generator.rb
251
260
  - lib/generators/pgbus/add_job_stats_latency_generator.rb
@@ -264,6 +273,7 @@ files:
264
273
  - lib/generators/pgbus/migration_path.rb
265
274
  - lib/generators/pgbus/templates/add_batch_callback_jobs.rb.erb
266
275
  - lib/generators/pgbus/templates/add_batch_executions.rb.erb
276
+ - lib/generators/pgbus/templates/add_deploy_tasks_tables.rb.erb
267
277
  - lib/generators/pgbus/templates/add_failed_events_unique_index.rb.erb
268
278
  - lib/generators/pgbus/templates/add_job_stats.rb.erb
269
279
  - lib/generators/pgbus/templates/add_job_stats_latency.rb.erb
@@ -277,6 +287,7 @@ files:
277
287
  - lib/generators/pgbus/templates/add_stream_queues.rb.erb
278
288
  - lib/generators/pgbus/templates/add_stream_stats.rb.erb
279
289
  - lib/generators/pgbus/templates/add_uniqueness_keys.rb.erb
290
+ - lib/generators/pgbus/templates/deploy_tasks.yml.erb
280
291
  - lib/generators/pgbus/templates/initializer.rb.erb
281
292
  - lib/generators/pgbus/templates/migrate_job_locks_to_uniqueness_keys.rb.erb
282
293
  - lib/generators/pgbus/templates/migration.rb.erb
@@ -315,6 +326,7 @@ files:
315
326
  - lib/pgbus/concurrency/semaphore.rb
316
327
  - lib/pgbus/configuration.rb
317
328
  - lib/pgbus/configuration/capsule_dsl.rb
329
+ - lib/pgbus/configuration/deploy_settings.rb
318
330
  - lib/pgbus/configuration/presence_settings.rb
319
331
  - lib/pgbus/configuration/stream_authorization.rb
320
332
  - lib/pgbus/current_attributes.rb
@@ -322,6 +334,10 @@ files:
322
334
  - lib/pgbus/dead_letter_header.rb
323
335
  - lib/pgbus/dedicated_connection.rb
324
336
  - lib/pgbus/dedup_cache.rb
337
+ - lib/pgbus/deploy/revision.rb
338
+ - lib/pgbus/deploy/rollover.rb
339
+ - lib/pgbus/deploy/runner.rb
340
+ - lib/pgbus/deploy/task.rb
325
341
  - lib/pgbus/doctor.rb
326
342
  - lib/pgbus/engine.rb
327
343
  - lib/pgbus/error_reporter.rb
@@ -357,6 +373,7 @@ files:
357
373
  - lib/pgbus/mcp/runner.rb
358
374
  - lib/pgbus/mcp/server.rb
359
375
  - lib/pgbus/mcp/tools/concurrency_tool.rb
376
+ - lib/pgbus/mcp/tools/deploy_tasks_tool.rb
360
377
  - lib/pgbus/mcp/tools/dlq_detail_tool.rb
361
378
  - lib/pgbus/mcp/tools/dlq_tool.rb
362
379
  - lib/pgbus/mcp/tools/health_tool.rb
@@ -414,6 +431,7 @@ files:
414
431
  - lib/pgbus/retry_backoff.rb
415
432
  - lib/pgbus/ruby_jit.rb
416
433
  - lib/pgbus/serializer.rb
434
+ - lib/pgbus/shareable.rb
417
435
  - lib/pgbus/stat_buffer.rb
418
436
  - lib/pgbus/streams.rb
419
437
  - lib/pgbus/streams/broadcast_opts.rb
@@ -446,12 +464,14 @@ files:
446
464
  - lib/pgbus/web/data_source.rb
447
465
  - lib/pgbus/web/data_source/dashboard_signals.rb
448
466
  - lib/pgbus/web/data_source/dead_letter.rb
467
+ - lib/pgbus/web/data_source/deploy_task_list.rb
449
468
  - lib/pgbus/web/data_source/event_list.rb
450
469
  - lib/pgbus/web/data_source/job_list.rb
451
470
  - lib/pgbus/web/data_source/list_counts.rb
452
471
  - lib/pgbus/web/data_source/process_list.rb
453
472
  - lib/pgbus/web/data_source/queue_summary.rb
454
473
  - lib/pgbus/web/dead_letter_reason.rb
474
+ - lib/pgbus/web/deploy_task_state.rb
455
475
  - lib/pgbus/web/event_state.rb
456
476
  - lib/pgbus/web/health_app.rb
457
477
  - lib/pgbus/web/health_server.rb
@@ -490,6 +510,12 @@ files:
490
510
  - lib/tasks/pgbus_pgmq.rake
491
511
  - lib/tasks/pgbus_queues.rake
492
512
  - lib/tasks/pgbus_streams.rake
513
+ - sig/pgbus.rbs
514
+ - sig/pgbus/active_job/adapter.rbs
515
+ - sig/pgbus/client.rbs
516
+ - sig/pgbus/configuration.rbs
517
+ - sig/pgbus/streams.rbs
518
+ - sig/pgbus/streams/stream.rbs
493
519
  homepage: https://github.com/zoolutions/pgbus
494
520
  licenses:
495
521
  - MIT