Class: HBase::Scanner
- Inherits:
-
Object
- Object
- HBase::Scanner
- Includes:
- XmlDecoder
- Defined in:
- lib/mandy/ruby-hbase/scanner.rb
Instance Method Summary collapse
- #close ⇒ Object
- #each ⇒ Object
-
#initialize(table, scanner_uri) ⇒ Scanner
constructor
A new instance of Scanner.
- #next ⇒ Object
Methods included from XmlDecoder
Constructor Details
#initialize(table, scanner_uri) ⇒ Scanner
Returns a new instance of Scanner.
5 6 7 |
# File 'lib/mandy/ruby-hbase/scanner.rb', line 5 def initialize(table, scanner_uri) @table, @scanner_uri = table, scanner_uri end |
Instance Method Details
#close ⇒ Object
9 10 11 |
# File 'lib/mandy/ruby-hbase/scanner.rb', line 9 def close end |
#each ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/mandy/ruby-hbase/scanner.rb', line 17 def each parsed_uri = URI.parse(@scanner_uri) Net::HTTP.start(parsed_uri.host, parsed_uri.port) do |session| while true response = session.post(@scanner_uri, "") case response.code.to_i when 404 # over break when 200 # item yield *parse_row_result(response.body) else # error raise "Unexpected response code #{response.code}, body:\n#{response.body}" end end end end |
#next ⇒ Object
13 14 15 |
# File 'lib/mandy/ruby-hbase/scanner.rb', line 13 def next end |