lutaml-store 0.1.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 (110) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/main.yml +27 -0
  3. data/.gitignore +12 -0
  4. data/.rspec +3 -0
  5. data/.rubocop.yml +10 -0
  6. data/.rubocop_todo.yml +450 -0
  7. data/CLAUDE.md +57 -0
  8. data/CODE_OF_CONDUCT.md +132 -0
  9. data/CORRECTED_HTTP_CACHE_IMPLEMENTATION.md +209 -0
  10. data/CORRECTED_HTTP_CACHE_PLAN.md +164 -0
  11. data/Gemfile +15 -0
  12. data/Gemfile.lock +220 -0
  13. data/README.adoc +1430 -0
  14. data/Rakefile +12 -0
  15. data/TODO.impl/0-lutaml-store-self-quality.md +112 -0
  16. data/TODO.impl/1-lutaml-hal-migration.md +60 -0
  17. data/TODO.impl/2-glossarist-migration.md +359 -0
  18. data/TODO.impl/3-lutaml-jsonschema-migration.md +273 -0
  19. data/bin/console +11 -0
  20. data/bin/setup +8 -0
  21. data/demo/Gemfile +15 -0
  22. data/demo/Gemfile.lock +61 -0
  23. data/demo/README.adoc +301 -0
  24. data/demo/data/vcards/co/contact_10_thompson.data +1 -0
  25. data/demo/data/vcards/co/contact_10_thompson.meta +1 -0
  26. data/demo/data/vcards/co/contact_1_doe.data +1 -0
  27. data/demo/data/vcards/co/contact_1_doe.meta +1 -0
  28. data/demo/data/vcards/co/contact_2_smith.data +1 -0
  29. data/demo/data/vcards/co/contact_2_smith.meta +1 -0
  30. data/demo/data/vcards/co/contact_3_johnson.data +1 -0
  31. data/demo/data/vcards/co/contact_3_johnson.meta +1 -0
  32. data/demo/data/vcards/co/contact_4_garcia.data +1 -0
  33. data/demo/data/vcards/co/contact_4_garcia.meta +1 -0
  34. data/demo/data/vcards/co/contact_5_wilson.data +1 -0
  35. data/demo/data/vcards/co/contact_5_wilson.meta +1 -0
  36. data/demo/data/vcards/co/contact_6_brown.data +1 -0
  37. data/demo/data/vcards/co/contact_6_brown.meta +1 -0
  38. data/demo/data/vcards/co/contact_7_davis.data +1 -0
  39. data/demo/data/vcards/co/contact_7_davis.meta +1 -0
  40. data/demo/data/vcards/co/contact_8_anderson.data +1 -0
  41. data/demo/data/vcards/co/contact_8_anderson.meta +1 -0
  42. data/demo/data/vcards/co/contact_9_taylor.data +1 -0
  43. data/demo/data/vcards/co/contact_9_taylor.meta +1 -0
  44. data/demo/data/vcards.db +0 -0
  45. data/demo/pottery_class_demo.rb +164 -0
  46. data/demo/vcard_models.rb +140 -0
  47. data/demo/vcard_store_demo.rb +526 -0
  48. data/lib/lutaml/store/adapter/base.rb +65 -0
  49. data/lib/lutaml/store/adapter/filesystem.rb +288 -0
  50. data/lib/lutaml/store/adapter/memory.rb +225 -0
  51. data/lib/lutaml/store/adapter/sqlite.rb +193 -0
  52. data/lib/lutaml/store/adapter.rb +12 -0
  53. data/lib/lutaml/store/attribute_updater.rb +198 -0
  54. data/lib/lutaml/store/basic_store.rb +190 -0
  55. data/lib/lutaml/store/cache.rb +108 -0
  56. data/lib/lutaml/store/cache_store.rb +282 -0
  57. data/lib/lutaml/store/composite_model_handler.rb +169 -0
  58. data/lib/lutaml/store/compression.rb +137 -0
  59. data/lib/lutaml/store/config.rb +178 -0
  60. data/lib/lutaml/store/database_store.rb +425 -0
  61. data/lib/lutaml/store/events.rb +92 -0
  62. data/lib/lutaml/store/format/base.rb +33 -0
  63. data/lib/lutaml/store/format/json.rb +25 -0
  64. data/lib/lutaml/store/format/jsonl.rb +37 -0
  65. data/lib/lutaml/store/format/marshal_format.rb +37 -0
  66. data/lib/lutaml/store/format/yaml.rb +29 -0
  67. data/lib/lutaml/store/format/yamls.rb +35 -0
  68. data/lib/lutaml/store/format.rb +33 -0
  69. data/lib/lutaml/store/http_cache.rb +279 -0
  70. data/lib/lutaml/store/http_cache_config.rb +53 -0
  71. data/lib/lutaml/store/http_cache_entry.rb +69 -0
  72. data/lib/lutaml/store/http_header_processor.rb +175 -0
  73. data/lib/lutaml/store/integrity.rb +102 -0
  74. data/lib/lutaml/store/model_registration.rb +75 -0
  75. data/lib/lutaml/store/model_registry.rb +123 -0
  76. data/lib/lutaml/store/model_serializer.rb +69 -0
  77. data/lib/lutaml/store/monitor.rb +192 -0
  78. data/lib/lutaml/store/storage_key.rb +40 -0
  79. data/lib/lutaml/store/version.rb +7 -0
  80. data/lib/lutaml/store.rb +41 -0
  81. data/lutaml-store.gemspec +35 -0
  82. data/plan.adoc +606 -0
  83. data/sig/lutaml/store.rbs +6 -0
  84. data/spec/lutaml/store/adapter_interface_spec.rb +89 -0
  85. data/spec/lutaml/store/anti_pattern_guard_spec.rb +35 -0
  86. data/spec/lutaml/store/anti_pattern_spec.rb +78 -0
  87. data/spec/lutaml/store/autoload_spec.rb +34 -0
  88. data/spec/lutaml/store/cache_store_spec.rb +271 -0
  89. data/spec/lutaml/store/compression_spec.rb +78 -0
  90. data/spec/lutaml/store/config_enhanced_spec.rb +158 -0
  91. data/spec/lutaml/store/corrected_http_cache_integration_spec.rb +336 -0
  92. data/spec/lutaml/store/custom_serializer_spec.rb +108 -0
  93. data/spec/lutaml/store/database_store_spec.rb +279 -0
  94. data/spec/lutaml/store/file_io_spec.rb +219 -0
  95. data/spec/lutaml/store/format_round_trip_spec.rb +110 -0
  96. data/spec/lutaml/store/format_spec.rb +70 -0
  97. data/spec/lutaml/store/http_cache_entry_spec.rb +203 -0
  98. data/spec/lutaml/store/http_cache_hal_integration_spec.rb +404 -0
  99. data/spec/lutaml/store/http_cache_spec.rb +422 -0
  100. data/spec/lutaml/store/http_header_processor_spec.rb +290 -0
  101. data/spec/lutaml/store/import_spec.rb +90 -0
  102. data/spec/lutaml/store/integrity_spec.rb +157 -0
  103. data/spec/lutaml/store/key_collision_serializer_spec.rb +98 -0
  104. data/spec/lutaml/store/load_save_spec.rb +107 -0
  105. data/spec/lutaml/store/lutaml_model_integration_spec.rb +291 -0
  106. data/spec/lutaml/store/model_serializer_spec.rb +140 -0
  107. data/spec/lutaml/store/store_spec.rb +182 -0
  108. data/spec/lutaml/store_spec.rb +21 -0
  109. data/spec/spec_helper.rb +16 -0
  110. metadata +166 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ea027eecd3b29d9e1369455e835feb794173b4326a81034f67bb06b89e6adb3b
4
+ data.tar.gz: 74a1b77d3e644bfb92a397a0a1e51b0eb0d7a3af545543c6419c3d6a1677bd65
5
+ SHA512:
6
+ metadata.gz: 3fef83d3704ef385c9f536ff73ec2681b962d56a46b1211aa7e3042119c5b0a6a2bc70a52c97edd5e791060d526981ff75beaff7d0f2cd1c40e40ea54b3dc713
7
+ data.tar.gz: bfe7057e1323a7396bcc71e829f26f2c44725fadee07156553a6721b29e9a31ab478b9c47d92f79deb6cd38f96f90477d2a505baa0f85b7b56f837e4be10055e
@@ -0,0 +1,27 @@
1
+ name: Ruby
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ pull_request:
9
+
10
+ jobs:
11
+ build:
12
+ runs-on: ubuntu-latest
13
+ name: Ruby ${{ matrix.ruby }}
14
+ strategy:
15
+ matrix:
16
+ ruby:
17
+ - '3.3.2'
18
+
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+ - name: Set up Ruby
22
+ uses: ruby/setup-ruby@v1
23
+ with:
24
+ ruby-version: ${{ matrix.ruby }}
25
+ bundler-cache: true
26
+ - name: Run the default task
27
+ run: bundle exec rake
data/.gitignore ADDED
@@ -0,0 +1,12 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+
10
+ # rspec failure tracking
11
+ .rspec_status
12
+ *.gem
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,10 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ AllCops:
4
+ TargetRubyVersion: 3.1
5
+
6
+ Style/StringLiterals:
7
+ EnforcedStyle: double_quotes
8
+
9
+ Style/StringLiteralsInInterpolation:
10
+ EnforcedStyle: double_quotes
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,450 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2026-06-01 15:50:24 UTC using RuboCop version 1.86.2.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ Gemspec/RequiredRubyVersion:
11
+ Exclude:
12
+ - 'lutaml-store.gemspec'
13
+
14
+ # Offense count: 14
15
+ # This cop supports safe autocorrection (--autocorrect).
16
+ # Configuration parameters: EnforcedStyle, IndentationWidth.
17
+ # SupportedStyles: with_first_argument, with_fixed_indentation
18
+ Layout/ArgumentAlignment:
19
+ Exclude:
20
+ - 'lib/lutaml/store/compression.rb'
21
+ - 'spec/lutaml/store/anti_pattern_spec.rb'
22
+ - 'spec/lutaml/store/lutaml_model_integration_spec.rb'
23
+ - 'spec/lutaml/store/model_serializer_spec.rb'
24
+
25
+ # Offense count: 4
26
+ # This cop supports safe autocorrection (--autocorrect).
27
+ Layout/EmptyLineAfterGuardClause:
28
+ Exclude:
29
+ - 'lib/lutaml/store/adapter/filesystem.rb'
30
+ - 'lib/lutaml/store/attribute_updater.rb'
31
+
32
+ # Offense count: 7
33
+ # This cop supports safe autocorrection (--autocorrect).
34
+ Layout/EmptyLineAfterMagicComment:
35
+ Exclude:
36
+ - 'demo/pottery_class_demo.rb'
37
+ - 'lib/lutaml/store/http_cache_config.rb'
38
+ - 'lib/lutaml/store/http_cache_entry.rb'
39
+ - 'lib/lutaml/store/http_header_processor.rb'
40
+ - 'spec/lutaml/store/http_cache_entry_spec.rb'
41
+ - 'spec/lutaml/store/http_cache_spec.rb'
42
+ - 'spec/lutaml/store/http_header_processor_spec.rb'
43
+
44
+ # Offense count: 1
45
+ # This cop supports safe autocorrection (--autocorrect).
46
+ # Configuration parameters: EmptyLineBetweenMethodDefs, EmptyLineBetweenClassDefs, EmptyLineBetweenModuleDefs, DefLikeMacros, AllowAdjacentOneLineDefs, NumberOfEmptyLines.
47
+ Layout/EmptyLineBetweenDefs:
48
+ Exclude:
49
+ - 'lib/lutaml/store/compression.rb'
50
+
51
+ # Offense count: 4
52
+ # This cop supports safe autocorrection (--autocorrect).
53
+ Layout/EmptyLines:
54
+ Exclude:
55
+ - 'lib/lutaml/store/adapter/memory.rb'
56
+ - 'lib/lutaml/store/cache.rb'
57
+ - 'lib/lutaml/store/compression.rb'
58
+ - 'lib/lutaml/store/monitor.rb'
59
+
60
+ # Offense count: 2
61
+ # This cop supports safe autocorrection (--autocorrect).
62
+ # Configuration parameters: EnforcedStyle.
63
+ # SupportedStyles: empty_lines, no_empty_lines
64
+ Layout/EmptyLinesAroundBlockBody:
65
+ Exclude:
66
+ - 'lib/lutaml/store/adapter/filesystem.rb'
67
+
68
+ # Offense count: 13
69
+ # This cop supports safe autocorrection (--autocorrect).
70
+ Layout/EmptyLinesAroundMethodBody:
71
+ Exclude:
72
+ - 'lib/lutaml/store/attribute_updater.rb'
73
+ - 'lib/lutaml/store/compression.rb'
74
+
75
+ # Offense count: 9
76
+ # This cop supports safe autocorrection (--autocorrect).
77
+ # Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
78
+ # SupportedHashRocketStyles: key, separator, table
79
+ # SupportedColonStyles: key, separator, table
80
+ # SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
81
+ Layout/HashAlignment:
82
+ Exclude:
83
+ - 'spec/lutaml/store/lutaml_model_integration_spec.rb'
84
+ - 'spec/lutaml/store/model_serializer_spec.rb'
85
+
86
+ # Offense count: 3
87
+ # This cop supports safe autocorrection (--autocorrect).
88
+ # Configuration parameters: EnforcedStyle.
89
+ # SupportedStyles: normal, indented_internal_methods
90
+ Layout/IndentationConsistency:
91
+ Exclude:
92
+ - 'lib/lutaml/store/attribute_updater.rb'
93
+ - 'lib/lutaml/store/integrity.rb'
94
+
95
+ # Offense count: 9
96
+ # This cop supports safe autocorrection (--autocorrect).
97
+ # Configuration parameters: Width, EnforcedStyleAlignWith, AllowedPatterns.
98
+ # SupportedStylesAlignWith: start_of_line, relative_to_receiver
99
+ Layout/IndentationWidth:
100
+ Exclude:
101
+ - 'lib/lutaml/store/adapter/filesystem.rb'
102
+ - 'lib/lutaml/store/compression.rb'
103
+ - 'lib/lutaml/store/integrity.rb'
104
+
105
+ # Offense count: 7
106
+ # This cop supports safe autocorrection (--autocorrect).
107
+ Layout/RescueEnsureAlignment:
108
+ Exclude:
109
+ - 'lib/lutaml/store/adapter/filesystem.rb'
110
+ - 'lib/lutaml/store/compression.rb'
111
+
112
+ # Offense count: 22
113
+ # This cop supports safe autocorrection (--autocorrect).
114
+ # Configuration parameters: AllowInHeredoc.
115
+ Layout/TrailingWhitespace:
116
+ Exclude:
117
+ - 'lib/lutaml/store/adapter/filesystem.rb'
118
+ - 'lib/lutaml/store/attribute_updater.rb'
119
+ - 'lib/lutaml/store/compression.rb'
120
+ - 'spec/lutaml/store/lutaml_model_integration_spec.rb'
121
+ - 'spec/lutaml/store/model_serializer_spec.rb'
122
+
123
+ # Offense count: 2
124
+ # This cop supports unsafe autocorrection (--autocorrect-all).
125
+ # Configuration parameters: AllowSafeAssignment.
126
+ Lint/AssignmentInCondition:
127
+ Exclude:
128
+ - 'lib/lutaml/store/http_header_processor.rb'
129
+
130
+ # Offense count: 3
131
+ # This cop supports safe autocorrection (--autocorrect).
132
+ Lint/RedundantRequireStatement:
133
+ Exclude:
134
+ - 'lib/lutaml/store/adapter/memory.rb'
135
+ - 'lib/lutaml/store/cache.rb'
136
+ - 'lib/lutaml/store/monitor.rb'
137
+
138
+ # Offense count: 1
139
+ # This cop supports safe autocorrection (--autocorrect).
140
+ # Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
141
+ Lint/UnusedBlockArgument:
142
+ Exclude:
143
+ - 'lib/lutaml/store/adapter/sqlite.rb'
144
+
145
+ # Offense count: 2
146
+ # This cop supports safe autocorrection (--autocorrect).
147
+ # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods, NotImplementedExceptions.
148
+ # NotImplementedExceptions: NotImplementedError
149
+ Lint/UnusedMethodArgument:
150
+ Exclude:
151
+ - 'lib/lutaml/store/http_cache.rb'
152
+ - 'lib/lutaml/store/monitor.rb'
153
+
154
+ # Offense count: 1
155
+ # This cop supports safe autocorrection (--autocorrect).
156
+ # Configuration parameters: ContextCreatingMethods, MethodCreatingMethods.
157
+ Lint/UselessAccessModifier:
158
+ Exclude:
159
+ - 'lib/lutaml/store/compression.rb'
160
+
161
+ # Offense count: 7
162
+ # This cop supports safe autocorrection (--autocorrect).
163
+ Lint/UselessAssignment:
164
+ Exclude:
165
+ - 'lib/lutaml/store/http_cache.rb'
166
+ - 'spec/lutaml/store/cache_store_spec.rb'
167
+ - 'spec/lutaml/store/http_cache_hal_integration_spec.rb'
168
+ - 'spec/lutaml/store/http_cache_spec.rb'
169
+
170
+ # Offense count: 23
171
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
172
+ Metrics/AbcSize:
173
+ Max: 112
174
+
175
+ # Offense count: 51
176
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
177
+ # AllowedMethods: refine
178
+ Metrics/BlockLength:
179
+ Max: 320
180
+
181
+ # Offense count: 14
182
+ # Configuration parameters: CountComments, CountAsOne.
183
+ Metrics/ClassLength:
184
+ Max: 379
185
+
186
+ # Offense count: 7
187
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
188
+ Metrics/CyclomaticComplexity:
189
+ Max: 10
190
+
191
+ # Offense count: 72
192
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
193
+ Metrics/MethodLength:
194
+ Max: 84
195
+
196
+ # Offense count: 3
197
+ # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
198
+ Metrics/ParameterLists:
199
+ Max: 8
200
+
201
+ # Offense count: 4
202
+ # Configuration parameters: AllowedMethods, AllowedPatterns.
203
+ Metrics/PerceivedComplexity:
204
+ Max: 11
205
+
206
+ # Offense count: 1
207
+ Naming/AccessorMethodName:
208
+ Exclude:
209
+ - 'lib/lutaml/store/adapter/sqlite.rb'
210
+
211
+ # Offense count: 3
212
+ # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
213
+ # AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
214
+ Naming/MethodParameterName:
215
+ Exclude:
216
+ - 'demo/vcard_models.rb'
217
+ - 'demo/vcard_store_demo.rb'
218
+
219
+ # Offense count: 1
220
+ # Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros, UseSorbetSigs.
221
+ # NamePrefix: is_, has_, have_, does_
222
+ # ForbiddenPrefixes: is_, has_, have_, does_
223
+ # AllowedMethods: is_a?
224
+ # MethodDefinitionMacros: define_method, define_singleton_method
225
+ Naming/PredicatePrefix:
226
+ Exclude:
227
+ - 'spec/**/*'
228
+ - 'lib/lutaml/store/http_header_processor.rb'
229
+
230
+ # Offense count: 2
231
+ # Configuration parameters: EnforcedStyle, CheckMethodNames, CheckSymbols, AllowedIdentifiers, AllowedPatterns.
232
+ # SupportedStyles: snake_case, normalcase, non_integer
233
+ # AllowedIdentifiers: TLS1_1, TLS1_2, capture3, iso8601, rfc1123_date, rfc822, rfc2822, rfc3339, x86_64
234
+ Naming/VariableNumber:
235
+ Exclude:
236
+ - 'spec/lutaml/store/compression_spec.rb'
237
+
238
+ # Offense count: 2
239
+ Security/MarshalLoad:
240
+ Exclude:
241
+ - 'lib/lutaml/store/format/marshal_format.rb'
242
+
243
+ # Offense count: 14
244
+ # This cop supports safe autocorrection (--autocorrect).
245
+ # Configuration parameters: EnforcedStyle, ProceduralMethods, FunctionalMethods, AllowedMethods, AllowedPatterns, AllowBracesOnProceduralOneLiners, BracesRequiredMethods.
246
+ # SupportedStyles: line_count_based, semantic, braces_for_chaining, always_braces
247
+ # ProceduralMethods: benchmark, bm, bmbm, create, each_with_object, measure, new, realtime, tap, with_object
248
+ # FunctionalMethods: let, let!, subject, watch
249
+ # AllowedMethods: lambda, proc, it
250
+ Style/BlockDelimiters:
251
+ Exclude:
252
+ - 'spec/lutaml/store/compression_spec.rb'
253
+ - 'spec/lutaml/store/file_io_spec.rb'
254
+ - 'spec/lutaml/store/integrity_spec.rb'
255
+ - 'spec/lutaml/store/model_serializer_spec.rb'
256
+
257
+ # Offense count: 3
258
+ # This cop supports safe autocorrection (--autocorrect).
259
+ # Configuration parameters: Keywords, RequireColon.
260
+ # Keywords: TODO, FIXME, OPTIMIZE, HACK, REVIEW, NOTE
261
+ Style/CommentAnnotation:
262
+ Exclude:
263
+ - 'spec/lutaml/store/compression_spec.rb'
264
+ - 'spec/lutaml/store/config_enhanced_spec.rb'
265
+ - 'spec/lutaml/store/store_spec.rb'
266
+
267
+ # Offense count: 29
268
+ # Configuration parameters: AllowedConstants.
269
+ Style/Documentation:
270
+ Enabled: false
271
+
272
+ # Offense count: 1
273
+ # This cop supports safe autocorrection (--autocorrect).
274
+ # Configuration parameters: EnforcedStyle.
275
+ # SupportedStyles: compact, expanded
276
+ Style/EmptyMethod:
277
+ Exclude:
278
+ - 'lib/lutaml/store/adapter/filesystem.rb'
279
+
280
+ # Offense count: 7
281
+ # This cop supports unsafe autocorrection (--autocorrect-all).
282
+ # Configuration parameters: EnforcedStyle.
283
+ # SupportedStyles: always, always_true, never
284
+ Style/FrozenStringLiteralComment:
285
+ Exclude:
286
+ - '**/*.arb'
287
+ - 'demo/pottery_class_demo.rb'
288
+ - 'lib/lutaml/store/http_cache_config.rb'
289
+ - 'lib/lutaml/store/http_cache_entry.rb'
290
+ - 'lib/lutaml/store/http_header_processor.rb'
291
+ - 'spec/lutaml/store/http_cache_entry_spec.rb'
292
+ - 'spec/lutaml/store/http_cache_spec.rb'
293
+ - 'spec/lutaml/store/http_header_processor_spec.rb'
294
+
295
+ # Offense count: 1
296
+ # This cop supports safe autocorrection (--autocorrect).
297
+ # Configuration parameters: MinBodyLength, AllowConsecutiveConditionals.
298
+ Style/GuardClause:
299
+ Exclude:
300
+ - 'lib/lutaml/store/attribute_updater.rb'
301
+
302
+ # Offense count: 6
303
+ # This cop supports unsafe autocorrection (--autocorrect-all).
304
+ # Configuration parameters: AllowedReceivers.
305
+ # AllowedReceivers: Thread.current
306
+ Style/HashEachMethods:
307
+ Exclude:
308
+ - 'demo/vcard_store_demo.rb'
309
+ - 'lib/lutaml/store/cache_store.rb'
310
+ - 'lib/lutaml/store/database_store.rb'
311
+ - 'lib/lutaml/store/http_cache.rb'
312
+
313
+ # Offense count: 9
314
+ # This cop supports safe autocorrection (--autocorrect).
315
+ Style/IfUnlessModifier:
316
+ Exclude:
317
+ - 'lib/lutaml/store/attribute_updater.rb'
318
+ - 'lib/lutaml/store/cache.rb'
319
+ - 'lib/lutaml/store/http_cache.rb'
320
+ - 'lib/lutaml/store/integrity.rb'
321
+ - 'lib/lutaml/store/model_registry.rb'
322
+ - 'lib/lutaml/store/monitor.rb'
323
+
324
+ # Offense count: 3
325
+ # This cop supports unsafe autocorrection (--autocorrect-all).
326
+ # Configuration parameters: EnforcedStyle, AllowedMethods, AllowedPatterns.
327
+ # SupportedStyles: predicate, comparison
328
+ Style/NumericPredicate:
329
+ Exclude:
330
+ - 'spec/**/*'
331
+ - 'demo/vcard_store_demo.rb'
332
+ - 'lib/lutaml/store/adapter/memory.rb'
333
+ - 'lib/lutaml/store/http_cache.rb'
334
+
335
+ # Offense count: 7
336
+ # This cop supports safe autocorrection (--autocorrect).
337
+ Style/RedundantBegin:
338
+ Exclude:
339
+ - 'lib/lutaml/store/adapter/filesystem.rb'
340
+ - 'lib/lutaml/store/compression.rb'
341
+
342
+ # Offense count: 2
343
+ # This cop supports unsafe autocorrection (--autocorrect-all).
344
+ # Configuration parameters: SafeForConstants.
345
+ Style/RedundantFetchBlock:
346
+ Exclude:
347
+ - 'spec/lutaml/store/cache_store_spec.rb'
348
+
349
+ # Offense count: 1
350
+ # This cop supports safe autocorrection (--autocorrect).
351
+ # Configuration parameters: EnforcedStyle, AllowInnerSlashes.
352
+ # SupportedStyles: slashes, percent_r, mixed
353
+ Style/RegexpLiteral:
354
+ Exclude:
355
+ - 'lib/lutaml/store/adapter/filesystem.rb'
356
+
357
+ # Offense count: 1
358
+ # This cop supports safe autocorrection (--autocorrect).
359
+ Style/RescueModifier:
360
+ Exclude:
361
+ - 'demo/vcard_models.rb'
362
+
363
+ # Offense count: 4
364
+ # This cop supports safe autocorrection (--autocorrect).
365
+ # Configuration parameters: EnforcedStyle.
366
+ # SupportedStyles: implicit, explicit
367
+ Style/RescueStandardError:
368
+ Exclude:
369
+ - 'demo/vcard_models.rb'
370
+ - 'lib/lutaml/store/adapter/filesystem.rb'
371
+ - 'lib/lutaml/store/integrity.rb'
372
+
373
+ # Offense count: 1
374
+ # This cop supports unsafe autocorrection (--autocorrect-all).
375
+ # Configuration parameters: RequireEnglish, EnforcedStyle.
376
+ # SupportedStyles: use_perl_names, use_english_names, use_builtin_english_names
377
+ Style/SpecialGlobalVars:
378
+ Exclude:
379
+ - 'demo/vcard_store_demo.rb'
380
+
381
+ # Offense count: 4
382
+ # This cop supports unsafe autocorrection (--autocorrect-all).
383
+ # Configuration parameters: Mode.
384
+ Style/StringConcatenation:
385
+ Exclude:
386
+ - 'demo/vcard_store_demo.rb'
387
+ - 'lib/lutaml/store/format/jsonl.rb'
388
+
389
+ # Offense count: 1
390
+ # This cop supports safe autocorrection (--autocorrect).
391
+ # Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
392
+ # SupportedStyles: single_quotes, double_quotes
393
+ Style/StringLiterals:
394
+ Exclude:
395
+ - 'lib/lutaml/store/compression.rb'
396
+
397
+ # Offense count: 2
398
+ # This cop supports safe autocorrection (--autocorrect).
399
+ # Configuration parameters: EnforcedStyle.
400
+ # SupportedStyles: single_quotes, double_quotes
401
+ Style/StringLiteralsInInterpolation:
402
+ Exclude:
403
+ - 'lib/lutaml/store/compression.rb'
404
+
405
+ # Offense count: 9
406
+ # This cop supports safe autocorrection (--autocorrect).
407
+ # Configuration parameters: EnforcedStyleForMultiline.
408
+ # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
409
+ Style/TrailingCommaInArguments:
410
+ Exclude:
411
+ - 'spec/lutaml/store/file_io_spec.rb'
412
+ - 'spec/lutaml/store/import_spec.rb'
413
+ - 'spec/lutaml/store/key_collision_serializer_spec.rb'
414
+ - 'spec/lutaml/store/load_save_spec.rb'
415
+
416
+ # Offense count: 8
417
+ # This cop supports safe autocorrection (--autocorrect).
418
+ # Configuration parameters: EnforcedStyleForMultiline.
419
+ # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
420
+ Style/TrailingCommaInArrayLiteral:
421
+ Exclude:
422
+ - 'spec/lutaml/store/file_io_spec.rb'
423
+ - 'spec/lutaml/store/format_round_trip_spec.rb'
424
+ - 'spec/lutaml/store/import_spec.rb'
425
+ - 'spec/lutaml/store/load_save_spec.rb'
426
+ - 'spec/lutaml/store/lutaml_model_integration_spec.rb'
427
+
428
+ # Offense count: 3
429
+ # This cop supports safe autocorrection (--autocorrect).
430
+ # Configuration parameters: EnforcedStyleForMultiline.
431
+ # SupportedStylesForMultiline: comma, consistent_comma, diff_comma, no_comma
432
+ Style/TrailingCommaInHashLiteral:
433
+ Exclude:
434
+ - 'lib/lutaml/store/format.rb'
435
+ - 'spec/lutaml/store/key_collision_serializer_spec.rb'
436
+
437
+ # Offense count: 5
438
+ # This cop supports safe autocorrection (--autocorrect).
439
+ # Configuration parameters: WordRegex.
440
+ # SupportedStyles: percent, brackets
441
+ Style/WordArray:
442
+ EnforcedStyle: percent
443
+ MinSize: 4
444
+
445
+ # Offense count: 7
446
+ # This cop supports safe autocorrection (--autocorrect).
447
+ # Configuration parameters: AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, AllowRBSInlineAnnotation, AllowCopDirectives, AllowedPatterns, SplitStrings.
448
+ # URISchemes: http, https
449
+ Layout/LineLength:
450
+ Max: 161
data/CLAUDE.md ADDED
@@ -0,0 +1,57 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Build & test commands
6
+
7
+ ```sh
8
+ bin/setup # Install dependencies
9
+ bundle exec rake # Run specs + rubocop (default task)
10
+ bundle exec rspec # Run all specs
11
+ bundle exec rspec spec/lutaml/store/basic_store_spec.rb # Run a single spec file
12
+ bundle exec rubocop # Lint
13
+ ```
14
+
15
+ Ruby >= 3.1 required. CI uses Ruby 3.3.2.
16
+
17
+ ## Architecture
18
+
19
+ This is a Ruby gem (`lutaml-store`) providing a store-centric database-style API for persisting LutaML Models across multiple storage backends.
20
+
21
+ ### Two-layer store design
22
+
23
+ - **`Lutaml::Store.new(adapter:, models:)`** — the primary entry point. Returns a `DatabaseStore` instance with model registry support, CRUD operations (`save`, `fetch`, `update`, `destroy`), polymorphic model handling, composite model relationships, and dot-notation nested updates.
24
+
25
+ - **`Lutaml::Store::BasicStore`** — the low-level key-value store providing `get`, `set`, `delete`, `exists?`, `all`, `keys`, and bulk operations. Wraps an adapter with optional caching, monitoring, and event emission.
26
+
27
+ ### Key classes in `lib/lutaml/store/`
28
+
29
+ | Class | Role |
30
+ |---|---|
31
+ | `DatabaseStore` | High-level CRUD with model registry, composite models, polymorphism |
32
+ | `BasicStore` | Low-level key-value store with optional cache/monitor/events |
33
+ | `CacheStore` | TTL-aware cache store extending `BasicStore` |
34
+ | `ModelRegistry` / `ModelRegistration` | Register models with their key fields and polymorphic config |
35
+ | `CompositeModelHandler` | Stores nested registered models independently, restores references |
36
+ | `AttributeUpdater` | Processes updates including dot-notation paths and block-based updates |
37
+ | `ModelSerializer` | Single point of serialization/deserialization for Lutaml::Model objects |
38
+ | `Config` | Parses and validates store configuration (adapter, cache, monitoring, compression) |
39
+
40
+ ### Storage adapters (`lib/lutaml/store/adapter/`)
41
+
42
+ All inherit from `Adapter::Base`. Three backends: `Memory`, `FileSystem`, `SQLite`. The `DatabaseStore` creates the adapter internally via `BasicStore`; the adapter type is passed as `adapter: :memory`, `adapter: { type: :filesystem, path: "..." }`, etc.
43
+
44
+ ### HTTP caching
45
+
46
+ `HttpCache` provides HTTP-aware caching with ETags, conditional requests (304), Cache-Control, and Vary header support. Used by lutaml-hal to avoid re-fetching HAL resources.
47
+
48
+ ### Serialization & integrity
49
+
50
+ `Compression` adds gzip support. `Integrity` provides SHA256 checksums for data verification (used by the FileSystem adapter).
51
+
52
+ ## Conventions
53
+
54
+ - Double-quoted strings (Rubocop enforced)
55
+ - Specs use `expect` syntax (no `should`)
56
+ - Documentation is in AsciiDoc (README.adoc, plan.adoc)
57
+ - Error hierarchy: `Lutaml::Store::Error` → `ConfigurationError`, `BackendError`, `ModelNotRegisteredError`, `InvalidKeyError`, `PolymorphicUpdateError`, `CompositeModelError`