ganapati 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. data/LICENSE +674 -0
  2. data/README.rdoc +86 -0
  3. data/Rakefile +32 -0
  4. data/bin/hcp +64 -0
  5. data/bin/hls +42 -0
  6. data/docs/classes/Ganapati.html +138 -0
  7. data/docs/classes/Ganapati/Client.html +666 -0
  8. data/docs/classes/Ganapati/FileUrl.html +253 -0
  9. data/docs/classes/Ganapati/HFile.html +271 -0
  10. data/docs/classes/ThriftHadoopFileSystem.html +169 -0
  11. data/docs/classes/ThriftHadoopFileSystem/Append_args.html +193 -0
  12. data/docs/classes/ThriftHadoopFileSystem/Append_result.html +198 -0
  13. data/docs/classes/ThriftHadoopFileSystem/BlockLocation.html +208 -0
  14. data/docs/classes/ThriftHadoopFileSystem/Chmod_args.html +198 -0
  15. data/docs/classes/ThriftHadoopFileSystem/Chmod_result.html +193 -0
  16. data/docs/classes/ThriftHadoopFileSystem/Chown_args.html +203 -0
  17. data/docs/classes/ThriftHadoopFileSystem/Chown_result.html +193 -0
  18. data/docs/classes/ThriftHadoopFileSystem/Client.html +1566 -0
  19. data/docs/classes/ThriftHadoopFileSystem/Close_args.html +193 -0
  20. data/docs/classes/ThriftHadoopFileSystem/Close_result.html +198 -0
  21. data/docs/classes/ThriftHadoopFileSystem/CreateFile_args.html +218 -0
  22. data/docs/classes/ThriftHadoopFileSystem/CreateFile_result.html +198 -0
  23. data/docs/classes/ThriftHadoopFileSystem/Create_args.html +193 -0
  24. data/docs/classes/ThriftHadoopFileSystem/Create_result.html +198 -0
  25. data/docs/classes/ThriftHadoopFileSystem/Exists_args.html +193 -0
  26. data/docs/classes/ThriftHadoopFileSystem/Exists_result.html +198 -0
  27. data/docs/classes/ThriftHadoopFileSystem/FileStatus.html +233 -0
  28. data/docs/classes/ThriftHadoopFileSystem/GetFileBlockLocations_args.html +203 -0
  29. data/docs/classes/ThriftHadoopFileSystem/GetFileBlockLocations_result.html +198 -0
  30. data/docs/classes/ThriftHadoopFileSystem/ListStatus_args.html +193 -0
  31. data/docs/classes/ThriftHadoopFileSystem/ListStatus_result.html +198 -0
  32. data/docs/classes/ThriftHadoopFileSystem/MalformedInputException.html +220 -0
  33. data/docs/classes/ThriftHadoopFileSystem/Mkdirs_args.html +193 -0
  34. data/docs/classes/ThriftHadoopFileSystem/Mkdirs_result.html +198 -0
  35. data/docs/classes/ThriftHadoopFileSystem/Open_args.html +193 -0
  36. data/docs/classes/ThriftHadoopFileSystem/Open_result.html +198 -0
  37. data/docs/classes/ThriftHadoopFileSystem/Pathname.html +193 -0
  38. data/docs/classes/ThriftHadoopFileSystem/Processor.html +710 -0
  39. data/docs/classes/ThriftHadoopFileSystem/Read_args.html +203 -0
  40. data/docs/classes/ThriftHadoopFileSystem/Read_result.html +198 -0
  41. data/docs/classes/ThriftHadoopFileSystem/Rename_args.html +198 -0
  42. data/docs/classes/ThriftHadoopFileSystem/Rename_result.html +198 -0
  43. data/docs/classes/ThriftHadoopFileSystem/Rm_args.html +198 -0
  44. data/docs/classes/ThriftHadoopFileSystem/Rm_result.html +198 -0
  45. data/docs/classes/ThriftHadoopFileSystem/SetInactivityTimeoutPeriod_args.html +199 -0
  46. data/docs/classes/ThriftHadoopFileSystem/SetInactivityTimeoutPeriod_result.html +188 -0
  47. data/docs/classes/ThriftHadoopFileSystem/SetReplication_args.html +198 -0
  48. data/docs/classes/ThriftHadoopFileSystem/SetReplication_result.html +193 -0
  49. data/docs/classes/ThriftHadoopFileSystem/Shutdown_args.html +193 -0
  50. data/docs/classes/ThriftHadoopFileSystem/Shutdown_result.html +188 -0
  51. data/docs/classes/ThriftHadoopFileSystem/Stat_args.html +193 -0
  52. data/docs/classes/ThriftHadoopFileSystem/Stat_result.html +198 -0
  53. data/docs/classes/ThriftHadoopFileSystem/ThriftHandle.html +193 -0
  54. data/docs/classes/ThriftHadoopFileSystem/ThriftIOException.html +220 -0
  55. data/docs/classes/ThriftHadoopFileSystem/Write_args.html +198 -0
  56. data/docs/classes/ThriftHadoopFileSystem/Write_result.html +198 -0
  57. data/docs/created.rid +1 -0
  58. data/docs/files/README_rdoc.html +209 -0
  59. data/docs/files/lib/ganapati/client_rb.html +101 -0
  60. data/docs/files/lib/ganapati/hfile_rb.html +101 -0
  61. data/docs/files/lib/ganapati/utils_rb.html +101 -0
  62. data/docs/files/lib/ganapati/version_rb.html +101 -0
  63. data/docs/files/lib/ganapati_rb.html +112 -0
  64. data/docs/files/lib/thrift/hadoopfs_constants_rb.html +117 -0
  65. data/docs/files/lib/thrift/hadoopfs_types_rb.html +110 -0
  66. data/docs/files/lib/thrift/thrift_hadoop_file_system_rb.html +118 -0
  67. data/docs/fr_class_index.html +77 -0
  68. data/docs/fr_file_index.html +35 -0
  69. data/docs/fr_method_index.html +222 -0
  70. data/docs/index.html +24 -0
  71. data/docs/rdoc-style.css +208 -0
  72. data/lib/ganapati.rb +1 -0
  73. data/lib/ganapati/client.rb +4 -2
  74. data/lib/ganapati/utils.rb +47 -0
  75. data/lib/ganapati/version.rb +3 -0
  76. metadata +79 -4
@@ -1,5 +1,6 @@
1
1
  require 'ganapati/client'
2
2
  require 'ganapati/hfile'
3
+ require 'ganapati/utils'
3
4
 
4
5
  $:.unshift File.join(File.dirname(__FILE__), 'thrift')
5
6
  require 'thrift_hadoop_file_system'
@@ -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
@@ -0,0 +1,3 @@
1
+ module Ganapati
2
+ VERSION = "0.0.5"
3
+ 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: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
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