remote_files 3.7.0 → 3.8.0.pre.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '039a33d2003b7da6a18815b1663c5078b0f3e8bd439469282e8e629fad8cc934'
4
- data.tar.gz: c113130c97455d7b7698a4cf34d00e1501552f64c4ca1355d193e67990034740
3
+ metadata.gz: 60ccff05ac3537fbcb60f5fb2e1b900cc0f88e191598bfc208efce1f717c8f5a
4
+ data.tar.gz: c9fafbed33eee35177df55c548c13c4799037e8ef0b9e30aab814d4db67d6781
5
5
  SHA512:
6
- metadata.gz: d257ec5e612c589907606a393b532c7c075037f64ab939f380a5159767ad6e9c25473c8e9fad184274fa828d7ceac0023087abc9e345253a8b0192f82b8d2c26
7
- data.tar.gz: 78038598723c23add49fe33b64a8dc939695d61c3fbd0189ed32f5f66bdfbfff8b4c2fdb74bbba1eb0fae084b2bc6f950ac2111c0609bf0b935518769900d90e
6
+ metadata.gz: aefd4a5087bc7633f2683230f643ec5ade8fc1904d46fd9c0023a42a9a57f6ebebe24904e0d3422d0cc21fd999526e003a4f75ea772f9d06f76f71bc1a220b59
7
+ data.tar.gz: 85afca8032f05bb4da1b7afbf4946e7b6bfe1848fdcc2840b8754130873cc4e6dca45bf986060d84d76f32f741ac8c3bd02ef2038c973555916a18433e3f2482
data/README.md CHANGED
@@ -65,7 +65,7 @@ file.store!
65
65
  This will store the file on one of the stores and then asynchronously copy the file to the remaining stores.
66
66
  `RemoteFiles::File#store!` will raise a `RemoteFiles::Error` if all storage backends are down.
67
67
 
68
- If you just need to store the file in a single store, the you can use `RemoteFiles::File#store_once!`. It will
68
+ If you just need to store the file in a single store, then you can use `RemoteFiles::File#store_once!`. It will
69
69
  behave exactly like `RemoteFiles::File#store!`, but will not asynchronously copy the file to the other stores.
70
70
 
71
71
  ## Copyright and license
@@ -79,6 +79,20 @@ http://www.apache.org/licenses/LICENSE-2.0
79
79
 
80
80
  Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
81
81
 
82
+ ### Releasing a new version
83
+ A new version is published to RubyGems.org every time a change to `version.rb` is pushed to the `main` branch.
84
+ In short, follow these steps:
85
+ 1. Update `version.rb`,
86
+ 2. merge this change into `main`, and
87
+ 3. look at [the action](https://github.com/zendesk/remote_files/actions/workflows/publish.yml) for output.
88
+
89
+ To create a pre-release from a non-main branch:
90
+ 1. change the version in `version.rb` to something like `1.2.0.pre.1` or `2.0.0.beta.2`,
91
+ 2. push this change to your branch,
92
+ 3. go to [Actions → “Publish to RubyGems.org” on GitHub](https://github.com/zendesk/remote_files/actions/workflows/publish.yml),
93
+ 4. click the “Run workflow” button,
94
+ 5. pick your branch from a dropdown.
95
+
82
96
  ## Contributing
83
97
 
84
98
  1. Fork it
@@ -54,6 +54,10 @@ module RemoteFiles
54
54
  options[:read_only] == true
55
55
  end
56
56
 
57
+ def read_delete_only?
58
+ options[:read_delete_only] == true
59
+ end
60
+
57
61
  def file_from_url(url, options = {})
58
62
  matched = url_matcher.match(url)
59
63
 
@@ -57,7 +57,11 @@ module RemoteFiles
57
57
  store = (options[:class] || FogStore).new(store_identifier)
58
58
  block.call(store) if block_given?
59
59
 
60
- store[:read_only] = options[:read_only] if options.key?(:read_only)
60
+ if options[:read_delete_only]
61
+ store[:read_delete_only] = true
62
+ elsif options[:read_only]
63
+ store[:read_only] = true
64
+ end
61
65
 
62
66
  if options[:primary]
63
67
  @stores.unshift(store)
@@ -83,7 +87,7 @@ module RemoteFiles
83
87
  end
84
88
 
85
89
  def read_write_stores
86
- stores.reject {|s| s.read_only?}
90
+ stores.reject {|s| s.read_only? || s.read_delete_only?}
87
91
  end
88
92
 
89
93
  def lookup_store(store_identifier)
@@ -130,7 +134,7 @@ module RemoteFiles
130
134
 
131
135
  def delete_now!(file, parallel: false)
132
136
  exceptions = []
133
- stores = file.read_write_stores
137
+ stores = file.read_write_stores + file.read_delete_only_stores
134
138
 
135
139
  raise "No stores configured" if stores.empty?
136
140
 
@@ -151,8 +155,9 @@ module RemoteFiles
151
155
  true
152
156
  end
153
157
 
154
- # This method is used to delete a file from all stores in parallel
155
- # exceptions are passed back to the caller
158
+ # Deletes a file from all writable stores in parallel.
159
+ # When the file is missing the Future's value is set to NotFoundError exception.
160
+ # Re-raises any other exceptions, but doesn't prevent concurrent requests from being executed.
156
161
  def delete_in_parallel!(file, stores, exceptions)
157
162
  pool = Concurrent::FixedThreadPool.new(@max_delete_in_parallel)
158
163
 
@@ -167,7 +172,7 @@ module RemoteFiles
167
172
  end
168
173
 
169
174
  futures.each do |future|
170
- result = future.value
175
+ result = future.value!
171
176
  exceptions << result if result.is_a?(Exception)
172
177
  end
173
178
 
@@ -177,7 +182,7 @@ module RemoteFiles
177
182
 
178
183
  def synchronize!(file)
179
184
  file.missing_stores.each do |store|
180
- next if store.read_only?
185
+ next if store.read_only? || store.read_delete_only?
181
186
 
182
187
  store.store!(file)
183
188
  file.stored_in << store.identifier
@@ -55,7 +55,11 @@ module RemoteFiles
55
55
  end
56
56
 
57
57
  def read_write_stores
58
- stores.reject(&:read_only?)
58
+ stores.reject {|s| s.read_only? || s.read_delete_only? }
59
+ end
60
+
61
+ def read_delete_only_stores
62
+ stores.select(&:read_delete_only?)
59
63
  end
60
64
 
61
65
  def missing_stores
@@ -1,3 +1,3 @@
1
1
  module RemoteFiles
2
- VERSION = '3.7.0'
2
+ VERSION = '3.8.0.pre.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remote_files
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.7.0
4
+ version: 3.8.0.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mick Staugaard
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-10-31 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: fog-aws
@@ -75,7 +74,6 @@ homepage: https://github.com/zendesk/remote_files
75
74
  licenses:
76
75
  - Apache-2.0
77
76
  metadata: {}
78
- post_install_message:
79
77
  rdoc_options: []
80
78
  require_paths:
81
79
  - lib
@@ -90,8 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
90
88
  - !ruby/object:Gem::Version
91
89
  version: '0'
92
90
  requirements: []
93
- rubygems_version: 3.5.16
94
- signing_key:
91
+ rubygems_version: 3.6.7
95
92
  specification_version: 4
96
93
  summary: The purpose of the library is to implement a simple interface for uploading
97
94
  files to multiple backends and to keep the backends in sync, so that your app will