Class: MultiRedis::Executor::OperationExecution

Inherits:
Object
  • Object
show all
Defined in:
lib/multi_redis/executor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(operation, args, shared_context) ⇒ OperationExecution

Returns a new instance of OperationExecution.


57
58
59
60
61
62
63
64
65
66
# File 'lib/multi_redis/executor.rb', line 57

def initialize operation, args, shared_context

  @operation = operation
  @args = args

  @context = Context.new shared_context.redis, shared_context
  @steps = operation.steps

  @current_index = 0
end

Instance Attribute Details

#final_resultsObject (readonly)

Returns the value of attribute final_results


55
56
57
# File 'lib/multi_redis/executor.rb', line 55

def final_results
  @final_results
end

Instance Method Details

#done?Boolean

Returns:

  • (Boolean)

68
69
70
# File 'lib/multi_redis/executor.rb', line 68

def done?
  !current_step
end

#execute_current_stepObject


76
77
78
79
80
# File 'lib/multi_redis/executor.rb', line 76

def execute_current_step
  results = @context.execute current_step, *@args
  @current_index += 1
  @final_results = results
end

#next?(type) ⇒ Boolean

Returns:

  • (Boolean)

72
73
74
# File 'lib/multi_redis/executor.rb', line 72

def next? type
  current_step && current_step.type == type
end

#resolve_futures!Object


82
83
84
# File 'lib/multi_redis/executor.rb', line 82

def resolve_futures!
  @context.resolve_futures!
end

#resolve_operation_future!Object


86
87
88
# File 'lib/multi_redis/executor.rb', line 86

def resolve_operation_future!
  @operation.future.value = @final_results if @operation.future
end