Module: IMW::Resources::Schemes::HDFSDirectory

Defined in:
lib/imw/resources/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:



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

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:



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

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