Module: IMW::Schemes::HDFSDirectory

Defined in:
lib/imw/schemes/hdfs.rb

Overview

Defines methods for listing contents of HDFS directories.

Instance Method Summary collapse

Instance Method Details

#contentsArray<String>

Return the paths of all files and directories directly below this directory on the HDFS.

Returns:



221
222
223
224
225
226
227
228
# File 'lib/imw/schemes/hdfs.rb', line 221

def contents
  returning([]) do |paths|
    HDFS.fs(:ls, path) do |line|
      next if line =~ /^Found.*items$/
      paths << line.split.last
    end
  end
end

#resourcesArray<IMW::Resource>

Return the resources directly below this directory on the HDFS.

Returns:



234
235
236
# File 'lib/imw/schemes/hdfs.rb', line 234

def resources
  contents.map { |path| IMW.open(path) }
end