Class: Kcl::Workers::ShardInfo
- Inherits:
-
Object
- Object
- Kcl::Workers::ShardInfo
- Defined in:
- lib/kcl/workers/shard_info.rb
Instance Attribute Summary collapse
-
#assigned_to ⇒ Object
Returns the value of attribute assigned_to.
-
#checkpoint ⇒ Object
Returns the value of attribute checkpoint.
-
#ending_sequence_number ⇒ Object
readonly
Returns the value of attribute ending_sequence_number.
-
#lease_timeout ⇒ Object
Returns the value of attribute lease_timeout.
-
#parent_shard_id ⇒ Object
readonly
Returns the value of attribute parent_shard_id.
-
#shard_id ⇒ Object
readonly
Returns the value of attribute shard_id.
-
#starting_sequence_number ⇒ Object
readonly
Returns the value of attribute starting_sequence_number.
Instance Method Summary collapse
- #completed? ⇒ Boolean
-
#initialize(shard_id, parent_shard_id, sequence_number_range) ⇒ ShardInfo
constructor
A new instance of ShardInfo.
- #lease_owner ⇒ Object
- #lease_owner=(assigned_to) ⇒ Object
-
#to_h ⇒ Object
For debug.
Constructor Details
#initialize(shard_id, parent_shard_id, sequence_number_range) ⇒ ShardInfo
Returns a new instance of ShardInfo.
12 13 14 15 16 17 18 19 20 |
# File 'lib/kcl/workers/shard_info.rb', line 12 def initialize(shard_id, parent_shard_id, sequence_number_range) @shard_id = shard_id @parent_shard_id = parent_shard_id || 0 @starting_sequence_number = sequence_number_range[:starting_sequence_number] @ending_sequence_number = sequence_number_range[:ending_sequence_number] @assigned_to = nil @checkpoint = nil @lease_timeout = nil end |
Instance Attribute Details
#assigned_to ⇒ Object
Returns the value of attribute assigned_to.
7 8 9 |
# File 'lib/kcl/workers/shard_info.rb', line 7 def assigned_to @assigned_to end |
#checkpoint ⇒ Object
Returns the value of attribute checkpoint.
7 8 9 |
# File 'lib/kcl/workers/shard_info.rb', line 7 def checkpoint @checkpoint end |
#ending_sequence_number ⇒ Object (readonly)
Returns the value of attribute ending_sequence_number.
3 4 5 |
# File 'lib/kcl/workers/shard_info.rb', line 3 def ending_sequence_number @ending_sequence_number end |
#lease_timeout ⇒ Object
Returns the value of attribute lease_timeout.
7 8 9 |
# File 'lib/kcl/workers/shard_info.rb', line 7 def lease_timeout @lease_timeout end |
#parent_shard_id ⇒ Object (readonly)
Returns the value of attribute parent_shard_id.
3 4 5 |
# File 'lib/kcl/workers/shard_info.rb', line 3 def parent_shard_id @parent_shard_id end |
#shard_id ⇒ Object (readonly)
Returns the value of attribute shard_id.
3 4 5 |
# File 'lib/kcl/workers/shard_info.rb', line 3 def shard_id @shard_id end |
#starting_sequence_number ⇒ Object (readonly)
Returns the value of attribute starting_sequence_number.
3 4 5 |
# File 'lib/kcl/workers/shard_info.rb', line 3 def starting_sequence_number @starting_sequence_number end |
Instance Method Details
#completed? ⇒ Boolean
30 31 32 |
# File 'lib/kcl/workers/shard_info.rb', line 30 def completed? @checkpoint == Kcl::Checkpoints::Sentinel::SHARD_END end |
#lease_owner ⇒ Object
22 23 24 |
# File 'lib/kcl/workers/shard_info.rb', line 22 def lease_owner @assigned_to end |
#lease_owner=(assigned_to) ⇒ Object
26 27 28 |
# File 'lib/kcl/workers/shard_info.rb', line 26 def lease_owner=(assigned_to) @assigned_to = assigned_to end |
#to_h ⇒ Object
For debug
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/kcl/workers/shard_info.rb', line 35 def to_h { shard_id: shard_id, parent_shard_id: parent_shard_id, starting_sequence_number: starting_sequence_number, ending_sequence_number: ending_sequence_number, assigned_to: assigned_to, checkpoint: checkpoint, lease_timeout: lease_timeout } end |