fluent-plugin-gcs 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e6bc239a1a47a29d4cc3dc94aaaafc5e3ed6ed20e23e0ea9807c88309ec1f7a0
4
- data.tar.gz: c27f4d556b545ffb6050a72dcc9ff6a7fcfc53d16f44bce305f14560a4482725
3
+ metadata.gz: 06b8bb5edbdcbf288abdadf04670aba1ce83ce1e9f1f8d2ccfae29c543a6b87e
4
+ data.tar.gz: 2678dbe5a7bdd06149be0cd8bd4bfb0b65557b842c58790b0db7680ba4f58d82
5
5
  SHA512:
6
- metadata.gz: 3eb03cfb810bf23d8447391145cd8ba6cf6379f1730e1c486a35bcafcb66fdf5b953741b5913b0255bc5969914fc1fda4e37110fe76eb7bf21f65d441466bedb
7
- data.tar.gz: 85bcc85ab97e567a872893cfb890b7920343ff0010adf5d7c6d5b36f5ff952640bac4f42b90d811f1f1b6717c1691c40f6581d66a6da45135711a030dcf6b297
6
+ metadata.gz: 67857cecbfc047d0f8e2dbbf0cf3065a3f0b0a11ce08bf277574060f0238648ef36ca4f5d8f498af4a30632a13d81112cc0ae9a55846bb7aaf3703260df07260
7
+ data.tar.gz: ae8f1b545dc3b89f8209597addff218ec713040970ab3bdc4dd4db35acf4482927d9f41ccad3a90bc8c9eb0a66d20ba3116d3c06839772669181350d54dd266c
@@ -12,9 +12,9 @@ jobs:
12
12
  strategy:
13
13
  fail-fast: false
14
14
  matrix:
15
- ruby-version: ['2.7', '3.0', '3.1']
15
+ ruby-version: ['3.1', '3.2']
16
16
  steps:
17
- - uses: actions/checkout@v3
17
+ - uses: actions/checkout@v4
18
18
  - name: Set up Ruby
19
19
  uses: ruby/setup-ruby@v1
20
20
  with:
data/.gitignore CHANGED
@@ -7,3 +7,4 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ /vendor/
@@ -1,5 +1,5 @@
1
1
  module Fluent
2
2
  module GCSPlugin
3
- VERSION = "0.4.2"
3
+ VERSION = "0.4.3"
4
4
  end
5
5
  end
@@ -15,6 +15,7 @@ module Fluent::Plugin
15
15
  def initialize
16
16
  super
17
17
  require "google/cloud/storage"
18
+ Google::Apis.logger = log
18
19
  end
19
20
 
20
21
  config_param :project, :string, default: nil,
@@ -159,7 +160,7 @@ module Fluent::Plugin
159
160
  end
160
161
  end
161
162
 
162
- def generate_path(chunk, i = 0, prev = nil)
163
+ def generate_path(chunk)
163
164
  metadata = chunk.metadata
164
165
  time_slice = if metadata.timekey.nil?
165
166
  ''.freeze
@@ -170,23 +171,34 @@ module Fluent::Plugin
170
171
  "%{file_extension}" => @object_creator.file_extension,
171
172
  "%{hex_random}" => hex_random(chunk),
172
173
  "%{hostname}" => Socket.gethostname,
173
- "%{index}" => i,
174
174
  "%{path}" => @path,
175
175
  "%{time_slice}" => time_slice,
176
- "%{uuid_flush}" => SecureRandom.uuid,
177
176
  }
178
- path = @object_key_format.gsub(Regexp.union(tags.keys), tags)
179
- path = extract_placeholders(path, chunk)
180
- return path unless check_object_exists(path)
181
-
182
- if path == prev
183
- if @overwrite
184
- log.warn "object `#{path}` already exists but overwrites it"
185
- return path
177
+
178
+ prev = nil
179
+ i = 0
180
+
181
+ until i < 0 do # Until overflow
182
+ tags["%{uuid_flush}"] = SecureRandom.uuid
183
+ tags["%{index}"] = i
184
+
185
+ path = @object_key_format.gsub(Regexp.union(tags.keys), tags)
186
+ path = extract_placeholders(path, chunk)
187
+ return path unless check_object_exists(path)
188
+
189
+ if path == prev
190
+ if @overwrite
191
+ log.warn "object `#{path}` already exists but overwrites it"
192
+ return path
193
+ end
194
+ raise "object `#{path}` already exists"
186
195
  end
187
- raise "object `#{path}` already exists"
196
+
197
+ i += 1
198
+ prev = path
188
199
  end
189
- generate_path(chunk, i + 1, path)
200
+
201
+ raise "cannot find an unoccupied GCS path"
190
202
  end
191
203
 
192
204
  # This is stolen from Fluentd
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-gcs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daichi HIRATA
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-16 00:00:00.000000000 Z
11
+ date: 2023-09-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd