active_partition 0.1.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 864c367836794df12bbca3d03d7a957399930f6532ce06880bcc1e63adf49adb
4
+ data.tar.gz: 4e8a7e5031450b879921cba8b1cbf65f3aa1ddbfc6ad7d8af3746f67c14f7587
5
+ SHA512:
6
+ metadata.gz: 875150f22c67cbb6674b226517669c175685ee9132a5b60881f04763430ff2fcc328d0e5941b85d67240e3f88309737bed79ae1ff91036e2d32bfdb5ef061e41
7
+ data.tar.gz: c6879e16a5b12532ceec50b23ef8571355bed9f922768d97e993b76b322b843802e5590b2de0be665bd12df6b431780c3241bcd4d7b70a8c2998487e3e436da6
data/.byebug_history ADDED
@@ -0,0 +1,154 @@
1
+ c
2
+ prunable_partitions.count
3
+ past_partitions.count
4
+ prunable_partitions.count
5
+ past_partitions.count
6
+ past_partitions
7
+ partition_tables.count
8
+ partition_tablespast_partitions
9
+ prunable_partitions.count
10
+ prunable_partitions
11
+ c
12
+ [1,2,3,4,5,6][..-(retain_number + 1)]
13
+ [1,2,3,4,5][..-(retain_number + 1)]
14
+ [1,2,3,4][..-(retain_number + 1)]
15
+ [1,2,3,4]..-(retain_number + 1)
16
+ [1,2,3,4]-(retain_number + 1)
17
+ -(retain_number + 1)
18
+ retain_number = 4
19
+ [1,2,3].first(-1)
20
+ [1,2,3][..-1]
21
+ [1,2,3][..-2]
22
+ [1,2,3][..-3]
23
+ [1,2,3][..-4]
24
+ [1,2,3][..-2]
25
+ [1,2,3] - [2]
26
+ [1,2] - [2]
27
+ [1,2] - [1]
28
+ [1,2] - []
29
+ past_partitions.sort.last(2)
30
+ past_partitions.sort.last
31
+ past_partitions.sort
32
+ past_partitions.count
33
+ past_partitions
34
+ past_partitions = partition_tables.select { |name| name < current_partition_name }
35
+ current_partition_name = build_partition_name(Time.current, Time.current + 1.hour)
36
+ build_partition_name(Time.current, Time.current + 1.hour)
37
+ sorted_partition_tables.last
38
+ sorted_partition_tables.first
39
+ sorted_partition_tables = partition_tables.sort
40
+ sorted_partition_tables
41
+ partition_tables = partition_tables.sort
42
+ partition_tables.count
43
+ partition_tables = @partition_adapter.get_all_supported_partition_tables
44
+ c
45
+ OutgoingEvent.partition_manager.active_ranges
46
+ c
47
+ OutgoingEvent.partition_manager.active_ranges
48
+ OutgoingEvent.partition_manager.active_ranges[0]
49
+ partitioned_value
50
+ OutgoingEvent.partition_manager.active_ranges[0].cover? partitioned_value
51
+ OutgoingEvent.partition_manager.active_ranges[0]
52
+ OutgoingEvent.partition_manager.active_ranges
53
+ a.rangify
54
+ a = OutgoingEvent.partition_manager.active_ranges
55
+ OutgoingEvent.partition_manager.active_ranges
56
+ OutgoingEvent.partition_manager.active_ranges.rangify
57
+ OutgoingEvent.partition_manager.active_ranges
58
+ OutgoingEvent.partition_manager.active_ranges.max
59
+ OutgoingEvent.partition_manager.active_ranges
60
+ OutgoingEvent.active_ranges
61
+ OutgoingEvent.active_partitions_cover?(partitioned_value)
62
+ c
63
+ partitioned_value
64
+ from_time..to_time
65
+ from_time = latest_coverage + (diff.floor * default_premake_period)
66
+ to_time = from_time + default_premake_period
67
+ diff = (partitioned_value - latest_coverage) / default_premake_period
68
+ latest_coverage = latest_partition_coverage_time()
69
+ partitioned_value = partitioned_value.utc
70
+ partitioned_value
71
+ from_time..to_time
72
+ to_time = from_time + default_premake_period
73
+ from_time = latest_coverage + (diff.floor * default_premake_period)
74
+ diff = (partitioned_value - latest_coverage) / default_premake_period
75
+ -3.9.floor
76
+ (partitioned_value - latest_coverage)/default_premake_period
77
+ default_premake_period = 1.day
78
+ self.default_premake_period
79
+ default_premake_period
80
+ default_premake_perioddefault_premake_period
81
+ default_premake_period
82
+ (partitioned_value - latest_coverage)/default_premake_period
83
+ (partitioned_value - latest_coverage)
84
+ (partitioned_value - latest_coverage).floor
85
+ partitioned_value - latest_coverage
86
+ partitioned_value
87
+ latest_coverage = latest_partition_coverage_time()
88
+ c
89
+ @connection.execute sql
90
+ c
91
+ @connection.execute sql.delete("SQL")
92
+ sql
93
+ @connection.execute sql
94
+ @connection
95
+ puts sql
96
+ sql
97
+ c
98
+ e.message
99
+ c
100
+ unix_to
101
+ unix_from
102
+ Time.at(1719997200)
103
+ get_all_supported_partition_tables
104
+ sql_to
105
+ sql_from
106
+ partition_name
107
+ sql = <<~SQL
108
+ CREATE TABLE IF NOT EXISTS #{partition_name}
109
+ PARTITION OF #{@table_name}
110
+ FOR VALUES FROM ('#{sql_from}') TO ('#{sql_to}');
111
+ SQL
112
+ @connection.execute <<~SQL
113
+ CREATE TABLE IF NOT EXISTS #{partition_name}
114
+ PARTITION OF #{@table_name}
115
+ FOR VALUES FROM ('#{sql_from}') TO ('#{sql_to}');
116
+ SQL
117
+ partition_name
118
+ c
119
+ build_partition_name(from, to)
120
+ c
121
+ build_partition_name(from, to)
122
+ c
123
+ build_partition_name(from, to)
124
+ c
125
+ build_partition_name(from, to)
126
+ c
127
+ get_all_supported_partition_tables.each {|t| drop_partition(t)}
128
+ get_all_supported_partition_tables
129
+ partition_name
130
+ c
131
+ partition_name = build_partition_name(from, to)
132
+ c
133
+ partition_name = build_partition_name(from, to)
134
+ c
135
+ new_latest_coverage_time
136
+ current_coverage_time
137
+ current_coverage_time < new_latest_coverage_time
138
+ current_coverage_time = from || latest_partition_coverage_time
139
+ current_coverage_time
140
+ new_latest_coverage_time = (from || Time.current).utc + (period * number)
141
+ new_latest_coverage_time
142
+ c
143
+ C
144
+ c
145
+ connection
146
+ to
147
+ from
148
+ table_name
149
+ partition_name
150
+ partition_name, table_name, from, to
151
+ partition_adapter.exec_create_partition_by_time_range
152
+ partition_adapter
153
+ partition_adapater
154
+ partition_name
@@ -0,0 +1,16 @@
1
+ name: Ruby
2
+
3
+ on: [push,pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ steps:
9
+ - uses: actions/checkout@v2
10
+ - name: Set up Ruby
11
+ uses: ruby/setup-ruby@v1
12
+ with:
13
+ ruby-version: 3.0.2
14
+ bundler-cache: true
15
+ - name: Run the default task
16
+ run: bundle exec rake
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/.rubocop.yml ADDED
@@ -0,0 +1,338 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ require:
4
+ - rubocop-packaging
5
+ - rubocop-performance
6
+ - rubocop-rails
7
+ - rubocop-md
8
+
9
+ AllCops:
10
+ TargetRubyVersion: 3.3.0
11
+ # RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
12
+ # to ignore them, so only the ones explicitly set in this file are enabled.
13
+ DisabledByDefault: true
14
+ SuggestExtensions: false
15
+ Exclude:
16
+ - "**/tmp/**/*"
17
+ - "**/templates/**/*"
18
+ - "**/vendor/**/*"
19
+ - "db/schema.rb"
20
+ - "db/projects_schema.rb"
21
+ - "**/*.md"
22
+
23
+ Rails/IndexBy:
24
+ Enabled: true
25
+
26
+ Rails/IndexWith:
27
+ Enabled: true
28
+
29
+ # Prefer &&/|| over and/or.
30
+ Style/AndOr:
31
+ Enabled: true
32
+
33
+ # Align `when` with `case`.
34
+ Layout/CaseIndentation:
35
+ Enabled: true
36
+
37
+ Layout/ClosingHeredocIndentation:
38
+ Enabled: true
39
+
40
+ Layout/ClosingParenthesisIndentation:
41
+ Enabled: true
42
+
43
+ # Align comments with method definitions.
44
+ Layout/CommentIndentation:
45
+ Enabled: true
46
+
47
+ Layout/ElseAlignment:
48
+ Enabled: true
49
+
50
+ # Align `end` with the matching keyword or starting expression except for
51
+ # assignments, where it should be aligned with the LHS.
52
+ Layout/EndAlignment:
53
+ Enabled: true
54
+ EnforcedStyleAlignWith: variable
55
+ AutoCorrect: true
56
+
57
+ Layout/EndOfLine:
58
+ Enabled: true
59
+
60
+ Layout/EmptyLineAfterMagicComment:
61
+ Enabled: true
62
+
63
+ Layout/EmptyLinesAroundAccessModifier:
64
+ Enabled: true
65
+ EnforcedStyle: only_before
66
+
67
+ Layout/EmptyLinesAroundBlockBody:
68
+ Enabled: true
69
+
70
+ # In a regular class definition, no empty lines around the body.
71
+ Layout/EmptyLinesAroundClassBody:
72
+ Enabled: true
73
+
74
+ # In a regular method definition, no empty lines around the body.
75
+ Layout/EmptyLinesAroundMethodBody:
76
+ Enabled: true
77
+
78
+ # In a regular module definition, no empty lines around the body.
79
+ Layout/EmptyLinesAroundModuleBody:
80
+ Enabled: true
81
+
82
+ # Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
83
+ Style/HashSyntax:
84
+ Enabled: true
85
+
86
+ # Method definitions after `private` or `protected` isolated calls need one
87
+ # extra level of indentation.
88
+ Layout/IndentationConsistency:
89
+ Enabled: true
90
+ EnforcedStyle: indented_internal_methods
91
+ Exclude:
92
+ - "**/*.md"
93
+
94
+ # Two spaces, no tabs (for indentation).
95
+ Layout/IndentationWidth:
96
+ Enabled: true
97
+
98
+ Layout/LeadingCommentSpace:
99
+ Enabled: true
100
+
101
+ Layout/SpaceAfterColon:
102
+ Enabled: true
103
+
104
+ Layout/SpaceAfterComma:
105
+ Enabled: true
106
+
107
+ Layout/SpaceAfterSemicolon:
108
+ Enabled: true
109
+
110
+ Layout/SpaceAroundEqualsInParameterDefault:
111
+ Enabled: true
112
+
113
+ Layout/SpaceAroundKeyword:
114
+ Enabled: true
115
+
116
+ Layout/SpaceAroundOperators:
117
+ Enabled: true
118
+
119
+ Layout/SpaceBeforeComma:
120
+ Enabled: true
121
+
122
+ Layout/SpaceBeforeComment:
123
+ Enabled: true
124
+
125
+ Layout/SpaceBeforeFirstArg:
126
+ Enabled: true
127
+
128
+ Style/DefWithParentheses:
129
+ Enabled: true
130
+
131
+ # Defining a method with parameters needs parentheses.
132
+ Style/MethodDefParentheses:
133
+ Enabled: true
134
+
135
+ Style/ExplicitBlockArgument:
136
+ Enabled: true
137
+
138
+ Style/FrozenStringLiteralComment:
139
+ Enabled: true
140
+ EnforcedStyle: always
141
+
142
+ Style/MapToHash:
143
+ Enabled: true
144
+
145
+ Style/RedundantFreeze:
146
+ Enabled: true
147
+
148
+ # Use `foo {}` not `foo{}`.
149
+ Layout/SpaceBeforeBlockBraces:
150
+ Enabled: true
151
+
152
+ # Use `foo { bar }` not `foo {bar}`.
153
+ Layout/SpaceInsideBlockBraces:
154
+ Enabled: true
155
+ EnforcedStyleForEmptyBraces: space
156
+
157
+ # Use `{ a: 1 }` not `{a:1}`.
158
+ Layout/SpaceInsideHashLiteralBraces:
159
+ Enabled: true
160
+
161
+ Layout/SpaceInsideParens:
162
+ Enabled: true
163
+
164
+ # Check quotes usage according to lint rule below.
165
+ Style/StringLiterals:
166
+ Enabled: true
167
+ EnforcedStyle: double_quotes
168
+
169
+ # Detect hard tabs, no hard tabs.
170
+ Layout/IndentationStyle:
171
+ Enabled: true
172
+
173
+ # Empty lines should not have any spaces.
174
+ Layout/TrailingEmptyLines:
175
+ Enabled: true
176
+
177
+ # No trailing whitespace.
178
+ Layout/TrailingWhitespace:
179
+ Enabled: true
180
+
181
+ # Use quotes for string literals when they are enough.
182
+ Style/RedundantPercentQ:
183
+ Enabled: true
184
+
185
+ Lint/AmbiguousOperator:
186
+ Enabled: true
187
+
188
+ Lint/AmbiguousRegexpLiteral:
189
+ Enabled: true
190
+
191
+ Lint/DuplicateRequire:
192
+ Enabled: true
193
+
194
+ Lint/DuplicateMagicComment:
195
+ Enabled: true
196
+
197
+ Lint/DuplicateMethods:
198
+ Enabled: true
199
+
200
+ Lint/ErbNewArguments:
201
+ Enabled: true
202
+
203
+ Lint/EnsureReturn:
204
+ Enabled: true
205
+
206
+ # Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
207
+ Lint/RequireParentheses:
208
+ Enabled: true
209
+
210
+ Lint/RedundantStringCoercion:
211
+ Enabled: true
212
+
213
+ Lint/RedundantSafeNavigation:
214
+ Enabled: true
215
+
216
+ Lint/UriEscapeUnescape:
217
+ Enabled: true
218
+
219
+ Lint/UselessAssignment:
220
+ Enabled: true
221
+
222
+ Lint/DeprecatedClassMethods:
223
+ Enabled: true
224
+
225
+ Lint/InterpolationCheck:
226
+ Enabled: true
227
+ Exclude:
228
+ - "**/test/**/*"
229
+
230
+ Style/EvalWithLocation:
231
+ Enabled: true
232
+ Exclude:
233
+ - "**/test/**/*"
234
+
235
+ Style/ParenthesesAroundCondition:
236
+ Enabled: true
237
+
238
+ Style/HashTransformKeys:
239
+ Enabled: true
240
+
241
+ Style/HashTransformValues:
242
+ Enabled: true
243
+
244
+ Style/RedundantBegin:
245
+ Enabled: true
246
+
247
+ Style/RedundantReturn:
248
+ Enabled: true
249
+ AllowMultipleReturnValues: true
250
+
251
+ Style/RedundantRegexpEscape:
252
+ Enabled: true
253
+
254
+ Style/Semicolon:
255
+ Enabled: true
256
+ AllowAsExpressionSeparator: true
257
+
258
+ # Prefer Foo.method over Foo::method
259
+ Style/ColonMethodCall:
260
+ Enabled: true
261
+
262
+ Style/TrivialAccessors:
263
+ Enabled: true
264
+
265
+ # Prefer a = b || c over a = b ? b : c
266
+ Style/RedundantCondition:
267
+ Enabled: true
268
+
269
+ Style/RedundantDoubleSplatHashBraces:
270
+ Enabled: true
271
+
272
+ Performance/BindCall:
273
+ Enabled: true
274
+
275
+ Performance/FlatMap:
276
+ Enabled: true
277
+
278
+ Performance/MapCompact:
279
+ Enabled: true
280
+
281
+ Performance/SelectMap:
282
+ Enabled: true
283
+
284
+ Performance/RedundantMerge:
285
+ Enabled: true
286
+
287
+ Performance/StartWith:
288
+ Enabled: true
289
+
290
+ Performance/EndWith:
291
+ Enabled: true
292
+
293
+ Performance/RegexpMatch:
294
+ Enabled: true
295
+
296
+ Performance/ReverseEach:
297
+ Enabled: true
298
+
299
+ Performance/StringReplacement:
300
+ Enabled: true
301
+
302
+ Performance/DeletePrefix:
303
+ Enabled: true
304
+
305
+ Performance/DeleteSuffix:
306
+ Enabled: true
307
+
308
+ Performance/OpenStruct:
309
+ Enabled: true
310
+
311
+ Performance/InefficientHashSearch:
312
+ Enabled: true
313
+
314
+ Performance/ConstantRegexp:
315
+ Enabled: true
316
+
317
+ Performance/RedundantStringChars:
318
+ Enabled: true
319
+
320
+ Performance/StringInclude:
321
+ Enabled: true
322
+
323
+ Markdown:
324
+ # Whether to run RuboCop against non-valid snippets
325
+ WarnInvalid: true
326
+ # Whether to lint codeblocks without code attributes
327
+ Autodetect: false
328
+
329
+ Style/Documentation:
330
+ Enabled: false
331
+
332
+ Metrics/BlockLength:
333
+ Enabled: true
334
+ Exclude:
335
+ - "**/spec/**/*"
336
+ - db/transportation_schema.rb
337
+ - config/environments/development.rb
338
+ - packs/pinet_users/config/initializers/doorkeeper_openid_connect.rb