fluent-plugin-hash-forward 0.0.3 → 0.1.0

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: 67c2e4d3c4371b6f3ee286355aa263c508d5ac3a
4
- data.tar.gz: bace3f46951ee47745f783dab9b49e42cee52944
3
+ metadata.gz: d9127603fc704a673d2f0c52d30020d904a8c323
4
+ data.tar.gz: 341c3d13e9ecc904c240bf6577aa0d7b76cef369
5
5
  SHA512:
6
- metadata.gz: 7271456aad10bb6d15a707cc076e6a1391cf34cef41d347848a3033e171d54be0d3270f5c189aaf66a5e2f2e7056540dbc5ee032250ed7fe319ba20e30791deb
7
- data.tar.gz: a808d47d2c9c64ea383f3c2e50599a5c95ee946c7f04665d02013ca761b3101174a1321f1d11353b01fe89116bd1a32cffea6c1ced9cd8cc7e7a0b032ba9d3e5
6
+ metadata.gz: 2709814587506f919699931022a34ae5e9bbef430536981dfd655d014f8f7437c75e20795f1c15c5ba00f7d6277c760ee777d4ed364ed0c9c6e553dae967338b
7
+ data.tar.gz: 3fe3a89e30072e15a6803e6e55af0a29153f74330ea4e5447f048d17597cfe50dac774848f14ee12f08ccce80ffe70432e06f1a9c6d0106e292171a8394dcbb6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ # 0.1.0 (2013/11/02)
2
+
3
+ Enhancement
4
+
5
+ * Cache nodes
6
+
1
7
  # 0.0.3 (2013/11/01)
2
8
 
3
9
  Changes
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "fluent-plugin-hash-forward"
6
- s.version = "0.0.3"
6
+ s.version = "0.1.0"
7
7
  s.authors = ["Ryosuke IWANAGA", "Naotoshi SEO"]
8
8
  s.email = ["riywo.jp@gmail.com", "sonots@gmail.com"]
9
9
  s.homepage = "https://github.com/riywo/fluent-plugin-hash-forward"
@@ -18,6 +18,8 @@ class Fluent::HashForwardOutput < Fluent::ForwardOutput
18
18
  @hash_key_slice_rindex = rindex.to_i
19
19
  end
20
20
  end
21
+
22
+ @cache_nodes = {}
21
23
  end
22
24
 
23
25
  # for test
@@ -60,10 +62,14 @@ class Fluent::HashForwardOutput < Fluent::ForwardOutput
60
62
 
61
63
  # Get nodes (a regular_node and a standby_node if available) using hash algorithm
62
64
  def nodes(tag)
65
+ if nodes = @cache_nodes[tag]
66
+ return nodes
67
+ end
63
68
  hash_key = @hash_key_slice ? perform_hash_key_slice(tag) : tag
64
69
  regular_index = get_index(hash_key, regular_nodes.size)
65
70
  standby_index = standby_nodes.size > 0 ? get_index(hash_key, standby_nodes.size) : 0
66
- [regular_nodes[regular_index], standby_nodes[standby_index]].compact
71
+ nodes = [regular_nodes[regular_index], standby_nodes[standby_index]].compact
72
+ @cache_nodes[tag] = nodes
67
73
  end
68
74
 
69
75
  # hashing(key) mod N
@@ -72,6 +78,7 @@ class Fluent::HashForwardOutput < Fluent::ForwardOutput
72
78
  end
73
79
 
74
80
  # the simplest hashing ever
81
+ # https://gist.github.com/sonots/7263495
75
82
  def str_hash(key)
76
83
  key.bytes.inject(&:+)
77
84
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-hash-forward
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryosuke IWANAGA
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-01 00:00:00.000000000 Z
12
+ date: 2013-11-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: fluentd