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, end_row = nil, timestamp = nil) ⇒ Object
Instance Method Details
#close_scanner(scanner) ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/hbase/operation/scanner_operation.rb', line 34 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
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/hbase/operation/scanner_operation.rb', line 17 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, end_row = nil, timestamp = nil) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/hbase/operation/scanner_operation.rb', line 4 def open_scanner(table_name, columns, start_row = nil, end_row = nil, = nil) begin request = Request::ScannerRequest.new(table_name) scanner_id = Response::ScannerResponse.new(post(request.open(columns, start_row, end_row, ))).get_scanner_id 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 |