Class: RSwim::Member::TransmissionState::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/rswim/member/transmission_state/base.rb

Direct Known Subclasses

AwaitingAck, Ready, SendingPing, SendingPingRequest

Instance Method Summary collapse

Constructor Details

#initialize(id, node_member_id, member_pool, source_ids, target_ids) ⇒ Base

Returns a new instance of Base.



7
8
9
10
11
12
13
14
# File 'lib/rswim/member/transmission_state/base.rb', line 7

def initialize(id, node_member_id, member_pool, source_ids, target_ids)
  @member_pool = member_pool
  @id = id
  @node_member_id = node_member_id
  @source_ids = source_ids
  @target_ids = target_ids
  logger.debug("Member with id #{id} entered new state: #{self.class}")
end

Instance Method Details

#advance(_elapsed_seconds) ⇒ Object



18
19
20
# File 'lib/rswim/member/transmission_state/base.rb', line 18

def advance(_elapsed_seconds)
  self
end

#enqueue_pingObject



26
27
28
# File 'lib/rswim/member/transmission_state/base.rb', line 26

def enqueue_ping
  @source_ids << @id
end

#enqueue_ping_from(source_id) ⇒ Object



30
31
32
# File 'lib/rswim/member/transmission_state/base.rb', line 30

def enqueue_ping_from(source_id)
  @source_ids << source_id
end

#enqueue_ping_request(target_id) ⇒ Object



34
35
36
# File 'lib/rswim/member/transmission_state/base.rb', line 34

def enqueue_ping_request(target_id)
  @target_ids << target_id
end

#member_replied_with_ackObject



16
# File 'lib/rswim/member/transmission_state/base.rb', line 16

def member_replied_with_ack; end

#prepare_outputObject



22
23
24
# File 'lib/rswim/member/transmission_state/base.rb', line 22

def prepare_output
  []
end