leo_manager_client 0.4.7 → 0.4.8
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.
- data/lib/leo_manager_client.rb +15 -1
- data/lib/leo_manager_models.rb +47 -16
- data/spec/leo_manager_client_spec.rb +1 -4
- metadata +2 -2
data/lib/leo_manager_client.rb
CHANGED
@@ -26,7 +26,7 @@ require "time"
|
|
26
26
|
require_relative "leo_manager_models"
|
27
27
|
|
28
28
|
module LeoManager
|
29
|
-
VERSION = "0.4.
|
29
|
+
VERSION = "0.4.8"
|
30
30
|
|
31
31
|
class Client
|
32
32
|
CMD_VERSION = "version"
|
@@ -409,10 +409,24 @@ if __FILE__ == $PROGRAM_NAME
|
|
409
409
|
$DEBUG = true
|
410
410
|
m = LeoManager::Client.new("localhost:10020", "localhost:10021")
|
411
411
|
p m.version
|
412
|
+
p "[status]"
|
412
413
|
p m.status
|
414
|
+
|
415
|
+
p "[status storage_0@127.0.0.1]"
|
413
416
|
p m.status("storage_0@127.0.0.1")
|
417
|
+
|
418
|
+
p "[status gateway_0@127.0.0.1]"
|
419
|
+
p m.status("gateway_0@127.0.0.1")
|
420
|
+
|
421
|
+
p "[get-buckets]"
|
414
422
|
p m.get_buckets()
|
423
|
+
|
424
|
+
p "[whereis photo/hawaii-0.jpg]"
|
415
425
|
p m.whereis("photo/hawaii-0.jpg")
|
426
|
+
|
427
|
+
p "[du storage_0@127.0.0.1]"
|
416
428
|
p m.du("storage_0@127.0.0.1")
|
429
|
+
|
430
|
+
p "[compact status storage_0@127.0.0.1]"
|
417
431
|
p m.compact_status("storage_0@127.0.0.1")
|
418
432
|
end
|
data/lib/leo_manager_models.rb
CHANGED
@@ -25,19 +25,26 @@ module LeoManager
|
|
25
25
|
# System Information Model
|
26
26
|
# ==========================
|
27
27
|
class Status
|
28
|
-
# Node
|
29
|
-
attr_reader :node_stat
|
30
28
|
# System
|
31
29
|
attr_reader :system_info
|
30
|
+
# Node Status
|
31
|
+
attr_reader :node_stat
|
32
|
+
# Storage Status
|
33
|
+
attr_reader :storage_stat
|
34
|
+
# Gateway Status
|
35
|
+
attr_reader :gateway_stat
|
32
36
|
# Array of Node
|
33
37
|
attr_reader :node_list
|
34
38
|
|
35
39
|
def initialize(h)
|
36
|
-
@
|
37
|
-
@
|
38
|
-
@
|
40
|
+
@system_info = System.new(h[:system_info]) if h.has_key?(:system_info)
|
41
|
+
@node_stat = NodeStat.new(h[:node_stat]) if h.has_key?(:node_stat)
|
42
|
+
@storage_stat = StorageStat.new(h[:node_stat]) if h.has_key?(:node_stat)
|
43
|
+
@gateway_stat = GatewayStat.new(h[:node_stat]) if h.has_key?(:node_stat)
|
44
|
+
@node_list = h[:node_list].map {|node| NodeInfo.new(node) } if h.has_key?(:node_list)
|
39
45
|
end
|
40
46
|
|
47
|
+
# System Info
|
41
48
|
class System
|
42
49
|
attr_reader :version, :ring_size, :ring_cur, :ring_prev
|
43
50
|
|
@@ -57,14 +64,14 @@ module LeoManager
|
|
57
64
|
@w = Integer(h[:w])
|
58
65
|
@d = Integer(h[:d])
|
59
66
|
@ring_size = Integer(h[:ring_size])
|
60
|
-
#
|
67
|
+
# leo_manager returns ring_hash_(cur|prev) as decimal (not hex)
|
61
68
|
@ring_cur = Integer(h[:ring_hash_cur]).to_s(16)
|
62
69
|
@ring_prev = Integer(h[:ring_hash_prev]).to_s(16)
|
63
70
|
end
|
64
71
|
end
|
65
72
|
|
66
|
-
# Node
|
67
|
-
class
|
73
|
+
# Node Info
|
74
|
+
class NodeInfo
|
68
75
|
attr_reader :type, :node, :state, :ring_cur, :ring_prev, :when
|
69
76
|
|
70
77
|
def initialize(h)
|
@@ -72,7 +79,6 @@ module LeoManager
|
|
72
79
|
@node = h[:node]
|
73
80
|
@when = Time.parse(h[:when])
|
74
81
|
@state = h[:state]
|
75
|
-
#XXX: these are written in hex
|
76
82
|
@ring_cur = h[:ring_cur]
|
77
83
|
@ring_prev = h[:ring_prev]
|
78
84
|
end
|
@@ -80,14 +86,11 @@ module LeoManager
|
|
80
86
|
alias joined_at when
|
81
87
|
end
|
82
88
|
|
89
|
+
# Node Common Status
|
83
90
|
class NodeStat
|
84
|
-
@@properties = [
|
85
|
-
|
86
|
-
|
87
|
-
:ets_mem_usage, :num_of_procs, :limit_of_procs, :thread_pool_size,
|
88
|
-
:replication_msgs, :sync_vnode_msgs, :rebalance_msgs, :kernel_poll
|
89
|
-
]
|
90
|
-
|
91
|
+
@@properties = [:version, :log_dir, :ring_cur, :ring_prev, :vm_version,
|
92
|
+
:total_mem_usage, :system_mem_usage, :procs_mem_usage,
|
93
|
+
:ets_mem_usage, :num_of_procs, :limit_of_procs, :thread_pool_size, :kernel_poll]
|
91
94
|
attr_reader *@@properties
|
92
95
|
|
93
96
|
def initialize(h)
|
@@ -97,6 +100,34 @@ module LeoManager
|
|
97
100
|
@kernel_poll = (h[:kernel_poll] == "true") if h.has_key?(:kernel_poll)
|
98
101
|
end
|
99
102
|
end
|
103
|
+
|
104
|
+
# Storage Status
|
105
|
+
class StorageStat
|
106
|
+
@@properties = [:replication_msgs, :sync_vnode_msgs, :rebalance_msgs]
|
107
|
+
attr_reader *@@properties
|
108
|
+
|
109
|
+
def initialize(h)
|
110
|
+
@@properties.each do |property|
|
111
|
+
instance_variable_set("@#{property}", h[property])
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
# Gateway Status
|
117
|
+
class GatewayStat
|
118
|
+
@@properties = [:handler, :port, :ssl_port, :num_of_acceptors, :http_cache,
|
119
|
+
:cache_workers, :cache_expire, :cache_ram_capacity,
|
120
|
+
:cache_disc_capacity, :cache_disc_threshold_len, :cache_disc_dir_data,
|
121
|
+
:cache_disc_dir_journal, :cache_max_content_len, :max_chunked_objs,
|
122
|
+
:max_len_for_obj, :chunked_obj_len, :threshold_obj_len]
|
123
|
+
attr_reader *@@properties
|
124
|
+
|
125
|
+
def initialize(h)
|
126
|
+
@@properties.each do |property|
|
127
|
+
instance_variable_set("@#{property}", h[property])
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
100
131
|
end
|
101
132
|
|
102
133
|
# ==========================
|
@@ -132,10 +132,7 @@ describe LeoManager do
|
|
132
132
|
:num_of_procs => 325,
|
133
133
|
:limit_of_procs => 1048576,
|
134
134
|
:kernel_poll => "true",
|
135
|
-
:thread_pool_size => 32
|
136
|
-
:replication_msgs => 0,
|
137
|
-
:sync_vnode_msgs => 0,
|
138
|
-
:rebalance_msgs => 0
|
135
|
+
:thread_pool_size => 32
|
139
136
|
}
|
140
137
|
|
141
138
|
subject do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: leo_manager_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-09-
|
12
|
+
date: 2013-09-20 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Client for LeoFS-Manager
|
15
15
|
email:
|