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 +4 -4
- data/CHANGELOG.md +6 -0
- data/fluent-plugin-hash-forward.gemspec +1 -1
- data/lib/fluent/plugin/out_hash_forward.rb +8 -1
- 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: d9127603fc704a673d2f0c52d30020d904a8c323
|
4
|
+
data.tar.gz: 341c3d13e9ecc904c240bf6577aa0d7b76cef369
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2709814587506f919699931022a34ae5e9bbef430536981dfd655d014f8f7437c75e20795f1c15c5ba00f7d6277c760ee777d4ed364ed0c9c6e553dae967338b
|
7
|
+
data.tar.gz: 3fe3a89e30072e15a6803e6e55af0a29153f74330ea4e5447f048d17597cfe50dac774848f14ee12f08ccce80ffe70432e06f1a9c6d0106e292171a8394dcbb6
|
data/CHANGELOG.md
CHANGED
@@ -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
|
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
|
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-
|
12
|
+
date: 2013-11-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: fluentd
|