leofs_manager_client 0.4.0 → 0.4.1

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODBjNTNiNmU3MDRkZjc0NmI2MWFjNzk2Y2MyMzc0OTc0MGY1MGVjMg==
4
+ NTJiZmU4MmM1NDljYWMzZWZhNWM1ODc5Y2RjM2QzZjFkNDYyZTllYw==
5
5
  data.tar.gz: !binary |-
6
- NjRkODI0YmJjNWZjNjFiMGMzOTkwMmIxZjEyNDEwOTQ5ODVkYjkxNA==
6
+ NmU3Zjg1MGYxMmEzYzE4NzM2YjM3ZDg4Nzc5MjZjMTAzNGMwNWJiZA==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZWVhZWU3YmU3MTFiN2M1OWU4NzA0NjY1M2FlYzhiMDAxN2U3OTk1ZTg5ZTNk
10
- YzI4Y2IyMWQwYTljNDQyMjM0YmY4MGMyZGUyYzAxY2MwYWJmZWI3NjdiMTU0
11
- NDZiMWI5NWU3ZjRhYWM4M2FhOWRmNDFhNzdhNmI4OWNkZjkwOGY=
9
+ N2Q2ZjEzNjE2N2QwZDMwMmFkZWM2NzIyNjE4NTY1YTJhM2IwZDFkODY0ZmFj
10
+ MzlhODUyY2QyYzU2NjhkOTY4MjcwNDkxNTVmZjRhODcxMWVkMjk5Y2Y3MDAz
11
+ ZjdmNzA1MWEwZmJkYjkyNjMyMzQ3OTUwMDk2MjNkODFhYzc2NGM=
12
12
  data.tar.gz: !binary |-
13
- NzQyMDI3NTA4YWQyNmU4NTEyMGQ4ODY2OTYwNDI5Yzc3YjE0ZTM0YzZjZWFl
14
- MTk5MzcxNGE1ZGFhNTg1MDFmMTE5ZGY4MDFiMDk2YTU3YzllOTkzODk0NDEy
15
- MTQ2ZGE5OTUyMGZlYTk3MDE5ZGY1YjQzMjhmMjMwMTZkOWY4ZmE=
13
+ MjQ1NzgzOTY3NWJiMzVhM2Y4OTdiN2EzNWJjMmZmNWI1YjBiOWFhM2U0Y2Ez
14
+ ZTQyNGU0MmUxZjdhZmUxNTIzMTZkNDc1ODA4MDkyNzhiNDYwMjgxMjYyMjBj
15
+ ZmYyNjQ1YzAwNzUyZTAzMDEzNmFkN2E5NjU2ZTgyYWNiMmZhNTM=
@@ -121,6 +121,7 @@ module LeoFSManager
121
121
  class StorageStat
122
122
  attr_reader :active_num_of_objects, :total_num_of_objects,
123
123
  :active_size_of_objects, :total_size_of_objects,
124
+ :ratio_of_active_size,
124
125
  :last_compaction_start, :last_compaction_end
125
126
 
126
127
  alias total_of_objects total_num_of_objects # for compatibility
@@ -131,8 +132,20 @@ module LeoFSManager
131
132
  @active_size_of_objects = h[:active_size_of_objects]
132
133
  @total_size_of_objects = h[:total_size_of_objects]
133
134
  @ratio_of_active_size = h[:ratio_of_active_size]
134
- @last_compaction_start = h[:last_compaction_start]
135
- @last_compaction_end = h[:last_compaction_end]
135
+
136
+ last_compaction_start = h[:last_compaction_start]
137
+ if last_compaction_start == "____-_-__- __:__:__"
138
+ @last_compaction_start = nil # you have never done compaction
139
+ else
140
+ @last_compaction_start = Time.parse(last_compaction_start)
141
+ end
142
+
143
+ last_compaction_end = h[:last_compaction_end]
144
+ if last_compaction_end == "____-_-__- __:__:__"
145
+ @last_compaction_end = nil
146
+ else
147
+ @last_compaction_end = Time.parse(last_compaction_end)
148
+ end
136
149
  end
137
150
 
138
151
  def file_size
@@ -237,20 +250,23 @@ module LeoFSManager
237
250
  # Compaction Status Model
238
251
  # ==========================
239
252
  class CompactionStatus
240
- attr_reader :status
241
- attr_reader :last_compaction_start
242
- attr_reader :total_targets
243
- attr_reader :num_of_pending_targets
244
- attr_reader :num_of_ongoing_targets
245
- attr_reader :num_of_out_of_targets
253
+ attr_reader :status, :last_compaction_start,
254
+ :total_targets, :num_of_pending_targets,
255
+ :num_of_ongoing_targets, :num_of_out_of_targets
246
256
 
247
257
  def initialize(h)
248
258
  @status = h[:status]
249
- @last_compaction_start = h[:last_compaction_start]
250
259
  @total_targets = h[:total_targets]
251
260
  @num_of_pending_targets = h[:num_of_pending_targets]
252
261
  @num_of_ongoing_targets = h[:num_of_ongoing_targets]
253
262
  @num_of_out_of_targets = h[:num_of_out_of_targets]
263
+
264
+ last_compaction_start = h[:last_compaction_start]
265
+ if last_compaction_start == "____-_-__- __:__:__"
266
+ @last_compaction_start = nil # you have never done compaction
267
+ else
268
+ @last_compaction_start = Time.parse(last_compaction_start)
269
+ end
254
270
  end
255
271
  end
256
272
  end
@@ -26,7 +26,7 @@ require "time"
26
26
  require_relative "leofs_manager_client/leofs_manager_models"
27
27
 
28
28
  module LeoFSManager
29
- VERSION = "0.4.0"
29
+ VERSION = "0.4.1"
30
30
 
31
31
  class Client
32
32
  CMD_VERSION = "version"
@@ -78,6 +78,16 @@ module Dummy
78
78
  ]
79
79
  }.to_json
80
80
 
81
+ StorageStat = {
82
+ :active_num_of_objects => 0,
83
+ :total_num_of_objects => 0,
84
+ :active_size_of_objects => 0,
85
+ :total_size_of_objects => 0,
86
+ :ratio_of_active_size => 0,
87
+ :last_compaction_start => "2013-03-13 09:11:04 +0900",
88
+ :last_compaction_end => "2013-03-13 09:11:04 +0900"
89
+ }.to_json
90
+
81
91
  GetEndpoints = {:endpoints => [{:endpoint => "s3.amazonaws.com", :created_at=>"2012-09-21 15:08:11 +0900"},
82
92
  {:endpoint => "localhost", :created_at=>"2012-09-21 15:08:11 +0900"},
83
93
  {:endpoint => "foo", :created_at=>"2012-09-21 18:51:08 +0900"},
@@ -139,6 +149,8 @@ module Dummy
139
149
  Response::GetUsers
140
150
  when "create-user"
141
151
  Response::CreateUser
152
+ when /^du/
153
+ Response::StorageStat
142
154
  else
143
155
  { :result => line }.to_json
144
156
  end
@@ -34,7 +34,6 @@ NoResultAPIs = {
34
34
  :start => 0,
35
35
  :detach => 1,
36
36
  :rebalance => 0,
37
- :compact => 1,
38
37
  :purge => 1,
39
38
  :set_endpoint => 1,
40
39
  :del_endpoint => 1,
@@ -58,7 +57,7 @@ describe LeoFSManager do
58
57
  :total_num_of_objects => 0,
59
58
  :active_size_of_objects => 0,
60
59
  :total_size_of_objects => 0,
61
- :ratio_of_active_size => "0.0%"
60
+ :ratio_of_active_size => "0.0%",
62
61
  :last_compaction_start => "____-_-__- __:__:__",
63
62
  :last_compaction_end => "____-_-__- __:__:__"
64
63
  )
@@ -111,12 +110,9 @@ describe LeoFSManager do
111
110
  describe "#status" do
112
111
  its(:status) { should be_a Status }
113
112
  its("status.system_info") { should be_a Status::System }
114
-
115
113
  its("status.node_list") do
116
114
  should be_a Array
117
- subject.each do |node|
118
- node.should be_a Status::Node
119
- end
115
+ should be_all {|node| node.is_a?(Status::Node) }
120
116
  end
121
117
  end
122
118
 
@@ -167,22 +163,22 @@ describe LeoFSManager do
167
163
 
168
164
  its(:get_users) do
169
165
  should be_a Array
170
- subject.each do |account|
171
- account.should be_a User
166
+ should be_all do |account|
167
+ account.is_a?(User)
172
168
  end
173
169
  end
174
170
 
175
171
  its(:get_endpoints) do
176
172
  should be_a Array
177
- subject.each do |endpoint|
178
- endpoint.should be_a Endpoint
173
+ should be_all do |endpoint|
174
+ endpoint.is_a?(Endpoint)
179
175
  end
180
176
  end
181
177
 
182
178
  its(:get_buckets) do
183
179
  should be_a Array
184
- subject.each do |buckets|
185
- buckets.should be_a Bucket
180
+ should be_all do |bucket|
181
+ bucket.is_a?(Bucket)
186
182
  end
187
183
  end
188
184
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: leofs_manager_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masaki Matsushita
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-12 00:00:00.000000000 Z
12
+ date: 2013-03-15 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Client for LeoFS Manager
15
15
  email:
@@ -47,7 +47,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
47
47
  version: '0'
48
48
  requirements: []
49
49
  rubyforge_project:
50
- rubygems_version: 2.0.2
50
+ rubygems_version: 2.0.3
51
51
  signing_key:
52
52
  specification_version: 4
53
53
  summary: Client for LeoFS Manager