Class: UnifiedQueues::Multi::Driver Abstract
- Inherits:
-
Object
- Object
- UnifiedQueues::Multi::Driver
- Defined in:
- lib/unified-queues/multi/driver.rb,
lib/unified-queues/multi/driver/em-jack.rb,
lib/unified-queues/multi/driver/unified-queues.rb
Overview
Abstract multi driver class.
Direct Known Subclasses
Defined Under Namespace
Modules: EMJackDriver, UnifiedQueuesDriver
Instance Attribute Summary collapse
-
#native ⇒ Object
Holds native object.
Instance Method Summary collapse
-
#close(&block) ⇒ Object
(also: #close!)
Closes the session.
-
#initialize(cls, *args, &block) ⇒ Driver
constructor
Constructor.
-
#list(&block) ⇒ Array
abstract
Lists names of all available queues.
-
#list_subscribed(&block) ⇒ Array
abstract
Lists all subscribed queues.
-
#list_used(&block) ⇒ Array
abstract
Lists all used queues.
-
#pop(blocking = false, &block) ⇒ Object|nil
abstract
Pops value from the queue.
-
#push(value, &block) ⇒ Object
abstract
Pushes value to the currently used queue.
-
#subscribe(name, &block) ⇒ Object
abstract
Subscribes to the queue.
-
#subscribed(&block) ⇒ UniversalQueues::Single
abstract
Currently subscribed queue.
-
#unsubscribe(name, &block) ⇒ Object
abstract
Unsubscribes from the queue.
-
#use(name, &block) ⇒ Object
abstract
Sets queue with given name as used.
-
#used(&block) ⇒ Queue
abstract
Currently used queue.
Constructor Details
#initialize(cls, *args, &block) ⇒ Driver
Constructor.
38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/unified-queues/multi/driver.rb', line 38 def initialize(cls, *args, &block) if self.instance_of? UniversalQueues::Multi::Driver not_implemented end if cls.kind_of? Class @native = cls::new(*args, &block) else @native = cls end end |
Instance Attribute Details
#native ⇒ Object
Holds native object.
31 32 33 |
# File 'lib/unified-queues/multi/driver.rb', line 31 def native @native end |
Instance Method Details
#close(&block) ⇒ Object Also known as: close!
Closes the session.
168 169 170 |
# File 'lib/unified-queues/multi/driver.rb', line 168 def close(&block) yield if not block.nil? end |
#list(&block) ⇒ Array
Lists names of all available queues.
138 139 140 |
# File 'lib/unified-queues/multi/driver.rb', line 138 def list(&block) not_implemented end |
#list_subscribed(&block) ⇒ Array
Lists all subscribed queues.
160 161 162 |
# File 'lib/unified-queues/multi/driver.rb', line 160 def list_subscribed(&block) not_implemented end |
#list_used(&block) ⇒ Array
Lists all used queues.
149 150 151 |
# File 'lib/unified-queues/multi/driver.rb', line 149 def list_used(&block) not_implemented end |
#pop(blocking = false, &block) ⇒ Object|nil
Pops value from the queue. In contrast to default Queue library, blocks or returns nil
if empty.
70 71 72 |
# File 'lib/unified-queues/multi/driver.rb', line 70 def pop(blocking = false, &block) not_implemented end |
#push(value, &block) ⇒ Object
Pushes value to the currently used queue.
57 58 59 |
# File 'lib/unified-queues/multi/driver.rb', line 57 def push(value, &block) not_implemented end |
#subscribe(name, &block) ⇒ Object
Subscribes to the queue. So marks it as target for #pop. Note, than only single queue can be subscribed at one time.
94 95 96 |
# File 'lib/unified-queues/multi/driver.rb', line 94 def subscribe(name, &block) not_implemented end |
#subscribed(&block) ⇒ UniversalQueues::Single
Currently subscribed queue.
127 128 129 |
# File 'lib/unified-queues/multi/driver.rb', line 127 def subscribed(&block) not_implemented end |
#unsubscribe(name, &block) ⇒ Object
Unsubscribes from the queue.
105 106 107 |
# File 'lib/unified-queues/multi/driver.rb', line 105 def unsubscribe(name, &block) not_implemented end |
#use(name, &block) ⇒ Object
Sets queue with given name as used. So marks it as target for #push.
82 83 84 |
# File 'lib/unified-queues/multi/driver.rb', line 82 def use(name, &block) not_implemented end |
#used(&block) ⇒ Queue
Currently used queue.
116 117 118 |
# File 'lib/unified-queues/multi/driver.rb', line 116 def used(&block) not_implemented end |