Sha256: 4b39913840efd24d30afd8d298d43dc2c785db351d68f55b341fb8eaa79b3994

Contents?: true

Size: 693 Bytes

Versions: 4

Compression:

Stored size: 693 Bytes

Contents

module Asynchronic
  class Environment

    attr_reader :queue_engine, :data_store, :notifier
    
    def initialize(queue_engine, data_store, notifier)
      @queue_engine = queue_engine
      @data_store = data_store
      @notifier = notifier
    end

    def queue(name)
      queue_engine[name]
    end

    def default_queue
      queue(queue_engine.default_queue)
    end

    def enqueue(msg, queue=nil)
      queue(queue || queue_engine.default_queue).push msg
    end

    def create_process(type, params={})
      Process.create self, type, params
    end

    def load_process(id)
      Process.new self, id
    end
    
    def processes
      Process.all self
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
asynchronic-3.0.3 lib/asynchronic/environment.rb
asynchronic-3.0.2 lib/asynchronic/environment.rb
asynchronic-3.0.1 lib/asynchronic/environment.rb
asynchronic-3.0.0 lib/asynchronic/environment.rb