triglav-agent 1.0.0.rc1 → 1.0.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/Triglav.html +1 -1
- data/docs/Triglav/Agent.html +4 -4
- data/docs/Triglav/Agent/ApiClient.html +1 -1
- data/docs/Triglav/Agent/ApiClient/AuthenticationError.html +1 -1
- data/docs/Triglav/Agent/ApiClient/ConnectionError.html +1 -1
- data/docs/Triglav/Agent/ApiClient/Error.html +1 -1
- data/docs/Triglav/Agent/Base.html +1 -1
- data/docs/Triglav/Agent/Base/CLI.html +1 -1
- data/docs/Triglav/Agent/Base/Connection.html +1 -1
- data/docs/Triglav/Agent/Base/Monitor.html +1 -1
- data/docs/Triglav/Agent/Base/Processor.html +20 -20
- data/docs/Triglav/Agent/Base/Setting.html +1 -1
- data/docs/Triglav/Agent/Base/Worker.html +36 -32
- data/docs/Triglav/Agent/Configuration.html +1 -1
- data/docs/Triglav/Agent/Error.html +1 -1
- data/docs/Triglav/Agent/HashUtil.html +1 -1
- data/docs/Triglav/Agent/LogFormatter.html +1 -1
- data/docs/Triglav/Agent/Logger.html +1 -1
- data/docs/Triglav/Agent/Status.html +850 -0
- data/docs/Triglav/Agent/StorageFile.html +155 -28
- data/docs/Triglav/Agent/Timer.html +1 -1
- data/docs/Triglav/Agent/TooManyError.html +1 -1
- data/docs/_index.html +8 -1
- data/docs/class_list.html +1 -1
- data/docs/file.LICENSE.html +1 -1
- data/docs/file.README.html +2 -2
- data/docs/index.html +2 -2
- data/docs/method_list.html +140 -52
- data/docs/top-level-namespace.html +1 -1
- data/lib/triglav/agent/status.rb +13 -0
- data/lib/triglav/agent/storage_file.rb +18 -0
- data/lib/triglav/agent/version.rb +1 -1
- metadata +3 -2
@@ -102,7 +102,7 @@
|
|
102
102
|
</div>
|
103
103
|
|
104
104
|
<div id="footer">
|
105
|
-
Generated on
|
105
|
+
Generated on Tue Mar 14 19:09:26 2017 by
|
106
106
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
107
107
|
0.9.5 (ruby-2.3.2).
|
108
108
|
</div>
|
data/lib/triglav/agent/status.rb
CHANGED
@@ -26,6 +26,19 @@ module Triglav::Agent
|
|
26
26
|
StorageFile.set(path, [*@parents, *keys], val)
|
27
27
|
end
|
28
28
|
|
29
|
+
# Merge Hash value with existing Hash value.
|
30
|
+
#
|
31
|
+
# merge!(val)
|
32
|
+
# merge!(key, val)
|
33
|
+
# merge!(key1, key2, val)
|
34
|
+
# merge!([key], val)
|
35
|
+
# merge!([key1, key2], val)
|
36
|
+
def merge!(*args)
|
37
|
+
val = args.pop
|
38
|
+
keys = args.flatten
|
39
|
+
StorageFile.merge!(path, [*@parents, *keys], val)
|
40
|
+
end
|
41
|
+
|
29
42
|
# setnx(val)
|
30
43
|
# setnx(key, val)
|
31
44
|
# setnx(key1, key2, val)
|
@@ -68,6 +68,24 @@ module Triglav::Agent
|
|
68
68
|
end
|
69
69
|
end
|
70
70
|
|
71
|
+
# Merge Hash value with existing Hash value.
|
72
|
+
#
|
73
|
+
# @param [String] path
|
74
|
+
# @param [Object] key
|
75
|
+
# @param [Hash] val
|
76
|
+
# @return [Object] holded value
|
77
|
+
def self.merge!(path, key, val)
|
78
|
+
keys = Array(key)
|
79
|
+
open(path) do |fp|
|
80
|
+
params = fp.load
|
81
|
+
_val = params.dig(*keys) || {}
|
82
|
+
_val.merge!(val)
|
83
|
+
HashUtil.setdig(params, keys, _val)
|
84
|
+
fp.dump(params)
|
85
|
+
return true
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
71
89
|
# Set key to hold val if key does not exist
|
72
90
|
#
|
73
91
|
# StorageFile.setnx($setting.status_file, 'foo', 'bar') # like h['foo'] = 'bar'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: triglav-agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.rc2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Triglav Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: serverengine
|
@@ -187,6 +187,7 @@ files:
|
|
187
187
|
- docs/Triglav/Agent/HashUtil.html
|
188
188
|
- docs/Triglav/Agent/LogFormatter.html
|
189
189
|
- docs/Triglav/Agent/Logger.html
|
190
|
+
- docs/Triglav/Agent/Status.html
|
190
191
|
- docs/Triglav/Agent/StorageFile.html
|
191
192
|
- docs/Triglav/Agent/Timer.html
|
192
193
|
- docs/Triglav/Agent/TooManyError.html
|