fluent-plugin-cassandra-driver 0.0.3 → 0.0.4

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
  SHA1:
3
- metadata.gz: fca7029206d19969af19c9cf4efd8ea790039d83
4
- data.tar.gz: 2aac1bc2b292515c8257b9d3a2d9ef0718238398
3
+ metadata.gz: 7fa9360ff49643779a0c39ebc9813f1b5582ab74
4
+ data.tar.gz: 84a6538140f206f4747d0358cbb57eb48280da75
5
5
  SHA512:
6
- metadata.gz: 37410f2a120900a86717907432110bfd39c1f56396dc99f531a023464325764448b817a564812c312c23937001226cad6be269b6cfd3309ea6bb1c7a01ca34b7
7
- data.tar.gz: 100aadb2db5c245b5b387f57f001e7124fd15835de9be4862dfea64da1faaa2c98591c14c8920c474ba79ae22339c20ef899009455a0c3dfb19d988901e0595e
6
+ metadata.gz: 19f7040421c7df0c07b314be0d92341f63d13c394ff9cbc79c5d2e50ae304309fed6230f1723fe709fd9ab7940d9083f01204a9b31ddf60e86b560efdfaa5c22
7
+ data.tar.gz: 4f2ad26f097e0f793ed565e37951e72cab35d140cf34a59fd8dd251c194cb0efbe87d058e221304d1f343370b2d276f58d05ea68ce500b058397579ee6b2f402
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.0.4
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: fluent-plugin-cassandra-driver 0.0.3 ruby lib
5
+ # stub: fluent-plugin-cassandra-driver 0.0.4 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "fluent-plugin-cassandra-driver".freeze
9
- s.version = "0.0.3"
9
+ s.version = "0.0.4"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
@@ -27,8 +27,6 @@ Gem::Specification.new do |s|
27
27
  "Rakefile",
28
28
  "VERSION",
29
29
  "fluent-plugin-cassandra-driver.gemspec",
30
- "lib/fluent/plugin/mutators/string_mutator.rb",
31
- "lib/fluent/plugin/mutators/timeuuid_mutator.rb",
32
30
  "lib/fluent/plugin/out_cassandra_driver.rb",
33
31
  "spec/spec.opts",
34
32
  "spec/spec_helper.rb"
@@ -78,8 +78,6 @@ module Fluent
78
78
 
79
79
  private
80
80
 
81
- @mutators_map = {:string => ::CassandraDriver::StringMutator.new, :timeuuid => ::CassandraDriver::TimeuuidMutator.new}
82
-
83
81
  def get_session(hosts, keyspace)
84
82
  cluster = ::Cassandra.cluster(hosts: hosts)
85
83
 
@@ -90,9 +88,16 @@ module Fluent
90
88
  values = data_keys.map.with_index do |key, index|
91
89
  value = pop_data_keys ? record.delete(key) : record[key]
92
90
  type = self.schema[schema_keys[index]]
93
- mutator = @mutators_map.key?(type) ? @mutators_map[type] : nil
94
91
 
95
- mutator ? mutator.mutate(value) : value
92
+ case type
93
+ when :string
94
+ value = "'#{value}'"
95
+ when :timeuuid
96
+ value = Cassandra::Uuid::Generator.new.at(value).to_s
97
+ else
98
+ end
99
+
100
+ value
96
101
  end
97
102
 
98
103
  # if we have one more schema key than data keys,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-cassandra-driver
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yaroslav Lukyanov
@@ -125,8 +125,6 @@ files:
125
125
  - Rakefile
126
126
  - VERSION
127
127
  - fluent-plugin-cassandra-driver.gemspec
128
- - lib/fluent/plugin/mutators/string_mutator.rb
129
- - lib/fluent/plugin/mutators/timeuuid_mutator.rb
130
128
  - lib/fluent/plugin/out_cassandra_driver.rb
131
129
  - spec/spec.opts
132
130
  - spec/spec_helper.rb
@@ -1,7 +0,0 @@
1
- module CassandraDriver
2
- class StringMutator
3
- def mutate(value)
4
- "'#{value}'"
5
- end
6
- end
7
- end
@@ -1,11 +0,0 @@
1
- require 'cassandra'
2
-
3
- module CassandraDriver
4
- class TimeuuidMutator
5
- @generator = Cassandra::Uuid::Generator.new
6
-
7
- def mutate(value)
8
- @generator.at(value).to_s
9
- end
10
- end
11
- end