lutaml-store 0.2.4 → 0.3.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 +4 -4
- data/README.adoc +56 -0
- data/docs/astro.config.mjs +12 -0
- data/docs/package-lock.json +6098 -0
- data/docs/package.json +18 -0
- data/docs/public/favicon.svg +1 -0
- data/docs/public/lutaml-logo_logo-full-dark.svg +1 -0
- data/docs/public/lutaml-logo_logo-full-light.svg +1 -0
- data/docs/src/layouts/Base.astro +44 -0
- data/docs/src/layouts/Docs.astro +41 -0
- data/docs/src/pages/adapters.md +46 -0
- data/docs/src/pages/architecture.md +68 -0
- data/docs/src/pages/cloud-contract.md +48 -0
- data/docs/src/pages/formats.md +54 -0
- data/docs/src/pages/http-cache.md +43 -0
- data/docs/src/pages/index.md +82 -0
- data/docs/src/pages/quick-start.md +109 -0
- data/docs/src/pages/sources.md +83 -0
- data/docs/src/pages/stores.md +110 -0
- data/docs/src/styles/global.css +10 -0
- data/lib/lutaml/store/format.rb +13 -0
- data/lib/lutaml/store/manifest.rb +85 -0
- data/lib/lutaml/store/mirror.rb +94 -0
- data/lib/lutaml/store/repository.rb +178 -0
- data/lib/lutaml/store/source/base.rb +137 -0
- data/lib/lutaml/store/source/directory.rb +49 -0
- data/lib/lutaml/store/source/https.rb +109 -0
- data/lib/lutaml/store/source/rest.rb +61 -0
- data/lib/lutaml/store/source/zip.rb +52 -0
- data/lib/lutaml/store/source.rb +55 -0
- data/lib/lutaml/store/version.rb +1 -1
- data/lib/lutaml/store.rb +5 -0
- metadata +30 -6
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Lutaml
|
|
4
|
+
module Store
|
|
5
|
+
# Read-only views over a LutaML data repository.
|
|
6
|
+
#
|
|
7
|
+
# A source answers four questions about a remote or local collection of
|
|
8
|
+
# LutaML records: does a key exist, what are its bytes, which keys exist,
|
|
9
|
+
# and what does the repository's manifest declare. Sources never write.
|
|
10
|
+
#
|
|
11
|
+
# Selection is explicit: `Source.for(type, options)` raises
|
|
12
|
+
# `ConfigurationError` for a missing option — there is no discovery,
|
|
13
|
+
# no environment guessing and no fallback between sources. Consumers
|
|
14
|
+
# compose sources with {Repository} for caching policies.
|
|
15
|
+
module Source
|
|
16
|
+
autoload :Base, "lutaml/store/source/base"
|
|
17
|
+
autoload :Directory, "lutaml/store/source/directory"
|
|
18
|
+
autoload :Zip, "lutaml/store/source/zip"
|
|
19
|
+
autoload :Https, "lutaml/store/source/https"
|
|
20
|
+
autoload :Rest, "lutaml/store/source/rest"
|
|
21
|
+
|
|
22
|
+
TYPES = {
|
|
23
|
+
directory: "Directory",
|
|
24
|
+
zip: "Zip",
|
|
25
|
+
https: "Https",
|
|
26
|
+
rest: "Rest"
|
|
27
|
+
}.freeze
|
|
28
|
+
|
|
29
|
+
class << self
|
|
30
|
+
# Builds an explicitly configured source.
|
|
31
|
+
#
|
|
32
|
+
# @param type [Symbol] one of {TYPES}
|
|
33
|
+
# @param options [Hash] passed to the source class
|
|
34
|
+
# @return [Source::Base]
|
|
35
|
+
def for(type, **options)
|
|
36
|
+
name = TYPES[type.to_sym]
|
|
37
|
+
raise ConfigurationError, "unknown source type: #{type.inspect}" unless name
|
|
38
|
+
|
|
39
|
+
Source.const_get(name).new(**options)
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# A key is percent-encoded into exactly one path segment, so storage
|
|
43
|
+
# keys like "RFC 3986" or "ISO/IEC DIR 1" map to one file each on
|
|
44
|
+
# every platform. The manifest keeps the real key.
|
|
45
|
+
def encode_key(key)
|
|
46
|
+
CGI.escape(key.to_s)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
def decode_key(segment)
|
|
50
|
+
CGI.unescape(segment.to_s)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
data/lib/lutaml/store/version.rb
CHANGED
data/lib/lutaml/store.rb
CHANGED
|
@@ -5,6 +5,7 @@ module Lutaml
|
|
|
5
5
|
class Error < StandardError; end
|
|
6
6
|
class ConfigurationError < Error; end
|
|
7
7
|
class BackendError < Error; end
|
|
8
|
+
class NotFoundError < Error; end
|
|
8
9
|
class ModelNotRegisteredError < Error; end
|
|
9
10
|
class InvalidKeyError < Error; end
|
|
10
11
|
class PolymorphicUpdateError < Error; end
|
|
@@ -39,6 +40,10 @@ module Lutaml
|
|
|
39
40
|
autoload :HttpCacheConfig, "lutaml/store/http_cache_config"
|
|
40
41
|
autoload :HttpCacheEntry, "lutaml/store/http_cache_entry"
|
|
41
42
|
autoload :HttpHeaderProcessor, "lutaml/store/http_header_processor"
|
|
43
|
+
autoload :Manifest, "lutaml/store/manifest"
|
|
44
|
+
autoload :Mirror, "lutaml/store/mirror"
|
|
45
|
+
autoload :Repository, "lutaml/store/repository"
|
|
46
|
+
autoload :Source, "lutaml/store/source"
|
|
42
47
|
|
|
43
48
|
def self.new(adapter:, models: [], **options)
|
|
44
49
|
DatabaseStore.new(adapter: adapter, models: models, **options)
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: lutaml-store
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.3.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ronald Tse
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: lutaml-model
|
|
@@ -61,6 +60,24 @@ files:
|
|
|
61
60
|
- CODE_OF_CONDUCT.md
|
|
62
61
|
- README.adoc
|
|
63
62
|
- Rakefile
|
|
63
|
+
- docs/astro.config.mjs
|
|
64
|
+
- docs/package-lock.json
|
|
65
|
+
- docs/package.json
|
|
66
|
+
- docs/public/favicon.svg
|
|
67
|
+
- docs/public/lutaml-logo_logo-full-dark.svg
|
|
68
|
+
- docs/public/lutaml-logo_logo-full-light.svg
|
|
69
|
+
- docs/src/layouts/Base.astro
|
|
70
|
+
- docs/src/layouts/Docs.astro
|
|
71
|
+
- docs/src/pages/adapters.md
|
|
72
|
+
- docs/src/pages/architecture.md
|
|
73
|
+
- docs/src/pages/cloud-contract.md
|
|
74
|
+
- docs/src/pages/formats.md
|
|
75
|
+
- docs/src/pages/http-cache.md
|
|
76
|
+
- docs/src/pages/index.md
|
|
77
|
+
- docs/src/pages/quick-start.md
|
|
78
|
+
- docs/src/pages/sources.md
|
|
79
|
+
- docs/src/pages/stores.md
|
|
80
|
+
- docs/src/styles/global.css
|
|
64
81
|
- lib/lutaml/store.rb
|
|
65
82
|
- lib/lutaml/store/adapter.rb
|
|
66
83
|
- lib/lutaml/store/adapter/base.rb
|
|
@@ -90,6 +107,8 @@ files:
|
|
|
90
107
|
- lib/lutaml/store/http_cache_entry.rb
|
|
91
108
|
- lib/lutaml/store/http_header_processor.rb
|
|
92
109
|
- lib/lutaml/store/integrity.rb
|
|
110
|
+
- lib/lutaml/store/manifest.rb
|
|
111
|
+
- lib/lutaml/store/mirror.rb
|
|
93
112
|
- lib/lutaml/store/model_registration.rb
|
|
94
113
|
- lib/lutaml/store/model_registry.rb
|
|
95
114
|
- lib/lutaml/store/model_serializer.rb
|
|
@@ -102,6 +121,13 @@ files:
|
|
|
102
121
|
- lib/lutaml/store/package_transport/zip_transport.rb
|
|
103
122
|
- lib/lutaml/store/predicate.rb
|
|
104
123
|
- lib/lutaml/store/query.rb
|
|
124
|
+
- lib/lutaml/store/repository.rb
|
|
125
|
+
- lib/lutaml/store/source.rb
|
|
126
|
+
- lib/lutaml/store/source/base.rb
|
|
127
|
+
- lib/lutaml/store/source/directory.rb
|
|
128
|
+
- lib/lutaml/store/source/https.rb
|
|
129
|
+
- lib/lutaml/store/source/rest.rb
|
|
130
|
+
- lib/lutaml/store/source/zip.rb
|
|
105
131
|
- lib/lutaml/store/storage_key.rb
|
|
106
132
|
- lib/lutaml/store/version.rb
|
|
107
133
|
- sig/lutaml/store.rbs
|
|
@@ -113,7 +139,6 @@ metadata:
|
|
|
113
139
|
source_code_uri: https://github.com/lutaml/lutaml-store
|
|
114
140
|
changelog_uri: https://github.com/lutaml/lutaml-store
|
|
115
141
|
rubygems_mfa_required: 'true'
|
|
116
|
-
post_install_message:
|
|
117
142
|
rdoc_options: []
|
|
118
143
|
require_paths:
|
|
119
144
|
- lib
|
|
@@ -128,8 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
128
153
|
- !ruby/object:Gem::Version
|
|
129
154
|
version: '0'
|
|
130
155
|
requirements: []
|
|
131
|
-
rubygems_version:
|
|
132
|
-
signing_key:
|
|
156
|
+
rubygems_version: 4.0.16
|
|
133
157
|
specification_version: 4
|
|
134
158
|
summary: Store-centric database-style API for Lutaml::Model with multi-backend persistence.
|
|
135
159
|
test_files: []
|