Class: RR::ProxyRowCursor
- Inherits:
-
ProxyCursor
- Object
- ProxyCursor
- RR::ProxyRowCursor
- Defined in:
- lib/rubyrep/proxy_row_cursor.rb
Overview
This class is used to scan a given table range Can return rows either themselves or only their checksum
Instance Attribute Summary collapse
-
#current_row ⇒ Object
The column_name => value hash of the current row.
Attributes inherited from ProxyCursor
#connection, #cursor, #primary_key_names, #table
Instance Method Summary collapse
-
#initialize(session, table) ⇒ ProxyRowCursor
constructor
Creates a new cursor * session: the current proxy session * table: table_name.
-
#next? ⇒ Boolean
Returns true if there are unprocessed rows in the table range.
-
#next_row ⇒ Object
Returns the next row in cursor.
-
#next_row_keys_and_checksum ⇒ Object
Returns for the next row * a hash of :column_name => value pairs of the primary keys * checksum string for that row.
Methods inherited from ProxyCursor
Constructor Details
#initialize(session, table) ⇒ ProxyRowCursor
Creates a new cursor
* session: the current proxy session
* table: table_name
19 20 21 |
# File 'lib/rubyrep/proxy_row_cursor.rb', line 19 def initialize(session, table) super end |
Instance Attribute Details
#current_row ⇒ Object
The column_name => value hash of the current row.
14 15 16 |
# File 'lib/rubyrep/proxy_row_cursor.rb', line 14 def current_row @current_row end |
Instance Method Details
#next? ⇒ Boolean
Returns true if there are unprocessed rows in the table range
24 25 26 |
# File 'lib/rubyrep/proxy_row_cursor.rb', line 24 def next? cursor.next? end |
#next_row ⇒ Object
Returns the next row in cursor
29 30 31 |
# File 'lib/rubyrep/proxy_row_cursor.rb', line 29 def next_row cursor.next_row end |
#next_row_keys_and_checksum ⇒ Object
Returns for the next row
* a hash of :column_name => value pairs of the primary keys
* checksum string for that row
36 37 38 39 40 41 |
# File 'lib/rubyrep/proxy_row_cursor.rb', line 36 def next_row_keys_and_checksum self.current_row = cursor.next_row keys = self.current_row.reject {|key, | not primary_key_names.include? key} checksum = Digest::SHA1.hexdigest(Marshal.dump(self.current_row)) return keys, checksum end |