Module: HBase::Operation::ScannerOperation
- Included in:
- Client
- Defined in:
- lib/hbase/operation/scanner_operation.rb
Instance Method Summary collapse
- #close_scanner(scanner) ⇒ Object
- #get_rows(scanner, limit = 1) ⇒ Object
- #open_scanner(table_name, columns, start_row = nil, stop_row = nil, timestamp = nil) ⇒ Object
Instance Method Details
#close_scanner(scanner) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/hbase/operation/scanner_operation.rb', line 36 def close_scanner(scanner) begin request = Request::ScannerRequest.new(scanner.table_name) Response::ScannerResponse.new(delete(request.close(scanner.scanner_id))) rescue StandardError => e if e.to_s.include?("TableNotFoundException") raise TableNotFoundError, "Table #{table_name} Not Found!" else raise StandardError, e.to_s end end end |
#get_rows(scanner, limit = 1) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/hbase/operation/scanner_operation.rb', line 19 def get_rows(scanner, limit = 1) begin request = Request::ScannerRequest.new(scanner.table_name) rows = Response::ScannerResponse.new(post(request.get_rows(scanner.scanner_id, limit))).parse rows.each do |row| row.table_name = scanner.table_name end rows rescue StandardError => e if e.to_s.include?("TableNotFoundException") raise TableNotFoundError, "Table #{table_name} Not Found!" else raise StandardError, e.to_s end end end |
#open_scanner(table_name, columns, start_row = nil, stop_row = nil, timestamp = nil) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/hbase/operation/scanner_operation.rb', line 4 def open_scanner(table_name, columns, start_row = nil, stop_row = nil, = nil) begin request = Request::ScannerRequest.new(table_name) scanner = Response::ScannerResponse.new(post(request.open(columns, start_row, stop_row, ))).parse scanner.table_name = table_name scanner rescue Net::ProtocolError => e if e.to_s.include?("TableNotFoundException") raise TableNotFoundError, "Table #{table_name} Not Found!" else raise StandardError, e.to_s end end end |