Module: Conflow

Defined in:
lib/conflow.rb,
lib/conflow/job.rb,
lib/conflow/flow.rb,
lib/conflow/error.rb,
lib/conflow/redis.rb,
lib/conflow/future.rb,
lib/conflow/worker.rb,
lib/conflow/promise.rb,
lib/conflow/version.rb,
lib/conflow/redis/field.rb,
lib/conflow/redis/model.rb,
lib/conflow/redis/script.rb,
lib/conflow/redis/findable.rb,
lib/conflow/redis/set_field.rb,
lib/conflow/flow/job_builder.rb,
lib/conflow/flow/job_handler.rb,
lib/conflow/redis/hash_field.rb,
lib/conflow/redis/identifier.rb,
lib/conflow/redis/array_field.rb,
lib/conflow/redis/value_field.rb,
lib/conflow/redis/field_builder.rb,
lib/conflow/redis/add_job_script.rb,
lib/conflow/redis/raw_value_field.rb,
lib/conflow/redis/sorted_set_field.rb,
lib/conflow/redis/queue_jobs_script.rb,
lib/conflow/redis/connection_wrapper.rb,
lib/conflow/redis/complete_job_script.rb,
lib/conflow/redis/resolve_promises_script.rb

Overview

Conflow allows defining comlicated workflows with dependencies. Inspired by Gush (the idea) and Redis::Objects (the implementation) it focuses solely on dependency logic, while leaving queueing jobs and executing them entirely in hands of the programmer.

Defined Under Namespace

Modules: Redis, Worker Classes: Error, Flow, Future, InvalidNestedFuture, Job, Promise

Constant Summary collapse

VERSION =

Current version of the gem

"0.4.2"

Class Method Summary collapse

Class Method Details

.redisConflow::Redis::ConnectionWrapper, ConnectionPool

Returns Wrapped Redis connection.

Returns:



60
61
62
63
# File 'lib/conflow.rb', line 60

def redis
  self.redis = ::Redis.current unless defined?(@redis)
  @redis
end

.redis=(conn) ⇒ Object

Assigns Redis connection to be used by Conflow. It will be wrapped in ConnectionWrapper for Redis instances, in order to have single API containing #with method. You can also assign ConnectionPool instance.

Examples:

Conflow.redis = Redis.new

Parameters:

  • conn (Redis, ConnectionPool)

    Redis connection



50
51
52
53
54
55
56
57
# File 'lib/conflow.rb', line 50

def redis=(conn)
  @redis =
    if defined?(ConnectionPool) && conn.is_a?(ConnectionPool)
      conn
    else
      Conflow::Redis::ConnectionWrapper.new(conn)
    end
end