Class: UnifiedQueues::Multi::Driver Abstract

Inherits:
Object
  • Object
show all
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

This class is abstract.

Abstract multi driver class.

Defined Under Namespace

Modules: EMJackDriver, UnifiedQueuesDriver

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nativeObject

Holds native object.

Returns:

  • (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

This method is abstract.

Lists names of all available queues.

Returns:

  • (Array)


138
139
140
# File 'lib/unified-queues/multi/driver.rb', line 138

def list(&block)
    not_implemented
end

#list_subscribed(&block) ⇒ Array

This method is abstract.

Lists all subscribed queues.

Returns:

  • (Array)


160
161
162
# File 'lib/unified-queues/multi/driver.rb', line 160

def list_subscribed(&block)
    not_implemented
end

#list_used(&block) ⇒ Array

This method is abstract.

Lists all used queues.

Returns:

  • (Array)


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

This method is abstract.

Pops value from the queue. In contrast to default Queue library, blocks or returns nil if empty.

Parameters:

  • blocking (Boolean|Integer) (defaults to: false)

    true or timeout if it should block, false otherwise

Returns:

  • (Object|nil)


70
71
72
# File 'lib/unified-queues/multi/driver.rb', line 70

def pop(blocking = false, &block)
    not_implemented
end

#push(value, &block) ⇒ Object

This method is abstract.

Pushes value to the currently used queue.

Parameters:

  • value (Object)


57
58
59
# File 'lib/unified-queues/multi/driver.rb', line 57

def push(value, &block)
    not_implemented
end

#subscribe(name, &block) ⇒ Object

This method is abstract.

Subscribes to the queue. So marks it as target for #pop. Note, than only single queue can be subscribed at one time.

Parameters:

  • name (Object)

    name of the required queue



94
95
96
# File 'lib/unified-queues/multi/driver.rb', line 94

def subscribe(name, &block)
    not_implemented
end

#subscribed(&block) ⇒ UniversalQueues::Single

This method is abstract.

Currently subscribed queue.

Returns:

  • (UniversalQueues::Single)


127
128
129
# File 'lib/unified-queues/multi/driver.rb', line 127

def subscribed(&block)
    not_implemented
end

#unsubscribe(name, &block) ⇒ Object

This method is abstract.

Unsubscribes from the queue.

Parameters:

  • name (Object)

    name of the required queue\



105
106
107
# File 'lib/unified-queues/multi/driver.rb', line 105

def unsubscribe(name, &block)
    not_implemented
end

#use(name, &block) ⇒ Object

This method is abstract.

Sets queue with given name as used. So marks it as target for #push.

Parameters:

  • name (Object)

    name of the required queue



82
83
84
# File 'lib/unified-queues/multi/driver.rb', line 82

def use(name, &block)
    not_implemented
end

#used(&block) ⇒ Queue

This method is abstract.

Currently used queue.

Returns:

  • (Queue)


116
117
118
# File 'lib/unified-queues/multi/driver.rb', line 116

def used(&block)
    not_implemented
end