Class: ClickHouse::RecordSyncContext
- Inherits:
-
Object
- Object
- ClickHouse::RecordSyncContext
- Defined in:
- lib/click_house/record_sync_context.rb
Instance Attribute Summary collapse
-
#last_processed_id ⇒ Object
Returns the value of attribute last_processed_id.
-
#last_record_id ⇒ Object
readonly
Returns the value of attribute last_record_id.
-
#record_count_in_current_batch ⇒ Object
readonly
Returns the value of attribute record_count_in_current_batch.
-
#total_record_count ⇒ Object
readonly
Returns the value of attribute total_record_count.
Instance Method Summary collapse
-
#initialize(last_record_id:, max_records_per_batch:, runtime_limiter: Analytics::CycleAnalytics::RuntimeLimiter.new) ⇒ RecordSyncContext
constructor
A new instance of RecordSyncContext.
- #new_batch! ⇒ Object
- #no_more_records! ⇒ Object
- #no_more_records? ⇒ Boolean
- #record_limit_reached? ⇒ Boolean
Constructor Details
#initialize(last_record_id:, max_records_per_batch:, runtime_limiter: Analytics::CycleAnalytics::RuntimeLimiter.new) ⇒ RecordSyncContext
Returns a new instance of RecordSyncContext.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/click_house/record_sync_context.rb', line 7 def initialize( last_record_id:, max_records_per_batch:, runtime_limiter: Analytics::CycleAnalytics::RuntimeLimiter.new) @last_record_id = last_record_id @runtime_limiter = runtime_limiter @max_records_per_batch = max_records_per_batch @last_processed_id = nil @record_count_in_current_batch = 0 @total_record_count = 0 end |
Instance Attribute Details
#last_processed_id ⇒ Object
Returns the value of attribute last_processed_id.
5 6 7 |
# File 'lib/click_house/record_sync_context.rb', line 5 def last_processed_id @last_processed_id end |
#last_record_id ⇒ Object (readonly)
Returns the value of attribute last_record_id.
5 6 7 |
# File 'lib/click_house/record_sync_context.rb', line 5 def last_record_id @last_record_id end |
#record_count_in_current_batch ⇒ Object (readonly)
Returns the value of attribute record_count_in_current_batch.
5 6 7 |
# File 'lib/click_house/record_sync_context.rb', line 5 def record_count_in_current_batch @record_count_in_current_batch end |
#total_record_count ⇒ Object (readonly)
Returns the value of attribute total_record_count.
5 6 7 |
# File 'lib/click_house/record_sync_context.rb', line 5 def total_record_count @total_record_count end |
Instance Method Details
#new_batch! ⇒ Object
20 21 22 |
# File 'lib/click_house/record_sync_context.rb', line 20 def new_batch! @record_count_in_current_batch = 0 end |
#no_more_records! ⇒ Object
24 25 26 |
# File 'lib/click_house/record_sync_context.rb', line 24 def no_more_records! @no_more_records = true end |
#no_more_records? ⇒ Boolean
28 29 30 |
# File 'lib/click_house/record_sync_context.rb', line 28 def no_more_records? !!@no_more_records end |
#record_limit_reached? ⇒ Boolean
39 40 41 |
# File 'lib/click_house/record_sync_context.rb', line 39 def record_limit_reached? @record_count_in_current_batch == @max_records_per_batch end |