kaal 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +60 -25
  3. data/config/kaal.yml +12 -0
  4. data/lib/kaal/active_record_support.rb +2 -2
  5. data/lib/kaal/backend/adapter.rb +8 -0
  6. data/lib/kaal/backend/memory_adapter.rb +5 -0
  7. data/lib/kaal/backend/mysql.rb +25 -3
  8. data/lib/kaal/backend/postgres.rb +6 -2
  9. data/lib/kaal/backend/redis_adapter.rb +5 -0
  10. data/lib/kaal/backend/sqlite.rb +4 -0
  11. data/lib/kaal/cli.rb +38 -33
  12. data/lib/kaal/config/backend_factory.rb +178 -0
  13. data/lib/kaal/config/configuration.rb +98 -9
  14. data/lib/kaal/config/delayed_job_security_policy.rb +60 -0
  15. data/lib/kaal/config/file_loader.rb +187 -0
  16. data/lib/kaal/config.rb +3 -0
  17. data/lib/kaal/core/coordinator.rb +68 -19
  18. data/lib/kaal/delayed_job/database_engine.rb +116 -0
  19. data/lib/kaal/delayed_job/dispatch_failure_logger.rb +31 -0
  20. data/lib/kaal/delayed_job/memory_engine.rb +79 -0
  21. data/lib/kaal/delayed_job/mysql_version_support.rb +43 -0
  22. data/lib/kaal/delayed_job/redis_engine.rb +119 -0
  23. data/lib/kaal/delayed_job/registry.rb +39 -0
  24. data/lib/kaal/internal/active_record/database_backend.rb +5 -0
  25. data/lib/kaal/internal/active_record/delayed_job_record.rb +16 -0
  26. data/lib/kaal/internal/active_record/delayed_job_registry.rb +119 -0
  27. data/lib/kaal/internal/active_record/migration_templates.rb +33 -3
  28. data/lib/kaal/internal/active_record/mysql_backend.rb +23 -5
  29. data/lib/kaal/internal/active_record/postgres_backend.rb +4 -0
  30. data/lib/kaal/internal/active_record.rb +2 -0
  31. data/lib/kaal/internal/sequel/database_backend.rb +5 -0
  32. data/lib/kaal/internal/sequel/mysql_backend.rb +15 -1
  33. data/lib/kaal/internal/sequel/postgres_backend.rb +4 -0
  34. data/lib/kaal/internal/sequel.rb +1 -0
  35. data/lib/kaal/job_dispatcher.rb +108 -0
  36. data/lib/kaal/persistence/database.rb +4 -0
  37. data/lib/kaal/persistence/migration_templates.rb +35 -3
  38. data/lib/kaal/runtime/scheduler_boot_loader.rb +3 -1
  39. data/lib/kaal/scheduler_file/job_applier.rb +28 -53
  40. data/lib/kaal/scheduler_file/loader.rb +1 -1
  41. data/lib/kaal/sequel_support.rb +2 -2
  42. data/lib/kaal/version.rb +1 -1
  43. data/lib/kaal.rb +118 -0
  44. data/sig/00_types.rbs +12 -0
  45. data/sig/dependencies.rbs +49 -0
  46. data/sig/kaal/active_record_support.rbs +23 -0
  47. data/sig/kaal/backend/adapter.rbs +26 -0
  48. data/sig/kaal/backend/dispatch_attempt_logger.rbs +17 -0
  49. data/sig/kaal/backend/dispatch_logging.rbs +23 -0
  50. data/sig/kaal/backend/dispatch_registry_accessor.rbs +17 -0
  51. data/sig/kaal/backend/memory_adapter.rbs +33 -0
  52. data/sig/kaal/backend/mysql.rbs +25 -0
  53. data/sig/kaal/backend/postgres.rbs +19 -0
  54. data/sig/kaal/backend/redis_adapter.rbs +41 -0
  55. data/sig/kaal/backend/sqlite.rbs +19 -0
  56. data/sig/kaal/cli.rbs +41 -0
  57. data/sig/kaal/config/backend_factory.rbs +41 -0
  58. data/sig/kaal/config/configuration.rbs +70 -0
  59. data/sig/kaal/config/delayed_job_security_policy.rbs +19 -0
  60. data/sig/kaal/config/file_loader.rbs +35 -0
  61. data/sig/kaal/config/scheduler_config_error.rbs +4 -0
  62. data/sig/kaal/config/scheduler_time_zone_resolver.rbs +19 -0
  63. data/sig/kaal/config.rbs +11 -0
  64. data/sig/kaal/core/coordinator.rbs +103 -0
  65. data/sig/kaal/core/enabled_entry_enumerator.rbs +21 -0
  66. data/sig/kaal/core/occurrence_finder.rbs +9 -0
  67. data/sig/kaal/core.rbs +9 -0
  68. data/sig/kaal/definition/database_engine.rbs +25 -0
  69. data/sig/kaal/definition/memory_engine.rbs +23 -0
  70. data/sig/kaal/definition/persistence_helpers.rbs +9 -0
  71. data/sig/kaal/definition/redis_engine.rbs +33 -0
  72. data/sig/kaal/definition/registry.rbs +29 -0
  73. data/sig/kaal/definitions/registration_service.rbs +27 -0
  74. data/sig/kaal/definitions/registry_accessor.rbs +17 -0
  75. data/sig/kaal/delayed_job/database_engine.rbs +37 -0
  76. data/sig/kaal/delayed_job/dispatch_failure_logger.rbs +7 -0
  77. data/sig/kaal/delayed_job/memory_engine.rbs +29 -0
  78. data/sig/kaal/delayed_job/mysql_version_support.rbs +15 -0
  79. data/sig/kaal/delayed_job/redis_engine.rbs +31 -0
  80. data/sig/kaal/delayed_job/registry.rbs +20 -0
  81. data/sig/kaal/dispatch/database_engine.rbs +39 -0
  82. data/sig/kaal/dispatch/memory_engine.rbs +23 -0
  83. data/sig/kaal/dispatch/redis_engine.rbs +25 -0
  84. data/sig/kaal/dispatch/registry.rbs +11 -0
  85. data/sig/kaal/internal/active_record/base_record.rbs +8 -0
  86. data/sig/kaal/internal/active_record/connection_support.rbs +25 -0
  87. data/sig/kaal/internal/active_record/database_backend.rbs +37 -0
  88. data/sig/kaal/internal/active_record/definition_record.rbs +8 -0
  89. data/sig/kaal/internal/active_record/definition_registry.rbs +27 -0
  90. data/sig/kaal/internal/active_record/delayed_job_record.rbs +8 -0
  91. data/sig/kaal/internal/active_record/delayed_job_registry.rbs +39 -0
  92. data/sig/kaal/internal/active_record/dispatch_record.rbs +8 -0
  93. data/sig/kaal/internal/active_record/dispatch_registry.rbs +43 -0
  94. data/sig/kaal/internal/active_record/lock_record.rbs +8 -0
  95. data/sig/kaal/internal/active_record/migration_templates.rbs +17 -0
  96. data/sig/kaal/internal/active_record/mysql_backend.rbs +45 -0
  97. data/sig/kaal/internal/active_record/postgres_backend.rbs +41 -0
  98. data/sig/kaal/internal/active_record.rbs +0 -0
  99. data/sig/kaal/internal/sequel/database_backend.rbs +39 -0
  100. data/sig/kaal/internal/sequel/mysql_backend.rbs +47 -0
  101. data/sig/kaal/internal/sequel/postgres_backend.rbs +43 -0
  102. data/sig/kaal/internal/sequel.rbs +0 -0
  103. data/sig/kaal/job_dispatcher.rbs +19 -0
  104. data/sig/kaal/persistence/database.rbs +19 -0
  105. data/sig/kaal/persistence/migration_templates.rbs +15 -0
  106. data/sig/kaal/register_conflict_support.rbs +11 -0
  107. data/sig/kaal/registry.rbs +44 -0
  108. data/sig/kaal/runtime/runtime_context.rbs +23 -0
  109. data/sig/kaal/runtime/scheduler_boot_loader.rbs +23 -0
  110. data/sig/kaal/runtime/signal_handler_chain.rbs +19 -0
  111. data/sig/kaal/runtime/signal_handler_installer.rbs +19 -0
  112. data/sig/kaal/runtime.rbs +11 -0
  113. data/sig/kaal/scheduler_file/hash_transform.rbs +9 -0
  114. data/sig/kaal/scheduler_file/helper_bundle.rbs +15 -0
  115. data/sig/kaal/scheduler_file/job_applier.rbs +43 -0
  116. data/sig/kaal/scheduler_file/job_normalizer.rbs +27 -0
  117. data/sig/kaal/scheduler_file/loader.rbs +69 -0
  118. data/sig/kaal/scheduler_file/payload_loader.rbs +33 -0
  119. data/sig/kaal/scheduler_file/placeholder_support.rbs +19 -0
  120. data/sig/kaal/scheduler_file.rbs +9 -0
  121. data/sig/kaal/sequel_support.rbs +25 -0
  122. data/sig/kaal/support/hash_tools.rbs +27 -0
  123. data/sig/kaal/utils/cron_humanizer.rbs +39 -0
  124. data/sig/kaal/utils/cron_utils.rbs +43 -0
  125. data/sig/kaal/utils/idempotency_key_generator.rbs +5 -0
  126. data/sig/kaal/utils.rbs +9 -0
  127. data/sig/kaal/version.rbs +3 -0
  128. data/sig/kaal.rbs +145 -0
  129. metadata +100 -3
  130. data/config/kaal.rb +0 -15
  131. /data/config/{scheduler.yml → kaal-scheduler.yml} +0 -0
@@ -0,0 +1,29 @@
1
+ module Kaal
2
+ module Definition
3
+ module AttributeHelpers
4
+ def self.definition_attributes: (Kaal::rbs_any definition) -> { key: Kaal::rbs_any, cron: Kaal::rbs_any, source: Kaal::rbs_any, metadata: Kaal::rbs_any }
5
+
6
+ def self.persisted_definition_attributes: (Kaal::rbs_any definition) -> (::Hash[Kaal::rbs_any, Kaal::rbs_any] | { enabled: Kaal::rbs_any, metadata: Kaal::rbs_any })
7
+ end
8
+
9
+ class Registry
10
+ def upsert_definition: (**Kaal::rbs_any) -> Kaal::rbs_any
11
+
12
+ def remove_definition: (Kaal::rbs_any _key) -> Kaal::rbs_any
13
+
14
+ def find_definition: (Kaal::rbs_any _key) -> Kaal::rbs_any
15
+
16
+ def all_definitions: () -> Kaal::rbs_any
17
+
18
+ def enabled_definitions: () -> Kaal::rbs_any
19
+
20
+ def enable_definition: (Kaal::rbs_any key) -> Kaal::rbs_any
21
+
22
+ def disable_definition: (Kaal::rbs_any key) -> Kaal::rbs_any
23
+
24
+ private
25
+
26
+ def update_definition_enabled_state: (Kaal::rbs_any key, enabled: Kaal::rbs_any) -> (nil | Kaal::rbs_any)
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,27 @@
1
+ module Kaal
2
+ module Definitions
3
+ class RegistrationService
4
+ @configuration: Kaal::rbs_any
5
+
6
+ @definition_registry: Kaal::rbs_any
7
+
8
+ @registry: Kaal::rbs_any
9
+
10
+ include RegisterConflictSupport
11
+
12
+ attr_reader configuration: Kaal::rbs_any
13
+
14
+ attr_reader definition_registry: Kaal::rbs_any
15
+
16
+ attr_reader registry: Kaal::rbs_any
17
+
18
+ def initialize: (configuration: Kaal::rbs_any, definition_registry: Kaal::rbs_any, registry: Kaal::rbs_any) -> void
19
+
20
+ def call: (key: Kaal::rbs_any, cron: Kaal::rbs_any, enqueue: Kaal::rbs_any) -> Kaal::rbs_any
21
+
22
+ private
23
+
24
+ def rollback_registered_definition: (Kaal::rbs_any key, Kaal::rbs_any existing_definition) -> (Kaal::rbs_any | Kaal::rbs_any | nil)
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,17 @@
1
+ module Kaal
2
+ module Definitions
3
+ class RegistryAccessor
4
+ @configuration: Kaal::rbs_any
5
+
6
+ @fallback_registry_provider: Kaal::rbs_any
7
+
8
+ def initialize: (configuration: Kaal::rbs_any, fallback_registry_provider: Kaal::rbs_any) -> void
9
+
10
+ def call: () -> Kaal::rbs_any
11
+
12
+ private
13
+
14
+ def fallback_registry: () -> Kaal::rbs_any
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,37 @@
1
+ module Kaal
2
+ module DelayedJob
3
+ class DatabaseEngine < Registry
4
+ @database: Kaal::rbs_any
5
+
6
+ @use_skip_locked: Kaal::rbs_any
7
+
8
+ def initialize: (database: Kaal::rbs_any, ?use_skip_locked: bool) -> void
9
+
10
+ def enqueue: (job_id: Kaal::rbs_any, run_at: Kaal::rbs_any, job_class: Kaal::rbs_any, args: Kaal::rbs_any, ?queue: Kaal::rbs_any?, ?connection: Kaal::rbs_any?) -> Kaal::rbs_any
11
+
12
+ def pop_due: (now: Kaal::rbs_any, limit: Kaal::rbs_any) -> Kaal::rbs_any
13
+
14
+ def find_job: (Kaal::rbs_any job_id, ?connection: Kaal::rbs_any) -> Kaal::rbs_any
15
+
16
+ def all_jobs: () -> Kaal::rbs_any
17
+
18
+ def claim_strategy: () -> (:skip_locked | :delete_confirmation)
19
+
20
+ def self.normalize_row: (Kaal::rbs_any row) -> Kaal::rbs_any
21
+
22
+ private
23
+
24
+ def pop_due_with_skip_locked: (now: Kaal::rbs_any, limit: Kaal::rbs_any) -> Kaal::rbs_any
25
+
26
+ def pop_due_with_delete_confirmation: (now: Kaal::rbs_any, limit: Kaal::rbs_any) -> Kaal::rbs_any
27
+
28
+ def self.parse_args: (Kaal::rbs_any args_payload) -> Kaal::rbs_any
29
+
30
+ def dataset_for: (Kaal::rbs_any connection) -> Kaal::rbs_any
31
+
32
+ def dataset: () -> Kaal::rbs_any
33
+
34
+ def connection: () -> Kaal::rbs_any
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,7 @@
1
+ module Kaal
2
+ module DelayedJob
3
+ module DispatchFailureLogger
4
+ def self.log_claimed_dispatch_failure: (logger: Kaal::rbs_any, job: Kaal::rbs_any, error: Kaal::rbs_any) -> (nil | Kaal::rbs_any)
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,29 @@
1
+ module Kaal
2
+ module DelayedJob
3
+ class MemoryEngine < Registry
4
+ @jobs: Kaal::rbs_any
5
+
6
+ @mutex: Kaal::rbs_any
7
+
8
+ include Kaal::Support::HashTools
9
+
10
+ def initialize: () -> void
11
+
12
+ def enqueue: (job_id: Kaal::rbs_any, run_at: Kaal::rbs_any, job_class: Kaal::rbs_any, args: Kaal::rbs_any, ?queue: Kaal::rbs_any?, **Kaal::rbs_any) -> Kaal::rbs_any
13
+
14
+ def pop_due: (now: Kaal::rbs_any, limit: Kaal::rbs_any) -> Kaal::rbs_any
15
+
16
+ def find_job: (Kaal::rbs_any job_id) -> Kaal::rbs_any
17
+
18
+ def all_jobs: () -> Kaal::rbs_any
19
+
20
+ def clear: () -> Kaal::rbs_any
21
+
22
+ def claim_strategy: () -> :atomic_pop
23
+
24
+ private
25
+
26
+ def build_job: (job_id: Kaal::rbs_any, run_at: Kaal::rbs_any, job_class: Kaal::rbs_any, args: Kaal::rbs_any, queue: Kaal::rbs_any) -> { job_id: Kaal::rbs_any, run_at: Kaal::rbs_any, job_class: Kaal::rbs_any, args: Kaal::rbs_any, queue: Kaal::rbs_any, created_at: Kaal::rbs_any }
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,15 @@
1
+ module Kaal
2
+ module DelayedJob
3
+ module MySQLVersionSupport
4
+ MINIMUM_SKIP_LOCKED_VERSION: 80000
5
+
6
+ def self.skip_locked_supported?: (Kaal::rbs_any version_string) -> Kaal::rbs_any
7
+
8
+ def self.version_number: (Kaal::rbs_any version_string) -> (0 | Kaal::rbs_any)
9
+
10
+ def self.version_components: (Kaal::rbs_any version_string) -> ::Array[Kaal::rbs_any]
11
+
12
+ def self.integer_prefix: (Kaal::rbs_any value) -> (nil | Kaal::rbs_any)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,31 @@
1
+ module Kaal
2
+ module DelayedJob
3
+ class RedisEngine < Registry
4
+ @redis: Kaal::rbs_any
5
+
6
+ @namespace: Kaal::rbs_any
7
+
8
+ def initialize: (Kaal::rbs_any redis, ?namespace: ::String) -> void
9
+
10
+ def enqueue: (job_id: Kaal::rbs_any, run_at: Kaal::rbs_any, job_class: Kaal::rbs_any, args: Kaal::rbs_any, ?queue: Kaal::rbs_any?, **Kaal::rbs_any) -> Kaal::rbs_any
11
+
12
+ def pop_due: (now: Kaal::rbs_any, limit: Kaal::rbs_any) -> Kaal::rbs_any
13
+
14
+ def find_job: (Kaal::rbs_any job_id) -> Kaal::rbs_any
15
+
16
+ def all_jobs: () -> Kaal::rbs_any
17
+
18
+ def claim_strategy: () -> :atomic_pop
19
+
20
+ def self.deserialize: (Kaal::rbs_any raw) -> Kaal::rbs_any
21
+
22
+ def self.parse_time: (Kaal::rbs_any value) -> Kaal::rbs_any
23
+
24
+ private
25
+
26
+ def payloads_key: () -> ::String
27
+
28
+ def schedule_key: () -> ::String
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,20 @@
1
+ module Kaal
2
+ module DelayedJob
3
+ class DuplicateJobError < StandardError
4
+ end
5
+
6
+ class Registry
7
+ def enqueue: (**Kaal::rbs_any) -> Kaal::rbs_any
8
+
9
+ def pop_due: (**Kaal::rbs_any) -> Kaal::rbs_any
10
+
11
+ def find_job: (Kaal::rbs_any _job_id) -> Kaal::rbs_any
12
+
13
+ def all_jobs: () -> Kaal::rbs_any
14
+
15
+ def claim_strategy: () -> Kaal::rbs_any
16
+
17
+ def requires_dispatch_lock?: () -> false
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,39 @@
1
+ module Kaal
2
+ module Dispatch
3
+ class DatabaseEngine < Registry
4
+ @database: Kaal::rbs_any
5
+
6
+ @namespace: Kaal::rbs_any
7
+
8
+ def initialize: (database: Kaal::rbs_any, ?namespace: Kaal::rbs_any?) -> void
9
+
10
+ def log_dispatch: (Kaal::rbs_any key, Kaal::rbs_any fire_time, Kaal::rbs_any node_id, ?::String status) -> Kaal::rbs_any
11
+
12
+ def find_dispatch: (Kaal::rbs_any key, Kaal::rbs_any fire_time) -> Kaal::rbs_any
13
+
14
+ def find_by_key: (Kaal::rbs_any key) -> Kaal::rbs_any
15
+
16
+ def find_by_node: (Kaal::rbs_any node_id) -> Kaal::rbs_any
17
+
18
+ def find_by_status: (Kaal::rbs_any status) -> Kaal::rbs_any
19
+
20
+ def cleanup: (?recovery_window: ::Integer) -> Kaal::rbs_any
21
+
22
+ def self.normalize_row: (Kaal::rbs_any row, ?namespace: Kaal::rbs_any?) -> (nil | { key: Kaal::rbs_any, fire_time: Kaal::rbs_any, dispatched_at: Kaal::rbs_any, node_id: Kaal::rbs_any, status: Kaal::rbs_any })
23
+
24
+ def self.strip_namespace: (Kaal::rbs_any key, namespace: Kaal::rbs_any) -> Kaal::rbs_any
25
+
26
+ private
27
+
28
+ def dataset: () -> Kaal::rbs_any
29
+
30
+ def namespaced_key: (Kaal::rbs_any key) -> (Kaal::rbs_any | ::String)
31
+
32
+ def query: (Kaal::rbs_any filters) -> Kaal::rbs_any
33
+
34
+ def query_dataset: (Kaal::rbs_any filters) -> Kaal::rbs_any
35
+
36
+ def cleanup_dataset: () -> Kaal::rbs_any
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,23 @@
1
+ module Kaal
2
+ module Dispatch
3
+ class MemoryEngine < Registry
4
+ @dispatches: Kaal::rbs_any
5
+
6
+ @mutex: Kaal::rbs_any
7
+
8
+ def initialize: () -> void
9
+
10
+ def log_dispatch: (Kaal::rbs_any key, Kaal::rbs_any fire_time, Kaal::rbs_any node_id, ?::String status) -> Kaal::rbs_any
11
+
12
+ def find_dispatch: (Kaal::rbs_any key, Kaal::rbs_any fire_time) -> Kaal::rbs_any
13
+
14
+ def clear: () -> Kaal::rbs_any
15
+
16
+ def size: () -> Kaal::rbs_any
17
+
18
+ private
19
+
20
+ def build_key: (Kaal::rbs_any key, Kaal::rbs_any fire_time) -> ::String
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,25 @@
1
+ module Kaal
2
+ module Dispatch
3
+ class RedisEngine < Registry
4
+ @redis: Kaal::rbs_any
5
+
6
+ @namespace: Kaal::rbs_any
7
+
8
+ @ttl: Kaal::rbs_any
9
+
10
+ DEFAULT_TTL: Kaal::rbs_any
11
+
12
+ def initialize: (Kaal::rbs_any redis, ?namespace: ::String, ?ttl: Kaal::rbs_any) -> void
13
+
14
+ def log_dispatch: (Kaal::rbs_any key, Kaal::rbs_any fire_time, Kaal::rbs_any node_id, ?::String status) -> Kaal::rbs_any
15
+
16
+ def find_dispatch: (Kaal::rbs_any key, Kaal::rbs_any fire_time) -> (nil | Kaal::rbs_any)
17
+
18
+ private
19
+
20
+ def build_redis_key: (Kaal::rbs_any key, Kaal::rbs_any fire_time) -> ::String
21
+
22
+ def convert_timestamps: (Kaal::rbs_any record) -> Kaal::rbs_any
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,11 @@
1
+ module Kaal
2
+ module Dispatch
3
+ class Registry
4
+ def log_dispatch: (Kaal::rbs_any _key, Kaal::rbs_any _fire_time, Kaal::rbs_any _node_id, ?::String _status) -> Kaal::rbs_any
5
+
6
+ def find_dispatch: (Kaal::rbs_any _key, Kaal::rbs_any _fire_time) -> Kaal::rbs_any
7
+
8
+ def dispatched?: (Kaal::rbs_any key, Kaal::rbs_any fire_time) -> (true | false)
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,8 @@
1
+ module Kaal
2
+ module Internal
3
+ module ActiveRecord
4
+ class BaseRecord < ::ActiveRecord::Base
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,25 @@
1
+ module Kaal
2
+ module Internal
3
+ module ActiveRecord
4
+ module ConnectionSupport
5
+ CONFIGURE_MUTEX: Kaal::rbs_any
6
+
7
+ def self.configure!: (?Kaal::rbs_any? connection) -> Kaal::rbs_any
8
+
9
+ def self.normalize_connection_config: (Kaal::rbs_any connection) -> Kaal::rbs_any
10
+
11
+ def self.current_connection_config: () -> Kaal::rbs_any
12
+
13
+ def self.extract_connection_config: (Kaal::rbs_any connection) -> Kaal::rbs_any
14
+
15
+ def self.normalize_connection_value: (Kaal::rbs_any key, Kaal::rbs_any value) -> Kaal::rbs_any
16
+
17
+ def self.integer_like?: (Kaal::rbs_any value) -> Kaal::rbs_any
18
+
19
+ def self.configs_match?: (Kaal::rbs_any current_config, Kaal::rbs_any target_config) -> (true | Kaal::rbs_any)
20
+
21
+ def self.connection_active?: () -> Kaal::rbs_any
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,37 @@
1
+ module Kaal
2
+ module Internal
3
+ module ActiveRecord
4
+ class DatabaseBackend < Kaal::Backend::Adapter
5
+ @lock_model: Kaal::rbs_any
6
+
7
+ @dispatch_registry: Kaal::rbs_any
8
+
9
+ @definition_registry: Kaal::rbs_any
10
+
11
+ @namespace: Kaal::rbs_any
12
+
13
+ @delayed_store: Kaal::rbs_any
14
+
15
+ include Kaal::Backend::DispatchLogging
16
+
17
+ def initialize: (?Kaal::rbs_any? connection, ?lock_model: Kaal::rbs_any, ?dispatch_registry: Kaal::rbs_any?, ?definition_registry: Kaal::rbs_any?, ?namespace: Kaal::rbs_any?) -> void
18
+
19
+ def dispatch_registry: () -> Kaal::rbs_any
20
+
21
+ def definition_registry: () -> Kaal::rbs_any
22
+
23
+ def delayed_store: () -> Kaal::rbs_any
24
+
25
+ def acquire: (Kaal::rbs_any key, Kaal::rbs_any ttl) -> Kaal::rbs_any
26
+
27
+ def release: (Kaal::rbs_any key) -> Kaal::rbs_any
28
+
29
+ def cleanup_expired_locks: () -> Kaal::rbs_any
30
+
31
+ private
32
+
33
+ def resolved_namespace: () -> Kaal::rbs_any
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,8 @@
1
+ module Kaal
2
+ module Internal
3
+ module ActiveRecord
4
+ class DefinitionRecord < BaseRecord
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,27 @@
1
+ module Kaal
2
+ module Internal
3
+ module ActiveRecord
4
+ class DefinitionRegistry < Kaal::Definition::Registry
5
+ @model: Kaal::rbs_any
6
+
7
+ def initialize: (?connection: Kaal::rbs_any?, ?model: Kaal::rbs_any) -> void
8
+
9
+ def upsert_definition: (key: Kaal::rbs_any, cron: Kaal::rbs_any, ?enabled: bool, ?source: ::String, ?metadata: ::Hash[Kaal::rbs_any, Kaal::rbs_any]) -> Kaal::rbs_any
10
+
11
+ def remove_definition: (Kaal::rbs_any key) -> (nil | Kaal::rbs_any)
12
+
13
+ def find_definition: (Kaal::rbs_any key) -> Kaal::rbs_any
14
+
15
+ def all_definitions: () -> Kaal::rbs_any
16
+
17
+ def enabled_definitions: () -> Kaal::rbs_any
18
+
19
+ private
20
+
21
+ def normalize: (Kaal::rbs_any record) -> (nil | Kaal::rbs_any)
22
+
23
+ def normalize_definition_record: (Kaal::rbs_any record) -> { key: Kaal::rbs_any, cron: Kaal::rbs_any, enabled: Kaal::rbs_any, source: Kaal::rbs_any, metadata: Kaal::rbs_any, created_at: Kaal::rbs_any, updated_at: Kaal::rbs_any, disabled_at: Kaal::rbs_any }
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,8 @@
1
+ module Kaal
2
+ module Internal
3
+ module ActiveRecord
4
+ class DelayedJobRecord < BaseRecord
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,39 @@
1
+ module Kaal
2
+ module Internal
3
+ module ActiveRecord
4
+ class DelayedJobRegistry < Kaal::DelayedJob::Registry
5
+ @model: Kaal::rbs_any
6
+
7
+ @use_skip_locked: Kaal::rbs_any
8
+
9
+ def initialize: (?connection: Kaal::rbs_any?, ?model: Kaal::rbs_any, ?use_skip_locked: bool) -> void
10
+
11
+ def enqueue: (job_id: Kaal::rbs_any, run_at: Kaal::rbs_any, job_class: Kaal::rbs_any, args: Kaal::rbs_any, ?queue: Kaal::rbs_any?, ?connection: Kaal::rbs_any?) -> Kaal::rbs_any
12
+
13
+ def pop_due: (now: Kaal::rbs_any, limit: Kaal::rbs_any) -> Kaal::rbs_any
14
+
15
+ private
16
+
17
+ def pop_due_with_skip_locked: (now: Kaal::rbs_any, limit: Kaal::rbs_any) -> Kaal::rbs_any
18
+
19
+ def pop_due_with_delete_confirmation: (now: Kaal::rbs_any, limit: Kaal::rbs_any) -> Kaal::rbs_any
20
+
21
+ public
22
+
23
+ def find_job: (Kaal::rbs_any job_id) -> Kaal::rbs_any
24
+
25
+ def all_jobs: () -> Kaal::rbs_any
26
+
27
+ def claim_strategy: () -> (:skip_locked | :delete_confirmation)
28
+
29
+ def self.normalize: (Kaal::rbs_any record) -> Kaal::rbs_any
30
+
31
+ private
32
+
33
+ def insert_with_connection: (Kaal::rbs_any connection, Kaal::rbs_any attributes) -> Kaal::rbs_any
34
+
35
+ def self.parse_args: (Kaal::rbs_any args_payload) -> Kaal::rbs_any
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,8 @@
1
+ module Kaal
2
+ module Internal
3
+ module ActiveRecord
4
+ class DispatchRecord < BaseRecord
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,43 @@
1
+ module Kaal
2
+ module Internal
3
+ module ActiveRecord
4
+ class DispatchRegistry < Kaal::Dispatch::Registry
5
+ @model: Kaal::rbs_any
6
+
7
+ @namespace: Kaal::rbs_any
8
+
9
+ def initialize: (?connection: Kaal::rbs_any?, ?model: Kaal::rbs_any, ?namespace: Kaal::rbs_any?) -> void
10
+
11
+ def log_dispatch: (Kaal::rbs_any key, Kaal::rbs_any fire_time, Kaal::rbs_any node_id, ?::String status) -> Kaal::rbs_any
12
+
13
+ def find_dispatch: (Kaal::rbs_any key, Kaal::rbs_any fire_time) -> Kaal::rbs_any
14
+
15
+ def find_by_key: (Kaal::rbs_any key) -> Kaal::rbs_any
16
+
17
+ def find_by_node: (Kaal::rbs_any node_id) -> Kaal::rbs_any
18
+
19
+ def find_by_status: (Kaal::rbs_any status) -> Kaal::rbs_any
20
+
21
+ def cleanup: (?recovery_window: ::Integer) -> Kaal::rbs_any
22
+
23
+ private
24
+
25
+ def query: (Kaal::rbs_any filters) -> Kaal::rbs_any
26
+
27
+ def namespaced_key: (Kaal::rbs_any key) -> ::String
28
+
29
+ def normalize: (Kaal::rbs_any record) -> (nil | { key: Kaal::rbs_any, fire_time: Kaal::rbs_any, dispatched_at: Kaal::rbs_any, node_id: Kaal::rbs_any, status: Kaal::rbs_any })
30
+
31
+ def strip_namespace: (Kaal::rbs_any key) -> Kaal::rbs_any
32
+
33
+ def query_scope: (Kaal::rbs_any filters) -> Kaal::rbs_any
34
+
35
+ def cleanup_scope: () -> Kaal::rbs_any
36
+
37
+ def namespace_scope: (Kaal::rbs_any relation) -> Kaal::rbs_any
38
+
39
+ def namespace_prefix: () -> ("" | ::String)
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,8 @@
1
+ module Kaal
2
+ module Internal
3
+ module ActiveRecord
4
+ class LockRecord < BaseRecord
5
+ end
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,17 @@
1
+ module Kaal
2
+ module Internal
3
+ module ActiveRecord
4
+ module MigrationTemplates
5
+ def self.for_backend: (Kaal::rbs_any backend) -> Kaal::rbs_any
6
+
7
+ def self.dispatches_template: () -> "class CreateKaalDispatches < ActiveRecord::Migration[7.1]\n def change\n create_table :kaal_dispatches do |t|\n t.string :key, null: false\n t.datetime :fire_time, null: false\n t.datetime :dispatched_at, null: false\n t.string :node_id, null: false\n t.string :status, null: false, default: 'dispatched', limit: 50\n end\n\n add_index :kaal_dispatches, [:key, :fire_time], unique: true\n add_index :kaal_dispatches, :key\n add_index :kaal_dispatches, :node_id\n add_index :kaal_dispatches, :status\n add_index :kaal_dispatches, :fire_time\n end\nend\n"
8
+
9
+ def self.locks_template: () -> "class CreateKaalLocks < ActiveRecord::Migration[7.1]\n def change\n create_table :kaal_locks do |t|\n t.string :key, null: false\n t.datetime :acquired_at, null: false\n t.datetime :expires_at, null: false\n end\n\n add_index :kaal_locks, :key, unique: true\n add_index :kaal_locks, :expires_at\n end\nend\n"
10
+
11
+ def self.definitions_template: (Kaal::rbs_any backend) -> ::String
12
+
13
+ def self.delayed_jobs_template: (Kaal::rbs_any backend) -> ::String
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,45 @@
1
+ module Kaal
2
+ module Internal
3
+ module ActiveRecord
4
+ class MySQLBackend < Kaal::Backend::Adapter
5
+ @dispatch_registry: Kaal::rbs_any
6
+
7
+ @definition_registry: Kaal::rbs_any
8
+
9
+ @namespace: Kaal::rbs_any
10
+
11
+ @use_skip_locked: Kaal::rbs_any
12
+
13
+ @delayed_store: Kaal::rbs_any
14
+
15
+ include Kaal::Backend::DispatchLogging
16
+
17
+ MAX_LOCK_NAME_LENGTH: 64
18
+
19
+ UNSET_SKIP_LOCKED_SUPPORT: Kaal::rbs_any
20
+
21
+ def initialize: (?Kaal::rbs_any? connection, ?dispatch_registry: Kaal::rbs_any?, ?definition_registry: Kaal::rbs_any?, ?namespace: Kaal::rbs_any?, ?use_skip_locked: Kaal::rbs_any) -> void
22
+
23
+ def dispatch_registry: () -> Kaal::rbs_any
24
+
25
+ def definition_registry: () -> Kaal::rbs_any
26
+
27
+ def delayed_store: () -> Kaal::rbs_any
28
+
29
+ def acquire: (Kaal::rbs_any key, Kaal::rbs_any _ttl) -> Kaal::rbs_any
30
+
31
+ def release: (Kaal::rbs_any key) -> Kaal::rbs_any
32
+
33
+ def self.normalize_lock_name: (Kaal::rbs_any key) -> (Kaal::rbs_any | ::String)
34
+
35
+ private
36
+
37
+ def scalar: (Kaal::rbs_any sql, *Kaal::rbs_any binds) -> Kaal::rbs_any
38
+
39
+ def resolved_namespace: () -> Kaal::rbs_any
40
+
41
+ def supports_skip_locked?: () -> Kaal::rbs_any
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,41 @@
1
+ module Kaal
2
+ module Internal
3
+ module ActiveRecord
4
+ class PostgresBackend < Kaal::Backend::Adapter
5
+ @dispatch_registry: Kaal::rbs_any
6
+
7
+ @definition_registry: Kaal::rbs_any
8
+
9
+ @namespace: Kaal::rbs_any
10
+
11
+ @delayed_store: Kaal::rbs_any
12
+
13
+ include Kaal::Backend::DispatchLogging
14
+
15
+ SIGNED_64_MAX: 9223372036854775807
16
+
17
+ UNSIGNED_64_RANGE: 18446744073709551616
18
+
19
+ def initialize: (?Kaal::rbs_any? connection, ?dispatch_registry: Kaal::rbs_any?, ?definition_registry: Kaal::rbs_any?, ?namespace: Kaal::rbs_any?) -> void
20
+
21
+ def dispatch_registry: () -> Kaal::rbs_any
22
+
23
+ def definition_registry: () -> Kaal::rbs_any
24
+
25
+ def delayed_store: () -> Kaal::rbs_any
26
+
27
+ def acquire: (Kaal::rbs_any key, Kaal::rbs_any _ttl) -> Kaal::rbs_any
28
+
29
+ def release: (Kaal::rbs_any key) -> Kaal::rbs_any
30
+
31
+ def self.calculate_lock_id: (Kaal::rbs_any key) -> Kaal::rbs_any
32
+
33
+ private
34
+
35
+ def scalar: (Kaal::rbs_any sql, Kaal::rbs_any value) -> Kaal::rbs_any
36
+
37
+ def resolved_namespace: () -> Kaal::rbs_any
38
+ end
39
+ end
40
+ end
41
+ end
File without changes