Class: RedisClient::Cluster::Pipeline::Extended

Inherits:
Pipeline
  • Object
show all
Defined in:
lib/redis_client/cluster/pipeline.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeExtended

Returns a new instance of Extended.



17
18
19
20
# File 'lib/redis_client/cluster/pipeline.rb', line 17

def initialize(...)
  super
  @outer_indices = nil
end

Instance Attribute Details

#outer_indicesObject (readonly)

Returns the value of attribute outer_indices.



15
16
17
# File 'lib/redis_client/cluster/pipeline.rb', line 15

def outer_indices
  @outer_indices
end

Instance Method Details

#add_outer_index(index) ⇒ Object



22
23
24
25
# File 'lib/redis_client/cluster/pipeline.rb', line 22

def add_outer_index(index)
  @outer_indices ||= []
  @outer_indices << index
end

#coerce_except!(replies, indices) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/redis_client/cluster/pipeline.rb', line 49

def coerce_except!(replies, indices)
  return replies unless @blocks.is_a?(Array)

  skipped = Set.new(indices)
  @blocks.each_with_index do |block, index|
    next if block.nil? || skipped.include?(index)

    replies[index] = block.call(replies[index])
  end

  replies
end

#get_block(inner_index) ⇒ Object



45
46
47
# File 'lib/redis_client/cluster/pipeline.rb', line 45

def get_block(inner_index)
  @blocks.is_a?(Array) ? @blocks[inner_index] : nil
end

#get_callee_method(inner_index) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'lib/redis_client/cluster/pipeline.rb', line 27

def get_callee_method(inner_index)
  if @timeouts.is_a?(Array) && !@timeouts[inner_index].nil?
    :blocking_call_v
  elsif _retryable?
    :call_once_v
  else
    :call_v
  end
end

#get_command(inner_index) ⇒ Object



37
38
39
# File 'lib/redis_client/cluster/pipeline.rb', line 37

def get_command(inner_index)
  @commands.is_a?(Array) ? @commands[inner_index] : nil
end

#get_timeout(inner_index) ⇒ Object



41
42
43
# File 'lib/redis_client/cluster/pipeline.rb', line 41

def get_timeout(inner_index)
  @timeouts.is_a?(Array) ? @timeouts[inner_index] : nil
end