ganapati 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +674 -0
- data/README.rdoc +86 -0
- data/Rakefile +32 -0
- data/bin/hcp +64 -0
- data/bin/hls +42 -0
- data/docs/classes/Ganapati.html +138 -0
- data/docs/classes/Ganapati/Client.html +666 -0
- data/docs/classes/Ganapati/FileUrl.html +253 -0
- data/docs/classes/Ganapati/HFile.html +271 -0
- data/docs/classes/ThriftHadoopFileSystem.html +169 -0
- data/docs/classes/ThriftHadoopFileSystem/Append_args.html +193 -0
- data/docs/classes/ThriftHadoopFileSystem/Append_result.html +198 -0
- data/docs/classes/ThriftHadoopFileSystem/BlockLocation.html +208 -0
- data/docs/classes/ThriftHadoopFileSystem/Chmod_args.html +198 -0
- data/docs/classes/ThriftHadoopFileSystem/Chmod_result.html +193 -0
- data/docs/classes/ThriftHadoopFileSystem/Chown_args.html +203 -0
- data/docs/classes/ThriftHadoopFileSystem/Chown_result.html +193 -0
- data/docs/classes/ThriftHadoopFileSystem/Client.html +1566 -0
- data/docs/classes/ThriftHadoopFileSystem/Close_args.html +193 -0
- data/docs/classes/ThriftHadoopFileSystem/Close_result.html +198 -0
- data/docs/classes/ThriftHadoopFileSystem/CreateFile_args.html +218 -0
- data/docs/classes/ThriftHadoopFileSystem/CreateFile_result.html +198 -0
- data/docs/classes/ThriftHadoopFileSystem/Create_args.html +193 -0
- data/docs/classes/ThriftHadoopFileSystem/Create_result.html +198 -0
- data/docs/classes/ThriftHadoopFileSystem/Exists_args.html +193 -0
- data/docs/classes/ThriftHadoopFileSystem/Exists_result.html +198 -0
- data/docs/classes/ThriftHadoopFileSystem/FileStatus.html +233 -0
- data/docs/classes/ThriftHadoopFileSystem/GetFileBlockLocations_args.html +203 -0
- data/docs/classes/ThriftHadoopFileSystem/GetFileBlockLocations_result.html +198 -0
- data/docs/classes/ThriftHadoopFileSystem/ListStatus_args.html +193 -0
- data/docs/classes/ThriftHadoopFileSystem/ListStatus_result.html +198 -0
- data/docs/classes/ThriftHadoopFileSystem/MalformedInputException.html +220 -0
- data/docs/classes/ThriftHadoopFileSystem/Mkdirs_args.html +193 -0
- data/docs/classes/ThriftHadoopFileSystem/Mkdirs_result.html +198 -0
- data/docs/classes/ThriftHadoopFileSystem/Open_args.html +193 -0
- data/docs/classes/ThriftHadoopFileSystem/Open_result.html +198 -0
- data/docs/classes/ThriftHadoopFileSystem/Pathname.html +193 -0
- data/docs/classes/ThriftHadoopFileSystem/Processor.html +710 -0
- data/docs/classes/ThriftHadoopFileSystem/Read_args.html +203 -0
- data/docs/classes/ThriftHadoopFileSystem/Read_result.html +198 -0
- data/docs/classes/ThriftHadoopFileSystem/Rename_args.html +198 -0
- data/docs/classes/ThriftHadoopFileSystem/Rename_result.html +198 -0
- data/docs/classes/ThriftHadoopFileSystem/Rm_args.html +198 -0
- data/docs/classes/ThriftHadoopFileSystem/Rm_result.html +198 -0
- data/docs/classes/ThriftHadoopFileSystem/SetInactivityTimeoutPeriod_args.html +199 -0
- data/docs/classes/ThriftHadoopFileSystem/SetInactivityTimeoutPeriod_result.html +188 -0
- data/docs/classes/ThriftHadoopFileSystem/SetReplication_args.html +198 -0
- data/docs/classes/ThriftHadoopFileSystem/SetReplication_result.html +193 -0
- data/docs/classes/ThriftHadoopFileSystem/Shutdown_args.html +193 -0
- data/docs/classes/ThriftHadoopFileSystem/Shutdown_result.html +188 -0
- data/docs/classes/ThriftHadoopFileSystem/Stat_args.html +193 -0
- data/docs/classes/ThriftHadoopFileSystem/Stat_result.html +198 -0
- data/docs/classes/ThriftHadoopFileSystem/ThriftHandle.html +193 -0
- data/docs/classes/ThriftHadoopFileSystem/ThriftIOException.html +220 -0
- data/docs/classes/ThriftHadoopFileSystem/Write_args.html +198 -0
- data/docs/classes/ThriftHadoopFileSystem/Write_result.html +198 -0
- data/docs/created.rid +1 -0
- data/docs/files/README_rdoc.html +209 -0
- data/docs/files/lib/ganapati/client_rb.html +101 -0
- data/docs/files/lib/ganapati/hfile_rb.html +101 -0
- data/docs/files/lib/ganapati/utils_rb.html +101 -0
- data/docs/files/lib/ganapati/version_rb.html +101 -0
- data/docs/files/lib/ganapati_rb.html +112 -0
- data/docs/files/lib/thrift/hadoopfs_constants_rb.html +117 -0
- data/docs/files/lib/thrift/hadoopfs_types_rb.html +110 -0
- data/docs/files/lib/thrift/thrift_hadoop_file_system_rb.html +118 -0
- data/docs/fr_class_index.html +77 -0
- data/docs/fr_file_index.html +35 -0
- data/docs/fr_method_index.html +222 -0
- data/docs/index.html +24 -0
- data/docs/rdoc-style.css +208 -0
- data/lib/ganapati.rb +1 -0
- data/lib/ganapati/client.rb +4 -2
- data/lib/ganapati/utils.rb +47 -0
- data/lib/ganapati/version.rb +3 -0
- metadata +79 -4
data/lib/ganapati.rb
CHANGED
data/lib/ganapati/client.rb
CHANGED
@@ -103,9 +103,11 @@ module Ganapati
|
|
103
103
|
@client.stat pname(path)
|
104
104
|
end
|
105
105
|
|
106
|
-
def ls(path, details=false)
|
106
|
+
def ls(path, details=false, recursive=false)
|
107
107
|
statuses = @client.listStatus pname(path)
|
108
|
-
(details) ? statuses : statuses.map { |s| s.path }
|
108
|
+
paths = (details) ? statuses : statuses.map { |s| s.path }
|
109
|
+
return paths if not recursive
|
110
|
+
paths + statuses.select { |s| s.isdir }.map { |s| ls(s.path, details, recursive) }.flatten
|
109
111
|
end
|
110
112
|
|
111
113
|
def chmod(path, mode)
|
@@ -0,0 +1,47 @@
|
|
1
|
+
module Ganapati
|
2
|
+
class FileUrl
|
3
|
+
attr_reader :scheme, :host, :port, :path
|
4
|
+
|
5
|
+
def initialize(url, default_scheme='yourmom', default_host='localhost', default_port=8118)
|
6
|
+
@url = url
|
7
|
+
if @url.start_with? 'file://' or (not @url.start_with? 'hdfs://' and default_scheme == :file)
|
8
|
+
parse_file_scheme
|
9
|
+
else
|
10
|
+
parse_hdfs_scheme(default_host, default_port)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def to_s
|
15
|
+
@url
|
16
|
+
end
|
17
|
+
|
18
|
+
def hdfs?
|
19
|
+
@scheme == :hdfs
|
20
|
+
end
|
21
|
+
|
22
|
+
def local?
|
23
|
+
@scheme == :file
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
def parse_file_scheme
|
28
|
+
@scheme = :file
|
29
|
+
@path = @url.slice(7, @url.length-7)
|
30
|
+
end
|
31
|
+
|
32
|
+
def parse_hdfs_scheme(default_host, default_port)
|
33
|
+
@scheme = :hdfs
|
34
|
+
@path = @url.start_with?('hdfs://') ? @url.slice(7, @url.length-7) : @url
|
35
|
+
if @path.start_with? '/'
|
36
|
+
@host = default_host
|
37
|
+
@port = default_port.to_i
|
38
|
+
else
|
39
|
+
parts = @path.split('/')
|
40
|
+
hostport = parts.shift.split(':')
|
41
|
+
@host = hostport.first
|
42
|
+
@port = (hostport.length == 2) ? hostport.last.to_i : default_port.to_i
|
43
|
+
@path = '/' + parts.join('/')
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ganapati
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Brian Muller
|
@@ -38,6 +38,8 @@ description: Hadoop HDFS Thrift interface for Ruby
|
|
38
38
|
email: brian.muller@livingsocial.com
|
39
39
|
executables:
|
40
40
|
- hdfs_thrift_server
|
41
|
+
- hls
|
42
|
+
- hcp
|
41
43
|
extensions: []
|
42
44
|
|
43
45
|
extra_rdoc_files: []
|
@@ -45,11 +47,84 @@ extra_rdoc_files: []
|
|
45
47
|
files:
|
46
48
|
- lib/ganapati/client.rb
|
47
49
|
- lib/ganapati/hfile.rb
|
50
|
+
- lib/ganapati/utils.rb
|
51
|
+
- lib/ganapati/version.rb
|
48
52
|
- lib/ganapati.rb
|
49
53
|
- lib/thrift/hadoopfs_constants.rb
|
50
54
|
- lib/thrift/hadoopfs_types.rb
|
51
55
|
- lib/thrift/thrift_hadoop_file_system.rb
|
56
|
+
- LICENSE
|
57
|
+
- Rakefile
|
58
|
+
- README.rdoc
|
59
|
+
- docs/classes/Ganapati/Client.html
|
60
|
+
- docs/classes/Ganapati/FileUrl.html
|
61
|
+
- docs/classes/Ganapati/HFile.html
|
62
|
+
- docs/classes/Ganapati.html
|
63
|
+
- docs/classes/ThriftHadoopFileSystem/Append_args.html
|
64
|
+
- docs/classes/ThriftHadoopFileSystem/Append_result.html
|
65
|
+
- docs/classes/ThriftHadoopFileSystem/BlockLocation.html
|
66
|
+
- docs/classes/ThriftHadoopFileSystem/Chmod_args.html
|
67
|
+
- docs/classes/ThriftHadoopFileSystem/Chmod_result.html
|
68
|
+
- docs/classes/ThriftHadoopFileSystem/Chown_args.html
|
69
|
+
- docs/classes/ThriftHadoopFileSystem/Chown_result.html
|
70
|
+
- docs/classes/ThriftHadoopFileSystem/Client.html
|
71
|
+
- docs/classes/ThriftHadoopFileSystem/Close_args.html
|
72
|
+
- docs/classes/ThriftHadoopFileSystem/Close_result.html
|
73
|
+
- docs/classes/ThriftHadoopFileSystem/Create_args.html
|
74
|
+
- docs/classes/ThriftHadoopFileSystem/Create_result.html
|
75
|
+
- docs/classes/ThriftHadoopFileSystem/CreateFile_args.html
|
76
|
+
- docs/classes/ThriftHadoopFileSystem/CreateFile_result.html
|
77
|
+
- docs/classes/ThriftHadoopFileSystem/Exists_args.html
|
78
|
+
- docs/classes/ThriftHadoopFileSystem/Exists_result.html
|
79
|
+
- docs/classes/ThriftHadoopFileSystem/FileStatus.html
|
80
|
+
- docs/classes/ThriftHadoopFileSystem/GetFileBlockLocations_args.html
|
81
|
+
- docs/classes/ThriftHadoopFileSystem/GetFileBlockLocations_result.html
|
82
|
+
- docs/classes/ThriftHadoopFileSystem/ListStatus_args.html
|
83
|
+
- docs/classes/ThriftHadoopFileSystem/ListStatus_result.html
|
84
|
+
- docs/classes/ThriftHadoopFileSystem/MalformedInputException.html
|
85
|
+
- docs/classes/ThriftHadoopFileSystem/Mkdirs_args.html
|
86
|
+
- docs/classes/ThriftHadoopFileSystem/Mkdirs_result.html
|
87
|
+
- docs/classes/ThriftHadoopFileSystem/Open_args.html
|
88
|
+
- docs/classes/ThriftHadoopFileSystem/Open_result.html
|
89
|
+
- docs/classes/ThriftHadoopFileSystem/Pathname.html
|
90
|
+
- docs/classes/ThriftHadoopFileSystem/Processor.html
|
91
|
+
- docs/classes/ThriftHadoopFileSystem/Read_args.html
|
92
|
+
- docs/classes/ThriftHadoopFileSystem/Read_result.html
|
93
|
+
- docs/classes/ThriftHadoopFileSystem/Rename_args.html
|
94
|
+
- docs/classes/ThriftHadoopFileSystem/Rename_result.html
|
95
|
+
- docs/classes/ThriftHadoopFileSystem/Rm_args.html
|
96
|
+
- docs/classes/ThriftHadoopFileSystem/Rm_result.html
|
97
|
+
- docs/classes/ThriftHadoopFileSystem/SetInactivityTimeoutPeriod_args.html
|
98
|
+
- docs/classes/ThriftHadoopFileSystem/SetInactivityTimeoutPeriod_result.html
|
99
|
+
- docs/classes/ThriftHadoopFileSystem/SetReplication_args.html
|
100
|
+
- docs/classes/ThriftHadoopFileSystem/SetReplication_result.html
|
101
|
+
- docs/classes/ThriftHadoopFileSystem/Shutdown_args.html
|
102
|
+
- docs/classes/ThriftHadoopFileSystem/Shutdown_result.html
|
103
|
+
- docs/classes/ThriftHadoopFileSystem/Stat_args.html
|
104
|
+
- docs/classes/ThriftHadoopFileSystem/Stat_result.html
|
105
|
+
- docs/classes/ThriftHadoopFileSystem/ThriftHandle.html
|
106
|
+
- docs/classes/ThriftHadoopFileSystem/ThriftIOException.html
|
107
|
+
- docs/classes/ThriftHadoopFileSystem/Write_args.html
|
108
|
+
- docs/classes/ThriftHadoopFileSystem/Write_result.html
|
109
|
+
- docs/classes/ThriftHadoopFileSystem.html
|
110
|
+
- docs/created.rid
|
111
|
+
- docs/files/lib/ganapati/client_rb.html
|
112
|
+
- docs/files/lib/ganapati/hfile_rb.html
|
113
|
+
- docs/files/lib/ganapati/utils_rb.html
|
114
|
+
- docs/files/lib/ganapati/version_rb.html
|
115
|
+
- docs/files/lib/ganapati_rb.html
|
116
|
+
- docs/files/lib/thrift/hadoopfs_constants_rb.html
|
117
|
+
- docs/files/lib/thrift/hadoopfs_types_rb.html
|
118
|
+
- docs/files/lib/thrift/thrift_hadoop_file_system_rb.html
|
119
|
+
- docs/files/README_rdoc.html
|
120
|
+
- docs/fr_class_index.html
|
121
|
+
- docs/fr_file_index.html
|
122
|
+
- docs/fr_method_index.html
|
123
|
+
- docs/index.html
|
124
|
+
- docs/rdoc-style.css
|
52
125
|
- bin/hdfs_thrift_server
|
126
|
+
- bin/hls
|
127
|
+
- bin/hcp
|
53
128
|
has_rdoc: true
|
54
129
|
homepage: https://github.com/livingsocial/ganapati
|
55
130
|
licenses: []
|
@@ -79,7 +154,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
79
154
|
version: "0"
|
80
155
|
requirements: []
|
81
156
|
|
82
|
-
rubyforge_project:
|
157
|
+
rubyforge_project: ganapati
|
83
158
|
rubygems_version: 1.3.7
|
84
159
|
signing_key:
|
85
160
|
specification_version: 3
|