drb_fileserver_plus 0.2.1 → 0.2.2

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,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2a343182e14b15cd40f4d6ada733281b605d7dfb7f174acb852b43877b748d0c
4
- data.tar.gz: 40c2706d369d419221e20e4253e9e6a60b5c84a33afeafc6abaf49d55678cb44
3
+ metadata.gz: 17d1dddceaf3c825e2da89a9a9dc96ac2d86fab7839d44a544af74db8a7581f2
4
+ data.tar.gz: f9d8147a5c84c69427292c23d4dece3fb0902da8d7d2ae1c4abba65e4df6793b
5
5
  SHA512:
6
- metadata.gz: 63e58db0c8d5c62d1d729f5f2ff4eaef82df0973bb49bb1f1f92615a33383b5c8f499c7a7751372adb9f28f2ae4db08321c3757d9cb917f6b4f94a12170c4237
7
- data.tar.gz: 0552fe49e183609e497e57f20be29856ddf987ccc93dbd23839de186d4d147912abc0bc91fc59abaf6a5adce63adeca64b4d890ec723bbfd030294ec313e2213
6
+ metadata.gz: 28f129af88a0a6c18c87758830a6e92ae33a707ac7f24c91fb90e4fef6ffdba9ce3da22bce4cb7a05bd11c7233835599f543dfa84a96dd0bca53aefb0e8653cb
7
+ data.tar.gz: f1bfc398a716f146db25d51d8355627f79d549899370e87b47368a5ca601883806b1065fc3799c86ba1a36bdd2d3b8ca180ed4d7cd37da0b15e3af4c90b6beb0
checksums.yaml.gz.sig CHANGED
@@ -1,3 +1,2 @@
1
- z���W`����Q�@�� �:�Z*c��b(px�hm��.�.�)�Д(��=�a�i���Ctb��odSCa�)5��&��q�g)B�/��~��3�D)�wcI� 0������>m��p�
2
- v\�;ܛZwD[L��S��z��M3]���O H����'���p͟K�������
3
- �0�)����ʍ��v�:`����i��S:���2N%dT�����u8k�Ay�Jl}�̕�#Dzb�It����1}�P��8v�H�
1
+ :��|�+��Gxu����ڗw��Ɣ|��7@�Pѳ9
2
+ }e%�� �ŧ׈\�#�� 1���� ��\xS�<��HI�Y6�7ڜ>�G%��6�%���6/&N`Ս�����̬Y�yT��g�G����vp&���_�5zŬ�����È�d�؍y�`F W��&s/?�z\���E�,��)����%�mf4Z��/�ۖ��<�xhuh�S?�lr���D��vt
@@ -10,105 +10,147 @@ require 'drb_fileclient'
10
10
 
11
11
 
12
12
  class DRbFileServer
13
+
14
+ attr_accessor :nodes
13
15
 
14
16
  def initialize(nodes, sps: nil, topic: 'file')
15
17
 
16
- @nodes = nodes.map {|x| 'dfs://' + x}
18
+ @nodes = nodes
17
19
  @failcount = 0
18
20
  @sps, @topic = sps, topic
19
21
 
20
22
  end
21
23
 
22
24
  def cp(path, path2)
25
+
26
+ node = ''
23
27
 
24
28
  file_op do |f|
25
- f.cp File.join(@nodes.first, path), File.join(@nodes.first, path2)
29
+ node = 'dfs://' + @nodes.first
30
+ f.cp File.join(node, path), File.join(node, path2)
26
31
  end
27
32
 
28
33
  if @sps then
29
- @sps.notice "%s/copy: %s %s" % [@topic, File.join(@nodes.first, path),
30
- File.join(@nodes.first, path2)]
34
+ @sps.notice "%s/copy: %s %s" % [@topic, File.join(node, path),
35
+ File.join(node, path2)]
31
36
  end
32
37
 
33
38
  end
34
39
 
35
40
  def exists?(fname)
36
-
37
- file_op {|f| f.exists? File.join(@nodes.first, fname) }
41
+
42
+ file_op do |f|
43
+ node = 'dfs://' + @nodes.first
44
+ f.exists? File.join(node, fname)
45
+ end
38
46
 
39
47
  end
40
48
 
41
49
  def ls(path)
42
-
43
- file_op {|f| f.ls File.join(@nodes.first, path) }
50
+
51
+ file_op do |f|
52
+ node = 'dfs://' + @nodes.first
53
+ f.ls File.join(node, path)
54
+ end
44
55
 
45
56
  end
46
57
 
47
58
  def mkdir(path)
48
59
 
49
- file_op {|f| f.mkdir File.join(@nodes.first, path) }
60
+ node = ''
61
+
62
+ file_op do |f|
63
+ node = 'dfs://' + @nodes.first
64
+ f.mkdir File.join(node, path)
65
+ end
50
66
 
51
67
  if @sps then
52
- @sps.notice "%s/mkdir: %s" % [@topic, File.join(@nodes.first, path)]
68
+ @sps.notice "%s/mkdir: %s" % [@topic, File.join(node, path)]
53
69
  end
54
70
 
55
71
  end
56
72
 
57
73
  def mkdir_p(path)
58
74
 
59
- file_op {|f| f.mkdir_p File.join(@nodes.first, path) }
75
+ node = ''
76
+
77
+ file_op do |f|
78
+ node = 'dfs://' + @nodes.first
79
+ f.mkdir_p File.join(node, path)
80
+ end
60
81
 
61
82
  if @sps then
62
- @sps.notice "%s/mkdir_p: %s" % [@topic, File.join(@nodes.first, path)]
83
+ @sps.notice "%s/mkdir_p: %s" % [@topic, File.join(node, path)]
63
84
  end
64
85
 
65
86
  end
66
87
 
67
88
  def mv(path, path2)
68
89
 
90
+ node = ''
91
+
69
92
  file_op do |f|
70
- f.mv File.join(@nodes.first, path), File.join(@nodes.first, path2)
93
+ node = 'dfs://' + @nodes.first
94
+ f.mv File.join(node, path), File.join(node, path2)
71
95
  end
72
96
 
73
97
  if @sps then
74
- @sps.notice "%s/mv: %s %s" % [@topic, File.join(@nodes.first, path),
75
- File.join(@nodes.first, path2)]
98
+ @sps.notice "%s/mv: %s %s" % [@topic, File.join(node, path),
99
+ File.join(node, path2)]
76
100
  end
77
101
 
78
102
  end
79
103
 
80
104
  def read(fname)
81
-
82
- file_op {|f| f.read File.join(@nodes.first, fname) }
105
+
106
+ file_op do |f|
107
+ node = 'dfs://' + @nodes.first
108
+ f.read File.join(node, fname)
109
+ end
83
110
 
84
111
  end
85
112
 
86
113
  def rm(fname)
87
114
 
88
- file_op {|f| f.rm File.join(@nodes.first, fname) }
115
+ node = ''
116
+
117
+ file_op do |f|
118
+ node = 'dfs://' + @nodes.first
119
+ f.rm File.join(node, fname)
120
+ end
89
121
 
90
122
  if @sps then
91
- @sps.notice "%s/rm: %s" % [@topic, File.join(@nodes.first, fname)]
123
+ @sps.notice "%s/rm: %s" % [@topic, File.join(node, fname)]
92
124
  end
93
125
 
94
126
  end
95
127
 
96
128
  def write(fname, content)
97
129
 
98
- file_op {|f| f.write File.join(@nodes.first, fname), content }
130
+ node = ''
131
+
132
+ file_op do |f|
133
+ node = 'dfs://' + @nodes.first
134
+ f.write File.join(node, fname), content
135
+ end
99
136
 
100
137
  if @sps then
101
- @sps.notice("%s/write: %s" % [@topic, File.join(@nodes.first, fname)])
138
+ @sps.notice("%s/write: %s" % [@topic, File.join(node, fname)])
102
139
  end
103
140
 
104
141
  end
105
142
 
106
143
  def zip(fname, a)
107
-
108
- file_op {|f| f.zip File.join(@nodes.first, fname), a }
144
+
145
+ node = ''
146
+
147
+ file_op do |f|
148
+ node = 'dfs://' + @nodes.first
149
+ f.zip File.join(node, fname), a
150
+ end
109
151
 
110
152
  if @sps then
111
- @sps.notice "%s/zip: %s" % [@topic, File.join(@nodes.first, fname)]
153
+ @sps.notice "%s/zip: %s" % [@topic, File.join(node, fname)]
112
154
  end
113
155
 
114
156
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: drb_fileserver_plus
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -35,7 +35,7 @@ cert_chain:
35
35
  IzajbtHbQOY56M17vmJw7Y9ei8bGWzjVxfRUg33mVpGQQIWHA2JpaJ8+jpwrxdbF
36
36
  DfzPJWgIRbTOgE4v1XGQcqsO
37
37
  -----END CERTIFICATE-----
38
- date: 2018-08-23 00:00:00.000000000 Z
38
+ date: 2018-08-24 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: drb_fileclient
metadata.gz.sig CHANGED
Binary file