webhdfs 0.5.3 → 0.5.4
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 +4 -4
- data/README.md +8 -2
- data/VERSION +1 -1
- data/lib/webhdfs/client_v1.rb +8 -3
- data/lib/webhdfs/fileutils.rb +6 -2
- data/webhdfs.gemspec +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2dbe7f5cbc7dd8becf1af99bc7b4291170e09763
|
4
|
+
data.tar.gz: fec022e46547493c2ecb825e14e62c32ad62a7ab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c098695dd8248293b86e85e742e9abfd41da0b1a433609cf0f18bec6522a78135c324095c8a2280ee3ae6bb2524e09a8fc30c121eafd0fd68345c64c0a7caef9
|
7
|
+
data.tar.gz: 0b7a52e3ce9d03ff6d26533604309831d4228606bc3e5f1421f5150323a521a820861bc586906b9606bd5fd55c3d50952b0a70911a235565df101bba65efea1e
|
data/README.md
CHANGED
@@ -50,7 +50,7 @@ For known errors, automated retries are available. Set `retry_known_errors` opti
|
|
50
50
|
client.retry_known_errors = true
|
51
51
|
|
52
52
|
# client.retry_interval = 1 # [sec], default: 1
|
53
|
-
#
|
53
|
+
# client.retry_times = 1 # [times], default: 1
|
54
54
|
|
55
55
|
### WebHDFS::FileUtils
|
56
56
|
|
@@ -68,7 +68,7 @@ For known errors, automated retries are available. Set `retry_known_errors` opti
|
|
68
68
|
|
69
69
|
For HttpFs instead of WebHDFS:
|
70
70
|
|
71
|
-
client = WebHDFS::Client('hostname', 14000)
|
71
|
+
client = WebHDFS::Client.new('hostname', 14000)
|
72
72
|
client.httpfs_mode = true
|
73
73
|
|
74
74
|
client.read(path) #=> data
|
@@ -78,6 +78,12 @@ For HttpFs instead of WebHDFS:
|
|
78
78
|
WebHDFS::FileUtils.set_httpfs_mode
|
79
79
|
WebHDFS::FileUtils.copy_to_local(remote_path, local_path)
|
80
80
|
|
81
|
+
### For HTTP Proxy servers
|
82
|
+
|
83
|
+
client = WebHDFS::Client.new('hostname', 14000, 'proxy.server.local', 8080)
|
84
|
+
client.proxy_user = 'jack' # if needed
|
85
|
+
client.proxy_pass = 'secret' # if needed
|
86
|
+
|
81
87
|
## AUTHORS
|
82
88
|
|
83
89
|
* Kazuki Ohta <kazuki.ohta@gmail.com>
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.4
|
data/lib/webhdfs/client_v1.rb
CHANGED
@@ -11,7 +11,8 @@ module WebHDFS
|
|
11
11
|
OPT_TABLE = {} # internal use only
|
12
12
|
KNOWN_ERRORS = ['LeaseExpiredException'].freeze
|
13
13
|
|
14
|
-
attr_accessor :host, :port, :username, :doas
|
14
|
+
attr_accessor :host, :port, :username, :doas, :proxy_address, :proxy_port
|
15
|
+
attr_accessor :proxy_user, :proxy_pass
|
15
16
|
attr_accessor :open_timeout # default 30s (in ruby net/http)
|
16
17
|
attr_accessor :read_timeout # default 60s (in ruby net/http)
|
17
18
|
attr_accessor :httpfs_mode
|
@@ -19,11 +20,13 @@ module WebHDFS
|
|
19
20
|
attr_accessor :retry_times # default 1 (ignored when retry_known_errors is false)
|
20
21
|
attr_accessor :retry_interval # default 1 ([sec], ignored when retry_known_errors is false)
|
21
22
|
|
22
|
-
def initialize(host='localhost', port=50070, username=nil, doas=nil)
|
23
|
+
def initialize(host='localhost', port=50070, username=nil, doas=nil, proxy_address=nil, proxy_port=nil)
|
23
24
|
@host = host
|
24
25
|
@port = port
|
25
26
|
@username = username
|
26
27
|
@doas = doas
|
28
|
+
@proxy_address = proxy_address
|
29
|
+
@proxy_port = proxy_port
|
27
30
|
@retry_known_errors = false
|
28
31
|
@retry_times = 1
|
29
32
|
@retry_interval = 1
|
@@ -253,7 +256,9 @@ module WebHDFS
|
|
253
256
|
# FileNotFoundException 404 Not Found
|
254
257
|
# RumtimeException 500 Internal Server Error
|
255
258
|
def request(host, port, method, path, op=nil, params={}, payload=nil, header=nil, retries=0)
|
256
|
-
conn = Net::HTTP.new(host, port)
|
259
|
+
conn = Net::HTTP.new(host, port, @proxy_address, @proxy_port)
|
260
|
+
conn.proxy_user = @proxy_user if @proxy_user
|
261
|
+
conn.proxy_pass = @proxy_pass if @proxy_pass
|
257
262
|
conn.open_timeout = @open_timeout if @open_timeout
|
258
263
|
conn.read_timeout = @read_timeout if @read_timeout
|
259
264
|
|
data/lib/webhdfs/fileutils.rb
CHANGED
@@ -15,16 +15,20 @@ module WebHDFS
|
|
15
15
|
# port - port
|
16
16
|
# user - username
|
17
17
|
# doas - proxy user name
|
18
|
+
# proxy_address - address of the net http proxy to use
|
19
|
+
# proxy_port - port of the net http proxy to use
|
18
20
|
#
|
19
21
|
# Examples
|
20
22
|
#
|
21
23
|
# FileUtils.set_server 'localhost', 50070
|
22
24
|
#
|
23
|
-
def set_server(host, port, user=nil, doas=nil)
|
25
|
+
def set_server(host, port, user=nil, doas=nil, proxy_address=nil, proxy_port=nil)
|
24
26
|
@fu_host = host
|
25
27
|
@fu_port = port
|
26
28
|
@fu_user = user
|
27
29
|
@fu_doas = doas
|
30
|
+
@fu_paddr = proxy_address
|
31
|
+
@fu_pport = proxy_port
|
28
32
|
end
|
29
33
|
module_function :set_server
|
30
34
|
|
@@ -330,7 +334,7 @@ module WebHDFS
|
|
330
334
|
|
331
335
|
# Internal
|
332
336
|
def client
|
333
|
-
client = WebHDFS::Client.new(@fu_host, @fu_port, @fu_user, @fu_doas)
|
337
|
+
client = WebHDFS::Client.new(@fu_host, @fu_port, @fu_user, @fu_doas, @fu_paddr, @fu_pport)
|
334
338
|
if @fu_httpfs_mode
|
335
339
|
client.httpfs_mode = true
|
336
340
|
end
|
data/webhdfs.gemspec
CHANGED
@@ -4,7 +4,7 @@ $:.push File.expand_path('../lib', __FILE__)
|
|
4
4
|
Gem::Specification.new do |gem|
|
5
5
|
gem.name = "webhdfs"
|
6
6
|
gem.description = "Ruby WebHDFS/HttpFs client"
|
7
|
-
gem.homepage = ""
|
7
|
+
gem.homepage = "https://github.com/kzk/webhdfs/"
|
8
8
|
gem.summary = gem.description
|
9
9
|
gem.version = File.read("VERSION").strip
|
10
10
|
gem.authors = ["Kazuki Ohta"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webhdfs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kazuki Ohta
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -88,7 +88,7 @@ files:
|
|
88
88
|
- test/test_helper.rb
|
89
89
|
- test/webhdfs/fileutils.rb
|
90
90
|
- webhdfs.gemspec
|
91
|
-
homepage:
|
91
|
+
homepage: https://github.com/kzk/webhdfs/
|
92
92
|
licenses: []
|
93
93
|
metadata: {}
|
94
94
|
post_install_message:
|
@@ -107,10 +107,11 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
107
|
version: '0'
|
108
108
|
requirements: []
|
109
109
|
rubyforge_project:
|
110
|
-
rubygems_version: 2.0.
|
110
|
+
rubygems_version: 2.0.2
|
111
111
|
signing_key:
|
112
112
|
specification_version: 4
|
113
113
|
summary: Ruby WebHDFS/HttpFs client
|
114
114
|
test_files:
|
115
115
|
- test/test_helper.rb
|
116
116
|
- test/webhdfs/fileutils.rb
|
117
|
+
has_rdoc: false
|