valkyrie 3.2.0 → 3.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +55 -79
- data/.tool-versions +1 -1
- data/Appraisals +7 -12
- data/CHANGELOG.md +15 -0
- data/README.md +33 -0
- data/Rakefile +5 -1
- data/gemfiles/{activerecord_5_2.gemfile → activerecord_7_1.gemfile} +1 -1
- data/gemfiles/{activerecord_6_0.gemfile → activerecord_7_2.gemfile} +1 -1
- data/gemfiles/faraday_1.gemfile +1 -1
- data/lib/valkyrie/persistence/fedora/metadata_adapter.rb +21 -4
- data/lib/valkyrie/persistence/fedora/query_service.rb +1 -1
- data/lib/valkyrie/persistence/solr/model_converter.rb +1 -1
- data/lib/valkyrie/storage/fedora.rb +30 -7
- data/lib/valkyrie/version.rb +1 -1
- data/lib/valkyrie.rb +6 -1
- metadata +5 -6
- data/gemfiles/faraday_0.gemfile +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4fcef8213a3e959929dbdb15bffd20c70bf3a5a07ff977a4937271d137d51a7
|
4
|
+
data.tar.gz: 875ced504589316a4d837fbd4d2d8bfe2e590d0e5f5f3c792edefe1461575a25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 98945b1fdd7f8cce636eea9abf5fc44c05d8291d1955b22ff91e218e12b81f4b3b617f52d0c846b179e040f623665a62027c60de2b50c50d7b027a7008d78e12
|
7
|
+
data.tar.gz: 844db5f6507ff3678ffe3c253a29dedd7753d26da6495ffcf51e2a275e6175fc9a904361a5724ec385330366eb84eaf13acf66db014bc783201e2e06e11168fb
|
data/.circleci/config.yml
CHANGED
@@ -9,7 +9,7 @@ jobs:
|
|
9
9
|
type: "string"
|
10
10
|
ruby:
|
11
11
|
description: "Ruby version"
|
12
|
-
default: "
|
12
|
+
default: "3.1.6"
|
13
13
|
type: "string"
|
14
14
|
docker:
|
15
15
|
- image: cimg/ruby:<< parameters.ruby >>
|
@@ -96,57 +96,45 @@ workflows:
|
|
96
96
|
build:
|
97
97
|
jobs:
|
98
98
|
- build:
|
99
|
-
gemfile: "gemfiles/
|
100
|
-
ruby: 3.
|
101
|
-
name: "Ruby3-
|
99
|
+
gemfile: "gemfiles/activerecord_7_2.gemfile"
|
100
|
+
ruby: 3.3.5
|
101
|
+
name: "Ruby3-3_rails7-2"
|
102
102
|
- build:
|
103
|
-
gemfile: "gemfiles/
|
104
|
-
ruby: 3.
|
105
|
-
name: "Ruby3-
|
103
|
+
gemfile: "gemfiles/activerecord_7_1.gemfile"
|
104
|
+
ruby: 3.3.5
|
105
|
+
name: "Ruby3-3_rails7-1"
|
106
106
|
- build:
|
107
107
|
gemfile: "gemfiles/activerecord_7_0.gemfile"
|
108
|
-
ruby: 3.
|
109
|
-
name: "Ruby3-
|
108
|
+
ruby: 3.3.5
|
109
|
+
name: "Ruby3-3_rails7-0"
|
110
110
|
- build:
|
111
|
-
gemfile: "gemfiles/
|
112
|
-
ruby: 3.
|
113
|
-
name: "Ruby3-
|
111
|
+
gemfile: "gemfiles/activerecord_7_2.gemfile"
|
112
|
+
ruby: 3.2.5
|
113
|
+
name: "Ruby3-2_rails7-2"
|
114
|
+
- build:
|
115
|
+
gemfile: "gemfiles/activerecord_7_1.gemfile"
|
116
|
+
ruby: 3.2.5
|
117
|
+
name: "Ruby3-2_rails7-1"
|
114
118
|
- build:
|
115
119
|
gemfile: "gemfiles/activerecord_7_0.gemfile"
|
116
|
-
ruby: 3.
|
117
|
-
name: "Ruby3-
|
120
|
+
ruby: 3.2.5
|
121
|
+
name: "Ruby3-2_rails7-0"
|
118
122
|
- build:
|
119
|
-
gemfile: "gemfiles/
|
120
|
-
ruby: 3.
|
121
|
-
name: "Ruby3-
|
123
|
+
gemfile: "gemfiles/activerecord_7_2.gemfile"
|
124
|
+
ruby: 3.1.6
|
125
|
+
name: "Ruby3-1_rails7-2"
|
122
126
|
- build:
|
123
|
-
gemfile: "gemfiles/
|
124
|
-
ruby:
|
125
|
-
name: "
|
127
|
+
gemfile: "gemfiles/activerecord_7_1.gemfile"
|
128
|
+
ruby: 3.1.6
|
129
|
+
name: "Ruby3-1_rails7-1"
|
126
130
|
- build:
|
127
|
-
gemfile: "gemfiles/
|
128
|
-
ruby:
|
129
|
-
name: "
|
131
|
+
gemfile: "gemfiles/activerecord_7_0.gemfile"
|
132
|
+
ruby: 3.1.6
|
133
|
+
name: "Ruby3-1_rails7-0"
|
130
134
|
- build:
|
131
135
|
gemfile: "gemfiles/faraday_1.gemfile"
|
132
|
-
ruby:
|
136
|
+
ruby: 3.1.6
|
133
137
|
name: "Faraday1"
|
134
|
-
- build:
|
135
|
-
gemfile: "gemfiles/faraday_0.gemfile"
|
136
|
-
ruby: 2.7.7
|
137
|
-
name: "Faraday0"
|
138
|
-
- build:
|
139
|
-
gemfile: "gemfiles/activerecord_6_0.gemfile"
|
140
|
-
ruby: 2.6.10
|
141
|
-
name: "Ruby2-6_Rails6-0"
|
142
|
-
- build:
|
143
|
-
gemfile: "gemfiles/activerecord_5_2.gemfile"
|
144
|
-
ruby: 2.7.7
|
145
|
-
name: "Ruby2-7_Rails5-2"
|
146
|
-
- build:
|
147
|
-
gemfile: "gemfiles/activerecord_5_2.gemfile"
|
148
|
-
ruby: 2.6.10
|
149
|
-
name: "Ruby2-6_Rails5-2"
|
150
138
|
|
151
139
|
nightly:
|
152
140
|
triggers:
|
@@ -158,54 +146,42 @@ workflows:
|
|
158
146
|
- master
|
159
147
|
jobs:
|
160
148
|
- build:
|
161
|
-
gemfile: "gemfiles/
|
162
|
-
ruby: 3.
|
163
|
-
name: "Ruby3-
|
149
|
+
gemfile: "gemfiles/activerecord_7_2.gemfile"
|
150
|
+
ruby: 3.3.5
|
151
|
+
name: "Ruby3-3_rails7-2"
|
164
152
|
- build:
|
165
|
-
gemfile: "gemfiles/
|
166
|
-
ruby: 3.
|
167
|
-
name: "Ruby3-
|
153
|
+
gemfile: "gemfiles/activerecord_7_1.gemfile"
|
154
|
+
ruby: 3.3.5
|
155
|
+
name: "Ruby3-3_rails7-1"
|
168
156
|
- build:
|
169
157
|
gemfile: "gemfiles/activerecord_7_0.gemfile"
|
170
|
-
ruby: 3.
|
171
|
-
name: "Ruby3-
|
158
|
+
ruby: 3.3.5
|
159
|
+
name: "Ruby3-3_rails7-0"
|
172
160
|
- build:
|
173
|
-
gemfile: "gemfiles/
|
174
|
-
ruby: 3.
|
175
|
-
name: "Ruby3-
|
161
|
+
gemfile: "gemfiles/activerecord_7_2.gemfile"
|
162
|
+
ruby: 3.2.5
|
163
|
+
name: "Ruby3-2_rails7-2"
|
164
|
+
- build:
|
165
|
+
gemfile: "gemfiles/activerecord_7_1.gemfile"
|
166
|
+
ruby: 3.2.5
|
167
|
+
name: "Ruby3-2_rails7-1"
|
176
168
|
- build:
|
177
169
|
gemfile: "gemfiles/activerecord_7_0.gemfile"
|
178
|
-
ruby: 3.
|
179
|
-
name: "Ruby3-
|
170
|
+
ruby: 3.2.5
|
171
|
+
name: "Ruby3-2_rails7-0"
|
180
172
|
- build:
|
181
|
-
gemfile: "gemfiles/
|
182
|
-
ruby: 3.
|
183
|
-
name: "Ruby3-
|
173
|
+
gemfile: "gemfiles/activerecord_7_2.gemfile"
|
174
|
+
ruby: 3.1.6
|
175
|
+
name: "Ruby3-1_rails7-2"
|
184
176
|
- build:
|
185
|
-
gemfile: "gemfiles/
|
186
|
-
ruby:
|
187
|
-
name: "
|
177
|
+
gemfile: "gemfiles/activerecord_7_1.gemfile"
|
178
|
+
ruby: 3.1.6
|
179
|
+
name: "Ruby3-1_rails7-1"
|
188
180
|
- build:
|
189
|
-
gemfile: "gemfiles/
|
190
|
-
ruby:
|
191
|
-
name: "
|
181
|
+
gemfile: "gemfiles/activerecord_7_0.gemfile"
|
182
|
+
ruby: 3.1.6
|
183
|
+
name: "Ruby3-1_rails7-0"
|
192
184
|
- build:
|
193
185
|
gemfile: "gemfiles/faraday_1.gemfile"
|
194
|
-
ruby:
|
186
|
+
ruby: 3.1.6
|
195
187
|
name: "Faraday1"
|
196
|
-
- build:
|
197
|
-
gemfile: "gemfiles/faraday_0.gemfile"
|
198
|
-
ruby: 2.7.7
|
199
|
-
name: "Faraday0"
|
200
|
-
- build:
|
201
|
-
gemfile: "gemfiles/activerecord_6_0.gemfile"
|
202
|
-
ruby: 2.6.10
|
203
|
-
name: "Ruby2-6_Rails6-0"
|
204
|
-
- build:
|
205
|
-
gemfile: "gemfiles/activerecord_5_2.gemfile"
|
206
|
-
ruby: 2.7.7
|
207
|
-
name: "Ruby2-7_Rails5-2"
|
208
|
-
- build:
|
209
|
-
gemfile: "gemfiles/activerecord_5_2.gemfile"
|
210
|
-
ruby: 2.6.10
|
211
|
-
name: "Ruby2-6_Rails5-2"
|
data/.tool-versions
CHANGED
@@ -1 +1 @@
|
|
1
|
-
ruby
|
1
|
+
ruby 3.3.5
|
data/Appraisals
CHANGED
@@ -1,23 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
appraise "activerecord-7-
|
4
|
-
gem "activerecord", "~> 7.
|
5
|
-
end
|
6
|
-
|
7
|
-
appraise "activerecord-6-0" do
|
8
|
-
gem "activerecord", "~> 6.0.0"
|
3
|
+
appraise "activerecord-7-2" do
|
4
|
+
gem "activerecord", "~> 7.2.0"
|
9
5
|
end
|
10
6
|
|
11
|
-
appraise "activerecord-
|
12
|
-
gem "activerecord", "~>
|
7
|
+
appraise "activerecord-7-1" do
|
8
|
+
gem "activerecord", "~> 7.1.0"
|
13
9
|
end
|
14
10
|
|
15
|
-
appraise "
|
16
|
-
gem "
|
17
|
-
gem "activerecord", "~> 6.0.0"
|
11
|
+
appraise "activerecord-7-0" do
|
12
|
+
gem "activerecord", "~> 7.0.0"
|
18
13
|
end
|
19
14
|
|
20
15
|
appraise "faraday-1" do
|
21
16
|
gem "faraday", "~> 1.0"
|
22
|
-
gem "activerecord", "~>
|
17
|
+
gem "activerecord", "~> 7.0.0"
|
23
18
|
end
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,18 @@
|
|
1
|
+
# v3.4.0 2024-10-11
|
2
|
+
|
3
|
+
## Changes since last release
|
4
|
+
|
5
|
+
* Adds config setting index_tsim_only_threshold ([dchandekstark](https://github.com/dchandekstark))
|
6
|
+
* Fix related URIs for pairtree paths in Fedora. ([randalldfloyd](https://github.com/randalldfloyd))
|
7
|
+
* Return nil when #id_to_uri is passed empty strings. ([bwatson78](https://github.com/bwatson78))
|
8
|
+
* Add support for Ruby 3.3 and Rails 7.2 ([cjcolvar](https://github.com/cjcolvar))
|
9
|
+
|
10
|
+
# v3.3.0 2024-07-03
|
11
|
+
|
12
|
+
## Changes since last release
|
13
|
+
|
14
|
+
* Add support for configurable pairtree IDs in Fedora 6. ([randalldfloyd](https://github.com/randalldfloyd))
|
15
|
+
|
1
16
|
# v3.2.0 2024-04-10
|
2
17
|
|
3
18
|
## Changes since last release
|
data/README.md
CHANGED
@@ -234,6 +234,39 @@ config. If Fedora requires auth, you can also include that in the URL, e.g.:
|
|
234
234
|
fedora_version: 5
|
235
235
|
)
|
236
236
|
```
|
237
|
+
#### Pairtree paths in Fedora 4/6
|
238
|
+
Fedora 4 and 6.5+ support automatic creation of "pairtree" paths, which means that identifiers are stored in
|
239
|
+
a hashed directory structure to avoid excessive child nodes directly in the root node.
|
240
|
+
|
241
|
+
Unlike Fedora 4 where this is the default behavior, it has to be enabled via options in Fedora 6.5. This is
|
242
|
+
done by configuring both the count and length of the pairtree algorithm, so it needs to be configured
|
243
|
+
in the Fedora adapters so that both sides match.
|
244
|
+
|
245
|
+
In the following example, Fedora 6.5 is being started with options to create pairtree paths consisting of
|
246
|
+
4 segments, 2 characters in length:
|
247
|
+
|
248
|
+
```angular2html
|
249
|
+
CATALINA_OPTS=-Dfcrepo.home=/fcrepo-home ...
|
250
|
+
...
|
251
|
+
-Dfcrepo.pid.minter.length=2 -Dfcrepo.pid.minter.count=4
|
252
|
+
```
|
253
|
+
For the Fedora metadata/storage adapters to correctly translate identifiers into URI's, they should be initialized
|
254
|
+
like:
|
255
|
+
|
256
|
+
```angular2html
|
257
|
+
Valkyrie::Persistence::Fedora::MetadataAdapter.new(
|
258
|
+
connection: ::Ldp::Client.new("http://localhost:8080/fcrepo/rest"),
|
259
|
+
fedora_version: 6.5,
|
260
|
+
fedora_pairtree_count: 4,
|
261
|
+
fedora_pairtree_length: 2
|
262
|
+
)
|
263
|
+
```
|
264
|
+
|
265
|
+
In the configuration above, an ID of `AaBbCcDd` will be created in Fedora under the root node as `/Aa/Bb/Cc/Dd/AaBbCcDd`.
|
266
|
+
If count and length correctly match in the Fedora adapters, that same path will be calculated and returned.
|
267
|
+
|
268
|
+
Note that the configuration above is not required for pairtree paths to work correctly in Fedora 4, and automatic
|
269
|
+
pairtree creation is not supported under Fedora 5 or Fedora 6 < 6.5.
|
237
270
|
|
238
271
|
## Installing a Development environment
|
239
272
|
|
data/Rakefile
CHANGED
@@ -68,10 +68,14 @@ namespace :db do
|
|
68
68
|
ActiveRecord::Migrator.migrate(MIGRATIONS_DIR, version) do |migration|
|
69
69
|
scope.blank? || scope == migration.scope
|
70
70
|
end
|
71
|
-
|
71
|
+
elsif ActiveRecord.version < Gem::Version.new("7.2.0")
|
72
72
|
ActiveRecord::Base.connection.migration_context.migrate(version) do |migration|
|
73
73
|
scope.blank? || scope == migration.scope
|
74
74
|
end
|
75
|
+
else
|
76
|
+
ActiveRecord::MigrationContext.new(ActiveRecord::Migrator.migrations_paths).migrate(version) do |migration|
|
77
|
+
scope.blank? || scope == migration.scope
|
78
|
+
end
|
75
79
|
end
|
76
80
|
ActiveRecord::Base.clear_cache!
|
77
81
|
ensure
|
data/gemfiles/faraday_1.gemfile
CHANGED
@@ -9,17 +9,23 @@ module Valkyrie::Persistence::Fedora
|
|
9
9
|
# schema: Valkyrie::Persistence::Fedora::PermissiveSchema.new(title: RDF::URI("http://example.com/title"))
|
10
10
|
# )
|
11
11
|
class MetadataAdapter
|
12
|
-
attr_reader :connection, :base_path, :schema, :fedora_version
|
12
|
+
attr_reader :connection, :base_path, :schema, :fedora_version, :pairtree_count, :pairtree_length
|
13
13
|
|
14
14
|
# @param [Ldp::Client] connection
|
15
15
|
# @param [String] base_path
|
16
16
|
# @param [Valkyrie::Persistence::Fedora::PermissiveSchema] schema
|
17
17
|
# @param [Integer] fedora_version
|
18
|
-
|
18
|
+
# @param [Integer] fedora_pairtree_count
|
19
|
+
# @param [Integer] fedora_pairtree_length
|
20
|
+
def initialize(connection:, base_path: "/", schema: Valkyrie::Persistence::Fedora::PermissiveSchema.new, # rubocop:disable Metrics/ParameterLists
|
21
|
+
fedora_version: Valkyrie::Persistence::Fedora::DEFAULT_FEDORA_VERSION,
|
22
|
+
fedora_pairtree_count: 0, fedora_pairtree_length: 0)
|
19
23
|
@connection = connection
|
20
24
|
@base_path = base_path
|
21
25
|
@schema = schema
|
22
26
|
@fedora_version = fedora_version
|
27
|
+
@pairtree_count = fedora_pairtree_count
|
28
|
+
@pairtree_length = fedora_pairtree_length
|
23
29
|
end
|
24
30
|
|
25
31
|
# Construct the query service object using this adapter
|
@@ -58,7 +64,9 @@ module Valkyrie::Persistence::Fedora
|
|
58
64
|
# @param [RDF::URI] id the Valkyrie ID
|
59
65
|
# @return [RDF::URI]
|
60
66
|
def id_to_uri(id)
|
61
|
-
|
67
|
+
return if id.to_s.empty?
|
68
|
+
prefix = ""
|
69
|
+
prefix = "#{pair_path(id)}/" if fedora_version == 4 || (fedora_version >= 6.5 && (pairtree_count * pairtree_length).positive?)
|
62
70
|
RDF::URI("#{connection_prefix}/#{prefix}#{CGI.escape(id.to_s)}")
|
63
71
|
end
|
64
72
|
|
@@ -68,7 +76,16 @@ module Valkyrie::Persistence::Fedora
|
|
68
76
|
# @param [Valkyrie::ID] id the Valkyrie ID
|
69
77
|
# @return [Array<String>]
|
70
78
|
def pair_path(id)
|
71
|
-
|
79
|
+
if fedora_version >= 6.5
|
80
|
+
# When configurable, pair the part up to count * length, but only up to a slash
|
81
|
+
pair_part = id.to_s[0, pairtree_count * pairtree_length].split(/[\/]/).first
|
82
|
+
slice_length = pairtree_length
|
83
|
+
else
|
84
|
+
# When not configurable, pair the full string, but only up to a dash or slash
|
85
|
+
pair_part = id.to_s.split(/[-\/]/).first
|
86
|
+
slice_length = 2
|
87
|
+
end
|
88
|
+
pair_part.split("").each_slice(slice_length).map(&:join).join("/")
|
72
89
|
end
|
73
90
|
|
74
91
|
def url_prefix
|
@@ -52,7 +52,7 @@ module Valkyrie::Persistence::Fedora
|
|
52
52
|
# @return [Array<RDF::URI>]
|
53
53
|
def include_uris
|
54
54
|
[
|
55
|
-
|
55
|
+
adapter.fedora_version >= 5 ? "http://fedora.info/definitions/fcrepo#PreferInboundReferences" : ::RDF::Vocab::Fcrepo4.InboundReferences
|
56
56
|
]
|
57
57
|
end
|
58
58
|
|
@@ -422,7 +422,7 @@ module Valkyrie::Persistence::Solr
|
|
422
422
|
# @see https://github.com/samvera-labs/valkyrie/blob/main/solr/config/schema.xml
|
423
423
|
# @return [Array<Symbol>]
|
424
424
|
def fields
|
425
|
-
if value.value.length >
|
425
|
+
if value.value.length > Valkyrie.config.index_tsim_only_threshold
|
426
426
|
[:tsim]
|
427
427
|
else
|
428
428
|
[:tsim, :ssim, :tesim, :tsi, :ssi, :tesi]
|
@@ -2,15 +2,26 @@
|
|
2
2
|
module Valkyrie::Storage
|
3
3
|
# Implements the DataMapper Pattern to store binary data in fedora
|
4
4
|
class Fedora
|
5
|
-
attr_reader :connection, :base_path, :fedora_version
|
5
|
+
attr_reader :connection, :base_path, :fedora_version, :pairtree_count, :pairtree_length, :uri_transformer
|
6
6
|
PROTOCOL = 'fedora://'
|
7
7
|
SLASH = '/'
|
8
8
|
|
9
9
|
# @param [Ldp::Client] connection
|
10
|
-
|
10
|
+
# @param [Integer] fedora_pairtree_count
|
11
|
+
# @param [Integer] fedora_pairtree_length
|
12
|
+
def initialize(connection:, base_path: "/", fedora_version: Valkyrie::Persistence::Fedora::DEFAULT_FEDORA_VERSION,
|
13
|
+
fedora_pairtree_count: 0, fedora_pairtree_length: 0)
|
11
14
|
@connection = connection
|
12
15
|
@base_path = base_path
|
13
16
|
@fedora_version = fedora_version
|
17
|
+
@pairtree_count = fedora_pairtree_count
|
18
|
+
@pairtree_length = fedora_pairtree_length
|
19
|
+
|
20
|
+
@uri_transformer = if fedora_version >= 6.5 && (pairtree_count * pairtree_length).positive?
|
21
|
+
pairtree_resource_uri_transformer
|
22
|
+
else
|
23
|
+
default_resource_uri_transformer
|
24
|
+
end
|
14
25
|
end
|
15
26
|
|
16
27
|
# @param id [Valkyrie::ID]
|
@@ -24,7 +35,7 @@ module Valkyrie::Storage
|
|
24
35
|
def supports?(feature)
|
25
36
|
return true if feature == :versions
|
26
37
|
# Fedora 6 auto versions and you can't delete versions.
|
27
|
-
return true if feature == :version_deletion && fedora_version
|
38
|
+
return true if feature == :version_deletion && fedora_version < 6
|
28
39
|
false
|
29
40
|
end
|
30
41
|
|
@@ -44,7 +55,7 @@ module Valkyrie::Storage
|
|
44
55
|
# @param extra_arguments [Hash] additional arguments which may be passed to other adapters
|
45
56
|
# @return [Valkyrie::StorageAdapter::StreamFile]
|
46
57
|
def upload(file:, original_filename:, resource:, content_type: "application/octet-stream", # rubocop:disable Metrics/ParameterLists
|
47
|
-
resource_uri_transformer:
|
58
|
+
resource_uri_transformer: uri_transformer, **_extra_arguments)
|
48
59
|
identifier = resource_uri_transformer.call(resource, base_url) + '/original'
|
49
60
|
upload_file(fedora_uri: identifier, io: file, content_type: content_type, original_filename: original_filename)
|
50
61
|
# Fedora 6 auto versions, so check to see if there's a version for this
|
@@ -60,7 +71,7 @@ module Valkyrie::Storage
|
|
60
71
|
uri = fedora_identifier(id: id)
|
61
72
|
# Fedora 6 has auto versioning, so have to sleep if it's too soon after last
|
62
73
|
# upload.
|
63
|
-
if fedora_version
|
74
|
+
if fedora_version >= 6 && current_version_id(id: id).to_s.split("/").last == Time.current.utc.strftime("%Y%m%d%H%M%S")
|
64
75
|
sleep(0.5)
|
65
76
|
return upload_version(id: id, file: file)
|
66
77
|
end
|
@@ -102,7 +113,7 @@ module Valkyrie::Storage
|
|
102
113
|
end
|
103
114
|
|
104
115
|
def upload_file(fedora_uri:, io:, content_type: "application/octet-stream", original_filename: "default")
|
105
|
-
sha1 =
|
116
|
+
sha1 = fedora_version >= 5 ? "sha" : "sha1"
|
106
117
|
connection.http.put do |request|
|
107
118
|
request.url fedora_uri
|
108
119
|
request.headers['Content-Type'] = content_type
|
@@ -141,7 +152,7 @@ module Valkyrie::Storage
|
|
141
152
|
version_id ||= id if id != current_id
|
142
153
|
# No version got passed and we're asking for a current_id, gotta get the
|
143
154
|
# version ID
|
144
|
-
return perform_find(id: current_id, version_id:
|
155
|
+
return perform_find(id: current_id, version_id: current_version_id(id: id) || :empty) if version_id.nil?
|
145
156
|
Valkyrie::StorageAdapter::StreamFile.new(id: current_id, io: response(id: id), version_id: version_id)
|
146
157
|
end
|
147
158
|
|
@@ -211,6 +222,18 @@ module Valkyrie::Storage
|
|
211
222
|
end
|
212
223
|
end
|
213
224
|
|
225
|
+
def pairtree_resource_uri_transformer
|
226
|
+
lambda do |resource, base_url|
|
227
|
+
id = CGI.escape(resource.id.to_s)
|
228
|
+
return RDF::URI.new(base_url + id) unless (pairtree_count * pairtree_length).positive?
|
229
|
+
|
230
|
+
pair_part = id.to_s[0, pairtree_count * pairtree_length].split(/[\/]/).first
|
231
|
+
slice_length = pairtree_length
|
232
|
+
prefix = pair_part.split("").each_slice(slice_length).map(&:join).join("/")
|
233
|
+
RDF::URI.new(base_url + "#{prefix}/" + id)
|
234
|
+
end
|
235
|
+
end
|
236
|
+
|
214
237
|
def base_url
|
215
238
|
pre_divider = base_path.starts_with?(SLASH) ? '' : SLASH
|
216
239
|
post_divider = base_path.ends_with?(SLASH) ? '' : SLASH
|
data/lib/valkyrie/version.rb
CHANGED
data/lib/valkyrie.rb
CHANGED
@@ -97,6 +97,10 @@ module Valkyrie
|
|
97
97
|
Valkyrie::StorageAdapter.find(self[:storage_adapter].to_sym)
|
98
98
|
end
|
99
99
|
|
100
|
+
def index_tsim_only_threshold
|
101
|
+
self[:index_tsim_only_threshold].to_i
|
102
|
+
end
|
103
|
+
|
100
104
|
# @api public
|
101
105
|
#
|
102
106
|
# The returned anonymous method (e.g. responds to #call) has a signature of
|
@@ -118,7 +122,8 @@ module Valkyrie
|
|
118
122
|
|
119
123
|
def defaults
|
120
124
|
{
|
121
|
-
resource_class_resolver: method(:default_resource_class_resolver)
|
125
|
+
resource_class_resolver: method(:default_resource_class_resolver),
|
126
|
+
index_tsim_only_threshold: 1000
|
122
127
|
}
|
123
128
|
end
|
124
129
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: valkyrie
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Trey Pendragon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-struct
|
@@ -452,10 +452,9 @@ files:
|
|
452
452
|
- db/migrate/20180212092225_create_updated_at_index.rb
|
453
453
|
- db/migrate/20180802220739_add_optimistic_locking_to_orm_resources.rb
|
454
454
|
- db/schema.rb
|
455
|
-
- gemfiles/activerecord_5_2.gemfile
|
456
|
-
- gemfiles/activerecord_6_0.gemfile
|
457
455
|
- gemfiles/activerecord_7_0.gemfile
|
458
|
-
- gemfiles/
|
456
|
+
- gemfiles/activerecord_7_1.gemfile
|
457
|
+
- gemfiles/activerecord_7_2.gemfile
|
459
458
|
- gemfiles/faraday_1.gemfile
|
460
459
|
- lib/valkyrie.rb
|
461
460
|
- lib/valkyrie/adapter_container.rb
|
@@ -582,7 +581,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
582
581
|
- !ruby/object:Gem::Version
|
583
582
|
version: '0'
|
584
583
|
requirements: []
|
585
|
-
rubygems_version: 3.
|
584
|
+
rubygems_version: 3.5.16
|
586
585
|
signing_key:
|
587
586
|
specification_version: 4
|
588
587
|
summary: An ORM using the Data Mapper pattern, specifically built to solve Digital
|
data/gemfiles/faraday_0.gemfile
DELETED