leofs_manager_client 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,24 +1,19 @@
1
1
  # leofs_manager_client
2
2
 
3
- TODO: Write a gem description
3
+ This is a client for LeoFS Manager.
4
4
 
5
5
  ## Installation
6
-
7
- Add this line to your application's Gemfile:
8
-
9
- gem 'leofs_manager'
10
-
11
- And then execute:
12
-
13
- $ bundle
14
-
15
- Or install it yourself as:
16
-
17
- $ gem install leofs_manager
6
+
7
+ $ gem install leofs_manager_client
18
8
 
19
9
  ## Usage
20
10
 
21
- TODO: Write usage instructions here
11
+ ```ruby
12
+ require "leofs_manager_client"
13
+
14
+ manager = LeoFSManager::Client.new("localhost:10020")
15
+ manager.status #=> #<LeoFSManager::Status:0x00000001578310 @system_info=#<LeoFSManager::Status::SystemInfo:0x000000015782e8 @version="0.10.1", @n="1", @r="1", @w="1", @d="1", @ring_size="128", @ring_cur=nil, @ring_prev=nil>, @node_list=[#<LeoFSManager::Status::NodeInfo:0x00000001578298 @type="S", @node="storage_0@127.0.0.1", @state="running", @ring_cur="a039acc0", @ring_prev="a039acc0", @joined_at="2012-09-21 15:08:22 +0900">, #<LeoFSManager::Status::NodeInfo:0x00000001578248 @type="G", @node="gateway_0@127.0.0.1", @state="running", @ring_cur="a039acc0", @ring_prev="a039acc0", @joined_at="2012-09-21 15:08:25 +0900">]>
16
+ ```
22
17
 
23
18
  ## Contributing
24
19
 
@@ -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.2.1"
29
+ VERSION = "0.2.2"
30
30
 
31
31
  class Remover
32
32
  def initialize(data)
@@ -70,6 +70,7 @@ module LeoFSManager
70
70
  set_current_server
71
71
  final = Remover.new(@data = [])
72
72
  ObjectSpace.define_finalizer(self, final)
73
+ @mutex = Mutex.new
73
74
  connect
74
75
  end
75
76
 
@@ -242,8 +243,11 @@ module LeoFSManager
242
243
  ## @return Hash
243
244
  def sender(command)
244
245
  begin
245
- @socket.puts command
246
- response = JSON.parse(@socket.gets, symbolize_names: true)
246
+ response = nil
247
+ @mutex.synchronize do
248
+ @socket.puts command
249
+ response = JSON.parse(@socket.gets, symbolize_names: true)
250
+ end
247
251
  rescue => ex
248
252
  raise "An Error occured: #{ex.class} (server: #{@current_server})\n#{ex.message}"
249
253
  end
@@ -152,11 +152,6 @@ describe LeoFSManager do
152
152
  @manager = Client.new("#{Host}:#{Port}")
153
153
  end
154
154
 
155
- it "has version" do
156
- defined?(VERSION).should eql "constant"
157
- VERSION.should eql "0.2.1"
158
- end
159
-
160
155
  it "raises error when it is passed invalid params" do
161
156
  lambda { Client.new }.should raise_error
162
157
  end
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.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: