fluent-plugin-dynamodb-alt 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/fluent-plugin-dynamodb-alt.gemspec +1 -1
- data/lib/fluent/plugin/out_dynamodb_alt.rb +12 -0
- data/spec/out_dynamodb_alt_spec.rb +21 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7a92c9fe9a41c6c1c7360d796a22cf7fd235259
|
4
|
+
data.tar.gz: 090c2a1de0e08e5730119dcc49e896556493f8b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84e9d9b2747a0bf6570efaa56e1ec49892032572cfa1380cc424bd30e5e9622ec3b9f1d11eca669a0189d2dc5d96ee3e1578b35b8a997af544dcb043d01e6be7
|
7
|
+
data.tar.gz: e73846a99a68e9033ee3a92a9300b7c987d148b5464e8655e9ecbcf6fadabe843356641d845483015ea591f59938c2cc12bebc528045f6ec596cf44020db59f5
|
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'fluent-plugin-dynamodb-alt'
|
7
|
-
spec.version = '0.1.
|
7
|
+
spec.version = '0.1.3'
|
8
8
|
spec.authors = ['Genki Sugawara']
|
9
9
|
spec.email = ['sgwr_dts@yahoo.co.jp']
|
10
10
|
spec.summary = %q{Fluent plugin to output to DynamoDB.}
|
@@ -28,6 +28,7 @@ class Fluent::DynamodbAltOutput < Fluent::BufferedOutput
|
|
28
28
|
super
|
29
29
|
require 'aws-sdk-core'
|
30
30
|
require 'parallel'
|
31
|
+
require 'set'
|
31
32
|
require 'stringio'
|
32
33
|
end
|
33
34
|
|
@@ -111,6 +112,7 @@ class Fluent::DynamodbAltOutput < Fluent::BufferedOutput
|
|
111
112
|
|
112
113
|
def put_record(record)
|
113
114
|
convert_binary!(record)
|
115
|
+
convert_set!(record)
|
114
116
|
|
115
117
|
item = {
|
116
118
|
:table_name => @table_name,
|
@@ -220,4 +222,14 @@ class Fluent::DynamodbAltOutput < Fluent::BufferedOutput
|
|
220
222
|
|
221
223
|
return record
|
222
224
|
end
|
225
|
+
|
226
|
+
def convert_set!(record)
|
227
|
+
record.each do |key, val|
|
228
|
+
if val.kind_of?(Array)
|
229
|
+
record[key] = Set.new(val)
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
return record
|
234
|
+
end
|
223
235
|
end
|
@@ -479,5 +479,26 @@ describe Fluent::DynamodbAltOutput do
|
|
479
479
|
]
|
480
480
|
end
|
481
481
|
}
|
482
|
+
|
483
|
+
context('set') {
|
484
|
+
it do
|
485
|
+
run_driver do |d|
|
486
|
+
d.emit({'id' => '12345678-1234-1234-1234-123456789001', 'timestamp' => 1409534625001, 'set' => [1, 2, 3]}, time)
|
487
|
+
d.emit({'id' => '12345678-1234-1234-1234-123456789002', 'timestamp' => 1409534625002, 'set' => ['1', '2', '3']}, time)
|
488
|
+
d.emit({'id' => '12345678-1234-1234-1234-123456789003', 'timestamp' => 1409534625003, 'set' => ['A', 'B', 'C']}, time)
|
489
|
+
end
|
490
|
+
|
491
|
+
rows = select_all.map do |row|
|
492
|
+
row['set'].sort!
|
493
|
+
row
|
494
|
+
end
|
495
|
+
|
496
|
+
expect(rows).to match_array [
|
497
|
+
{"id"=>"12345678-1234-1234-1234-123456789001", "timestamp"=>1409534625001, "set"=>[1, 2, 3]},
|
498
|
+
{"id"=>"12345678-1234-1234-1234-123456789002", "timestamp"=>1409534625002, "set"=>['1', '2', '3']},
|
499
|
+
{"id"=>"12345678-1234-1234-1234-123456789003", "timestamp"=>1409534625003, "set"=>['A', 'B', 'C']},
|
500
|
+
]
|
501
|
+
end
|
502
|
+
}
|
482
503
|
}
|
483
504
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent-plugin-dynamodb-alt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Genki Sugawara
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fluentd
|